Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

e. What difficulties did they encounter?

Answered: 1 week ago