Created
August 4, 2014 05:10
-
-
Save hedgerh/c686fcf0bbcb5e99eb26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() | |
| { int i; | |
| float water_data[31] = { 0.00, 0.00, 0.00, 0.00, 0.02, | |
| 0.00, 0.00, 0.00, 0.04, 1.03, | |
| 0.17, 0.81, 0.45, 0.69, 0.63, | |
| 0.02, 0.06, 0.00, 0.00, 0.00, | |
| 0.08, 0.00, 0.00, 0.00, 0.00, | |
| 0.00, 0.00, 0.00, 0.00, 0.00, | |
| 0.00 }; | |
| for (i = 1; i < 31; i++){ | |
| if (water_data[i] == 0 && water_data[i-1] == 0) { | |
| printf("Day %d: Sprinkler on\n", i); | |
| } | |
| else { | |
| printf("Day %d: Sprinkler off\n", i); | |
| } | |
| } | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .section __TEXT,__text,regular,pure_instructions | |
| .globl _main | |
| .align 4, 0x90 | |
| _main: ## @main | |
| .cfi_startproc | |
| ## BB#0: | |
| pushq %rbp | |
| Ltmp2: | |
| .cfi_def_cfa_offset 16 | |
| Ltmp3: | |
| .cfi_offset %rbp, -16 | |
| movq %rsp, %rbp | |
| Ltmp4: | |
| .cfi_def_cfa_register %rbp | |
| subq $160, %rsp | |
| leaq L_main.water_data(%rip), %rax | |
| movabsq $124, %rdx | |
| leaq -144(%rbp), %rcx | |
| movq ___stack_chk_guard@GOTPCREL(%rip), %rsi | |
| movq (%rsi), %rsi | |
| movq %rsi, -8(%rbp) | |
| movl $0, -12(%rbp) | |
| movq %rcx, %rdi | |
| movq %rax, %rsi | |
| callq _memcpy | |
| movl $1, -16(%rbp) | |
| LBB0_1: ## =>This Inner Loop Header: Depth=1 | |
| cmpl $31, -16(%rbp) | |
| jge LBB0_8 | |
| ## BB#2: ## in Loop: Header=BB0_1 Depth=1 | |
| xorps %xmm0, %xmm0 | |
| movslq -16(%rbp), %rax | |
| movss -144(%rbp,%rax,4), %xmm1 | |
| ucomiss %xmm0, %xmm1 | |
| jne LBB0_5 | |
| jp LBB0_5 | |
| ## BB#3: ## in Loop: Header=BB0_1 Depth=1 | |
| xorps %xmm0, %xmm0 | |
| movl -16(%rbp), %eax | |
| subl $1, %eax | |
| movslq %eax, %rcx | |
| movss -144(%rbp,%rcx,4), %xmm1 | |
| ucomiss %xmm0, %xmm1 | |
| jne LBB0_5 | |
| jp LBB0_5 | |
| ## BB#4: ## in Loop: Header=BB0_1 Depth=1 | |
| leaq L_.str(%rip), %rdi | |
| movl -16(%rbp), %esi | |
| movb $0, %al | |
| callq _printf | |
| movl %eax, -148(%rbp) ## 4-byte Spill | |
| jmp LBB0_6 | |
| LBB0_5: ## in Loop: Header=BB0_1 Depth=1 | |
| leaq L_.str1(%rip), %rdi | |
| movl -16(%rbp), %esi | |
| movb $0, %al | |
| callq _printf | |
| movl %eax, -152(%rbp) ## 4-byte Spill | |
| LBB0_6: ## in Loop: Header=BB0_1 Depth=1 | |
| jmp LBB0_7 | |
| LBB0_7: ## in Loop: Header=BB0_1 Depth=1 | |
| movl -16(%rbp), %eax | |
| addl $1, %eax | |
| movl %eax, -16(%rbp) | |
| jmp LBB0_1 | |
| LBB0_8: | |
| movq ___stack_chk_guard@GOTPCREL(%rip), %rax | |
| movq (%rax), %rax | |
| cmpq -8(%rbp), %rax | |
| jne LBB0_10 | |
| ## BB#9: ## %SP_return | |
| movl $0, %eax | |
| addq $160, %rsp | |
| popq %rbp | |
| ret | |
| LBB0_10: ## %CallStackCheckFailBlk | |
| callq ___stack_chk_fail | |
| .cfi_endproc | |
| .section __TEXT,__const | |
| .align 4 ## @main.water_data | |
| L_main.water_data: | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 1017370378 ## float 2.000000e-02 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 1025758986 ## float 4.000000e-02 | |
| .long 1065604874 ## float 1.030000e+00 | |
| .long 1043207291 ## float 1.700000e-01 | |
| .long 1062165545 ## float 8.100000e-01 | |
| .long 1055286886 ## float 4.500000e-01 | |
| .long 1060152279 ## float 6.900000e-01 | |
| .long 1059145646 ## float 6.300000e-01 | |
| .long 1017370378 ## float 2.000000e-02 | |
| .long 1031127695 ## float 6.000000e-02 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 1034147594 ## float 8.000000e-02 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .long 0 ## float 0.000000e+00 | |
| .section __TEXT,__cstring,cstring_literals | |
| L_.str: ## @.str | |
| .asciz "Day %d: Sprinkler on\n" | |
| L_.str1: ## @.str1 | |
| .asciz "Day %d: Sprinkler off\n" | |
| .subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment