Created
July 6, 2015 04:47
-
-
Save badcc/cd2dc809bdc88f1ccb76 to your computer and use it in GitHub Desktop.
Multiply Passed Arguments Together (x86, GAS)
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
.intel_syntax noprefix | |
.global main | |
.format: | |
.asciz "%d\n" | |
main: | |
xor rbx, rbx | |
inc rbx | |
add rsi, 8 | |
dec rdi | |
print: | |
push rdi | |
push rsi | |
mov rdi, [rsi] | |
call atoi | |
mov rcx, rax | |
pop rsi | |
pop rdi | |
imul rbx, rcx | |
push rdi | |
push rsi | |
sub rsp, 8 | |
mov rdi, OFFSET FLAT: .format | |
mov rsi, rbx | |
call printf | |
add rsp, 8 | |
pop rsi | |
pop rdi | |
add rsi, 8 | |
dec rdi | |
jnz print | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment