Last active
June 13, 2017 22:17
-
-
Save cedriczirtacic/77c1ff6267d66abc781042d1d3761dda to your computer and use it in GitHub Desktop.
yes command in GAS
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
// gcc -c yes.S -o yes.o && gcc yes.o -o yes | |
.file "yes.S" | |
.data | |
y: .string "y" | |
.text | |
.globl main | |
main: | |
cmpq $2, %rdi | |
jl .L1 | |
addq $8, %rsi | |
movq (%rsi), %rbx | |
jmp .L2 | |
.L1: | |
movl $y, %edi // print $y | |
call puts | |
jmp .L1 | |
.L2: | |
movq %rbx, %rdi | |
call puts | |
jmp .L2 | |
out: | |
//going out | |
xorq %rax, %rax | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment