Skip to content

Instantly share code, notes, and snippets.

@dmcyk
Created January 17, 2022 11:59
Show Gist options
  • Save dmcyk/ed1c6fcced78844c8e2e4a0fb3d18391 to your computer and use it in GitHub Desktop.
Save dmcyk/ed1c6fcced78844c8e2e4a0fb3d18391 to your computer and use it in GitHub Desktop.
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 12, 0
.globl _main ## -- Begin function main
.p2align 4, 0x90
_main: ## @main
## %bb.0:
pushq %rbp
movq %rsp, %rbp
## argc -> r8d
movl %edi, %r8d
## write
leaq _new_line(%rip), %rsi
addb %r8b, (%rsi)
movl $2, %edx
movl $1, %edi
movl $33554436, %eax ## imm = 0x2000004
syscall
## write
leaq _new_line_two(%rip), %rsi
addb %r8b, (%rsi)
movl $2, %edx
movl $1, %edi
movl $33554436, %eax ## imm = 0x2000004
syscall
# exit
xorl %edi, %edi
movl $33554433, %eax ## imm = 0x2000001
syscall
xorl %eax, %eax
popq %rbp
retq
.section __DATA,__data
.globl _new_line ## @new_line
_new_line:
.asciz "0\n"
.globl _new_line_two ## @new_line_two
_new_line_two:
.asciz "0\n"
.subsections_via_symbols
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment