Skip to content

Instantly share code, notes, and snippets.

@moustachio-belvedere
Created August 18, 2019 18:33
Show Gist options
  • Save moustachio-belvedere/d7d1b1dafc813031de9407d1cc501547 to your computer and use it in GitHub Desktop.
Save moustachio-belvedere/d7d1b1dafc813031de9407d1cc501547 to your computer and use it in GitHub Desktop.
Stack overflow requested assembly code (GNU11 standard)
.file "begin.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC2:
.ascii "\12M.E. for float: %e \12\12\0"
LC3:
.ascii "M.E. for double: %e \12\12\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
LFB10:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
andl $-16, %esp
subl $32, %esp
call ___main
flds LC0
fstps 28(%esp)
fldl LC1
fstpl 16(%esp)
flds 28(%esp)
fstpl 4(%esp)
movl $LC2, (%esp)
call _printf
fldl 16(%esp)
fstpl 4(%esp)
movl $LC3, (%esp)
call _printf
movl $0, %eax
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
LFE10:
.section .rdata,"dr"
.align 4
LC0:
.long -1275068416
.align 8
LC1:
.long 0
.long 1018167296
.ident "GCC: (GNU) 5.3.0"
.def _printf; .scl 2; .type 32; .endef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment