Skip to content

Instantly share code, notes, and snippets.

@jozefg
Created November 23, 2016 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jozefg/5136d669778b0959d29ff0d3a4cd9ab5 to your computer and use it in GitHub Desktop.
Save jozefg/5136d669778b0959d29ff0d3a4cd9ab5 to your computer and use it in GitHub Desktop.
.global _c0_main
.text
_c0_main:
push %rbx
subq $0, %rsp
movl $5, %eax
imull %eax, %eax
push %rbp
movl %eax, %ebp
movl %eax, %edi
cmpl $0, %edi
jl __fresh1
imull $4, %edi
cmpl $0, %edi
jl __fresh1
addl $8, %edi
cmpl $0, %edi
jl __fresh1
movq $1, %rsi
call calloc
movl %ebp, 0(%rax)
movq %rax, %rbx
addq $8, %rbx
pop %rbp
jmp __fresh2
__fresh1:
movq %rsp, %rbp
movl $12, %edi
call raise
__fresh2:
movq %rbx, %rcx
cmpq $0, %rcx
je __fresh3
jmp __fresh4
__fresh3:
movq %rsp, %rbp
movl $12, %edi
call raise
__fresh4:
movl -8(%rcx), %eax
cmpl $0, %eax
jle __fresh5
jmp __fresh6
__fresh5:
movq %rsp, %rbp
movl $12, %edi
call raise
__fresh6:
movl $0, %eax
imull $4, %eax
addl $0, %eax
movl (%rax, %rcx, 1), %eax
movq %rax, %rax
addq $0, %rsp
pop %rbx
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment