Created
January 17, 2022 11:58
-
-
Save dmcyk/11c29b2d5e5d3e04e5b954e43e12d384 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
.text | |
.globl main | |
.p2align 4, 0x90 | |
.type main,@function | |
main: | |
pushq %rbp | |
movq %rsp, %rbp | |
## argc -> r8d | |
movl %edi, %r8d | |
## write | |
leaq _new_line(%rip), %rsi | |
addb %r8b, (%rsi) | |
movl $1, %edi # descriptor | |
movl $2, %edx # str length | |
movl $4, %eax # write sysnr | |
syscall | |
## write | |
leaq _new_line_two(%rip), %rsi | |
addb %r8b, (%rsi) | |
movl $1, %edi # descriptor | |
movl $2, %edx # str length | |
movl $4, %eax # write sysnr | |
syscall | |
# exit | |
xorl %edi, %edi | |
movl $1, %eax | |
syscall | |
xorl %eax, %eax | |
popq %rbp | |
retq | |
.type new_line,@object | |
.data | |
.globl _new_line | |
_new_line: | |
.asciz "0\n" | |
.size _new_line, 2 | |
.type _new_line_two,@object | |
.data | |
.globl _new_line_two | |
_new_line_two: | |
.asciz "0\n" | |
.size _new_line_two, 2 | |
.ident "FreeBSD manual" | |
.section ".note.GNU-stack","",@progbits | |
.addrsig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment