Skip to content

Instantly share code, notes, and snippets.

@reidrac
Created December 14, 2016 09:45
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 reidrac/afb89b29228a243954bd51281c39ee88 to your computer and use it in GitHub Desktop.
Save reidrac/afb89b29228a243954bd51281c39ee88 to your computer and use it in GitHub Desktop.
; output of gcc -O2 -s -S main.c
.file "main.c"
.text
.p2align 4,,15
.globl abs
.type abs, @function
abs:
.LFB0:
.cfi_startproc
movl %edi, %edx
movl %edi, %eax
sarl $31, %edx
xorl %edx, %eax
subl %edx, %eax
ret
.cfi_endproc
.LFE0:
.size abs, .-abs
.p2align 4,,15
.globl abs2
.type abs2, @function
abs2:
.LFB1:
.cfi_startproc
movl %edi, %edx
movl %edi, %eax
sarl $31, %edx
xorl %edx, %eax
subl %edx, %eax
ret
.cfi_endproc
.LFE1:
.size abs2, .-abs2
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB2:
.cfi_startproc
rep ret
.cfi_endproc
.LFE2:
.size main, .-main
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment