Last active
August 18, 2019 18:31
-
-
Save moustachio-belvedere/b239452a26b21b3da5dbf64500d7e59f to your computer and use it in GitHub Desktop.
Stack Overflow requested assembly code (C11 standard)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "begin.c" | |
.text | |
.def _printf; .scl 3; .type 32; .endef | |
_printf: | |
LFB1: | |
.cfi_startproc | |
pushl %ebp | |
.cfi_def_cfa_offset 8 | |
.cfi_offset 5, -8 | |
movl %esp, %ebp | |
.cfi_def_cfa_register 5 | |
pushl %ebx | |
subl $36, %esp | |
.cfi_offset 3, -12 | |
leal 12(%ebp), %eax | |
movl %eax, -12(%ebp) | |
movl -12(%ebp), %eax | |
movl %eax, 4(%esp) | |
movl 8(%ebp), %eax | |
movl %eax, (%esp) | |
call ___mingw_vprintf | |
movl %eax, %ebx | |
movl %ebx, %eax | |
addl $36, %esp | |
popl %ebx | |
.cfi_restore 3 | |
popl %ebp | |
.cfi_restore 5 | |
.cfi_def_cfa 4, 4 | |
ret | |
.cfi_endproc | |
LFE1: | |
.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: | |
LFB12: | |
.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 | |
LFE12: | |
.section .rdata,"dr" | |
.align 4 | |
LC0: | |
.long -1610612736 | |
.align 8 | |
LC1: | |
.long 0 | |
.long -1140850688 | |
.ident "GCC: (GNU) 5.3.0" | |
.def ___mingw_vprintf; .scl 2; .type 32; .endef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment