Question: Can someone help me extract the actual code from this assembly language and explain each line of the actual code? .file assignment2_1.cpp .text .section .rodata

Can someone help me extract the actual code from this assembly language and explain each line of the actual code?

.file "assignment2_1.cpp"

.text

.section .rodata

.type _ZStL19piecewise_construct, @object

.size _ZStL19piecewise_construct, 1

_ZStL19piecewise_construct:

.zero 1

.local _ZStL8__ioinit

.comm _ZStL8__ioinit,1,1

.LC0:

.string "Enter a number: "

.LC1:

.string "The factorial for "

.LC2:

.string "is: "

.text

.globl main

.type main, @function

main:

.LFB1493:

.cfi_startproc

pushq %rbp

.cfi_def_cfa_offset 16

.cfi_offset 6, -16

movq %rsp, %rbp

.cfi_def_cfa_register 6

subq $32, %rsp

movq %fs:40, %rax

movq %rax, -8(%rbp)

xorl %eax, %eax

movl $1, -12(%rbp)

leaq .LC0(%rip), %rsi

leaq _ZSt4cout(%rip), %rdi

call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT

movq %rax, %rdx

movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rax

movq %rax, %rsi

movq %rdx, %rdi

call _ZNSolsEPFRSoS_E@PLT

leaq -20(%rbp), %rax

movq %rax, %rsi

leaq _ZSt3cin(%rip), %rdi

call _ZNSirsERi@PLT

movl -20(%rbp), %eax

movl %eax, -16(%rbp)

.L3:

cmpl $0, -16(%rbp)

jle .L2

movl -12(%rbp), %eax

imull -16(%rbp), %eax

movl %eax, -12(%rbp)

subl $1, -16(%rbp)

jmp .L3

.L2:

leaq .LC1(%rip), %rsi

leaq _ZSt4cout(%rip), %rdi

call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT

movq %rax, %rdx

movl -20(%rbp), %eax

movl %eax, %esi

movq %rdx, %rdi

call _ZNSolsEi@PLT

leaq .LC2(%rip), %rsi

movq %rax, %rdi

call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT

movq %rax, %rdx

movl -12(%rbp), %eax

movl %eax, %esi

movq %rdx, %rdi

call _ZNSolsEi@PLT

movl $1, %eax

movq -8(%rbp), %rcx

xorq %fs:40, %rcx

je .L5

call __stack_chk_fail@PLT

.L5:

leave

.cfi_def_cfa 7, 8

ret

.cfi_endproc

.LFE1493:

.size main, .-main

.type _Z41__static_initialization_and_destruction_0ii, @function

_Z41__static_initialization_and_destruction_0ii:

.LFB1982:

.cfi_startproc

pushq %rbp

.cfi_def_cfa_offset 16

.cfi_offset 6, -16

movq %rsp, %rbp

.cfi_def_cfa_register 6

subq $16, %rsp

movl %edi, -4(%rbp)

movl %esi, -8(%rbp)

cmpl $1, -4(%rbp)

jne .L8

cmpl $65535, -8(%rbp)

jne .L8

leaq _ZStL8__ioinit(%rip), %rdi

call _ZNSt8ios_base4InitC1Ev@PLT

leaq __dso_handle(%rip), %rdx

leaq _ZStL8__ioinit(%rip), %rsi

movq _ZNSt8ios_base4InitD1Ev@GOTPCREL(%rip), %rax

movq %rax, %rdi

call __cxa_atexit@PLT

.L8:

nop

leave

.cfi_def_cfa 7, 8

ret

.cfi_endproc

.LFE1982:

.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii

.type _GLOBAL__sub_I_main, @function

_GLOBAL__sub_I_main:

.LFB1983:

.cfi_startproc

pushq %rbp

.cfi_def_cfa_offset 16

.cfi_offset 6, -16

movq %rsp, %rbp

.cfi_def_cfa_register 6

movl $65535, %esi

movl $1, %edi

call _Z41__static_initialization_and_destruction_0ii

popq %rbp

.cfi_def_cfa 7, 8

ret

.cfi_endproc

.LFE1983:

.size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main

.section .init_array,"aw"

.align 8

.quad _GLOBAL__sub_I_main

.hidden __dso_handle

.ident "GCC: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0"

.section .note.GNU-stack,"",@progbits

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!