Skip to content

Instantly share code, notes, and snippets.

@sbp
Created October 18, 2013 23:19
Show Gist options
  • Save sbp/7049660 to your computer and use it in GitHub Desktop.
Save sbp/7049660 to your computer and use it in GitHub Desktop.
GCC compiled output of fibonacci.c
.file "fibonacci.c"
.text
.globl fib
.type fib, @function
fib:
pushl %ebx
subl $24, %esp
cmpl $1, 32(%esp)
jg .L2
movl 32(%esp), %eax
jmp .L3
.L2:
movl 32(%esp), %eax
subl $1, %eax
movl %eax, (%esp)
call fib
movl %eax, %ebx
movl 32(%esp), %eax
subl $2, %eax
movl %eax, (%esp)
call fib
leal (%ebx,%eax), %eax
.L3:
addl $24, %esp
popl %ebx
ret
.size fib, .-fib
.ident "GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4.3"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment