Question: Compare and analyze the structure of the two assembly codes generated by gcc??? please can someone explain it, thanks .file lab5_prob3_1.c .section .rodata .LC0: .string

Compare and analyze the structure of the two assembly codes generated by gcc??? please can someone explain it, thanks

.file "lab5_prob3_1.c"

.section .rodata

.LC0:

.string "Hello, world"

.text

.globl main

.type main, @function

main:

.LFB0:

.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)

movq %rsi, -16(%rbp)

movl $.LC0, %edi

call puts

movl $0, %eax

leave

.cfi_def_cfa 7, 8

ret

.cfi_endproc

.LFE0:

.size main, .-main

.ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-16)"

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

-----------------------------------------------------------------------

.file "lab5_prob3_2.c"

.section .rodata

.LC0:

.string "The value of i is %d "

.text

.globl main

.type main, @function

main:

.LFB0:

.cfi_startproc

pushq %rbp

.cfi_def_cfa_offset 16

.cfi_offset 6, -16

movq %rsp, %rbp

.cfi_def_cfa_register 6

subq $32, %rsp

movl %edi, -20(%rbp)

movq %rsi, -32(%rbp)

movl $1, -4(%rbp)

addl $1, -4(%rbp)

movl -4(%rbp), %eax

movl %eax, %esi

movl $.LC0, %edi

movl $0, %eax

call printf

movl $0, %eax

leave

.cfi_def_cfa 7, 8

ret

.cfi_endproc

.LFE0:

.size main, .-main

.ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-16)"

.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!