Skip to content

Instantly share code, notes, and snippets.

@caphosra
Created April 17, 2020 05:00
Show Gist options
  • Save caphosra/d00065b47664eb76c826157ede3cf29c to your computer and use it in GitHub Desktop.
Save caphosra/d00065b47664eb76c826157ede3cf29c to your computer and use it in GitHub Desktop.
Compile cpp file by Clang++
#include <stdio.h>
int main()
{
double d1 = 3;
double d2 = 5;
scanf("%d %d", &d1, &d2);
printf("%d + %d = %d", d1, d2, (d1 + d2));
return 0;
}
.text
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
.set @feat.00, 0
.file "helloworld.cpp"
.def main;
.scl 2;
.type 32;
.endef
.globl __real@4014000000000000 # -- Begin function main
.section .rdata,"dr",discard,__real@4014000000000000
.p2align 3
__real@4014000000000000:
.quad 4617315517961601024 # double 5
.globl __real@4008000000000000
.section .rdata,"dr",discard,__real@4008000000000000
.p2align 3
__real@4008000000000000:
.quad 4613937818241073152 # double 3
.text
.globl main
.p2align 4, 0x90
main: # @main
.seh_proc main
# %bb.0:
subq $56, %rsp
.seh_stackalloc 56
.seh_endprologue
movsd __real@4014000000000000(%rip), %xmm0 # xmm0 = mem[0],zero
movsd __real@4008000000000000(%rip), %xmm1 # xmm1 = mem[0],zero
movl $0, 52(%rsp)
movsd %xmm1, 40(%rsp)
movsd %xmm0, 32(%rsp)
leaq "??_C@_05OKMLJOMC@?$CFd?5?$CFd?$AA@"(%rip), %rcx
leaq 40(%rsp), %rdx
leaq 32(%rsp), %r8
callq scanf
movsd 40(%rsp), %xmm3 # xmm3 = mem[0],zero
addsd 32(%rsp), %xmm3
movsd 32(%rsp), %xmm2 # xmm2 = mem[0],zero
movsd 40(%rsp), %xmm1 # xmm1 = mem[0],zero
leaq "??_C@_0N@MJAJBLOM@?$CFd?5?$CL?5?$CFd?5?$DN?5?$CFd?$AA@"(%rip), %rcx
movq %xmm1, %rdx
movq %xmm2, %r8
movq %xmm3, %r9
callq printf
xorl %eax, %eax
addq $56, %rsp
retq
.seh_handlerdata
.text
.seh_endproc
# -- End function
.def scanf;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,scanf
.globl scanf # -- Begin function scanf
.p2align 4, 0x90
scanf: # @scanf
.seh_proc scanf
# %bb.0:
pushq %rsi
.seh_pushreg 6
pushq %rdi
.seh_pushreg 7
subq $56, %rsp
.seh_stackalloc 56
.seh_endprologue
movq %r9, 104(%rsp)
movq %r8, 96(%rsp)
movq %rdx, 88(%rsp)
movq %rcx, 48(%rsp)
leaq 88(%rsp), %rax
movq %rax, 40(%rsp)
movq 40(%rsp), %rsi
movq 48(%rsp), %rdi
xorl %ecx, %ecx
callq __acrt_iob_func
movq %rax, %rcx
movq %rdi, %rdx
xorl %r8d, %r8d
movq %rsi, %r9
callq _vfscanf_l
movl %eax, 36(%rsp)
movl 36(%rsp), %eax
addq $56, %rsp
popq %rdi
popq %rsi
retq
.seh_handlerdata
.section .text,"xr",discard,scanf
.seh_endproc
# -- End function
.def printf;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,printf
.globl printf # -- Begin function printf
.p2align 4, 0x90
printf: # @printf
.seh_proc printf
# %bb.0:
pushq %rsi
.seh_pushreg 6
pushq %rdi
.seh_pushreg 7
subq $56, %rsp
.seh_stackalloc 56
.seh_endprologue
movq %r9, 104(%rsp)
movq %r8, 96(%rsp)
movq %rdx, 88(%rsp)
movq %rcx, 48(%rsp)
leaq 88(%rsp), %rax
movq %rax, 40(%rsp)
movq 40(%rsp), %rsi
movq 48(%rsp), %rdi
movl $1, %ecx
callq __acrt_iob_func
movq %rax, %rcx
movq %rdi, %rdx
xorl %r8d, %r8d
movq %rsi, %r9
callq _vfprintf_l
movl %eax, 36(%rsp)
movl 36(%rsp), %eax
addq $56, %rsp
popq %rdi
popq %rsi
retq
.seh_handlerdata
.section .text,"xr",discard,printf
.seh_endproc
# -- End function
.def _vfscanf_l;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,_vfscanf_l
.globl _vfscanf_l # -- Begin function _vfscanf_l
.p2align 4, 0x90
_vfscanf_l: # @_vfscanf_l
.seh_proc _vfscanf_l
# %bb.0:
pushq %r14
.seh_pushreg 14
pushq %rsi
.seh_pushreg 6
pushq %rdi
.seh_pushreg 7
pushq %rbx
.seh_pushreg 3
subq $72, %rsp
.seh_stackalloc 72
.seh_endprologue
movq %r9, 64(%rsp)
movq %r8, 56(%rsp)
movq %rdx, 48(%rsp)
movq %rcx, 40(%rsp)
movq 64(%rsp), %r14
movq 56(%rsp), %rsi
movq 48(%rsp), %rdi
movq 40(%rsp), %rbx
callq __local_stdio_scanf_options
movq (%rax), %rcx
movq %rbx, %rdx
movq %rdi, %r8
movq %rsi, %r9
movq %r14, 32(%rsp)
callq __stdio_common_vfscanf
nop
addq $72, %rsp
popq %rbx
popq %rdi
popq %rsi
popq %r14
retq
.seh_handlerdata
.section .text,"xr",discard,_vfscanf_l
.seh_endproc
# -- End function
.def __local_stdio_scanf_options;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,__local_stdio_scanf_options
.globl __local_stdio_scanf_options # -- Begin function __local_stdio_scanf_options
.p2align 4, 0x90
__local_stdio_scanf_options: # @__local_stdio_scanf_options
# %bb.0:
leaq "?_OptionsStorage@?1??__local_stdio_scanf_options@@9@4_KA"(%rip), %rax
retq
# -- End function
.def _vfprintf_l;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,_vfprintf_l
.globl _vfprintf_l # -- Begin function _vfprintf_l
.p2align 4, 0x90
_vfprintf_l: # @_vfprintf_l
.seh_proc _vfprintf_l
# %bb.0:
pushq %r14
.seh_pushreg 14
pushq %rsi
.seh_pushreg 6
pushq %rdi
.seh_pushreg 7
pushq %rbx
.seh_pushreg 3
subq $72, %rsp
.seh_stackalloc 72
.seh_endprologue
movq %r9, 64(%rsp)
movq %r8, 56(%rsp)
movq %rdx, 48(%rsp)
movq %rcx, 40(%rsp)
movq 64(%rsp), %r14
movq 56(%rsp), %rsi
movq 48(%rsp), %rdi
movq 40(%rsp), %rbx
callq __local_stdio_printf_options
movq (%rax), %rcx
movq %rbx, %rdx
movq %rdi, %r8
movq %rsi, %r9
movq %r14, 32(%rsp)
callq __stdio_common_vfprintf
nop
addq $72, %rsp
popq %rbx
popq %rdi
popq %rsi
popq %r14
retq
.seh_handlerdata
.section .text,"xr",discard,_vfprintf_l
.seh_endproc
# -- End function
.def __local_stdio_printf_options;
.scl 2;
.type 32;
.endef
.section .text,"xr",discard,__local_stdio_printf_options
.globl __local_stdio_printf_options # -- Begin function __local_stdio_printf_options
.p2align 4, 0x90
__local_stdio_printf_options: # @__local_stdio_printf_options
# %bb.0:
leaq "?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA"(%rip), %rax
retq
# -- End function
.section .rdata,"dr",discard,"??_C@_05OKMLJOMC@?$CFd?5?$CFd?$AA@"
.globl "??_C@_05OKMLJOMC@?$CFd?5?$CFd?$AA@" # @"??_C@_05OKMLJOMC@?$CFd?5?$CFd?$AA@"
"??_C@_05OKMLJOMC@?$CFd?5?$CFd?$AA@":
.asciz "%d %d"
.section .rdata,"dr",discard,"??_C@_0N@MJAJBLOM@?$CFd?5?$CL?5?$CFd?5?$DN?5?$CFd?$AA@"
.globl "??_C@_0N@MJAJBLOM@?$CFd?5?$CL?5?$CFd?5?$DN?5?$CFd?$AA@" # @"??_C@_0N@MJAJBLOM@?$CFd?5?$CL?5?$CFd?5?$DN?5?$CFd?$AA@"
"??_C@_0N@MJAJBLOM@?$CFd?5?$CL?5?$CFd?5?$DN?5?$CFd?$AA@":
.asciz "%d + %d = %d"
.section .bss,"bw",discard,"?_OptionsStorage@?1??__local_stdio_scanf_options@@9@4_KA"
.globl "?_OptionsStorage@?1??__local_stdio_scanf_options@@9@4_KA" # @"?_OptionsStorage@?1??__local_stdio_scanf_options@@9@4_KA"
.p2align 3
"?_OptionsStorage@?1??__local_stdio_scanf_options@@9@4_KA":
.quad 0 # 0x0
.section .bss,"bw",discard,"?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA"
.globl "?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA" # @"?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA"
.p2align 3
"?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA":
.quad 0 # 0x0
.section .drectve,"yn"
.ascii " /FAILIFMISMATCH:\"_CRT_STDIO_ISO_WIDE_SPECIFIERS=0\""
.globl _fltused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment