Created
January 23, 2014 00:04
-
-
Save nandor/8570164 to your computer and use it in GitHub Desktop.
This file contains 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
test: | |
push %rbp | |
mov %rsp, %rbp | |
push %rax # d | |
push %rbx # b | |
push %rcx # c | |
push %rdx # Changed by imul | |
push %rsi # $2 | |
push %rdi # a | |
pushf | |
mov 16(%rbp), %rbx | |
# d = 10, d stored in rax | |
mov $10, %rax | |
# c = 1 | |
mov $1, %rcx | |
# a = b + c, a stored in %rdi | |
mov %rbx, %rdi | |
add %rcx, %rdi | |
mov $10, %rax | |
mov $2, %rsi | |
1: | |
# d = d * 2 | |
imul %rsi | |
cmpq $100, %rax | |
jl 1b | |
# if (b == 10) | |
cmpq $10, %rbx | |
jne 2f | |
# a = 140 | |
mov $140, %rdi | |
2: | |
popf | |
pop %rdi | |
pop %rsi | |
pop %rdx | |
pop %rcx | |
pop %rbx | |
pop %rax | |
leave | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment