Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following blocks of code .file hw3.c .text .globl main .type main, @function main: pushq %rbp movq %rsp, %rbp movl $5, -12(%rbp) movl $30,

Consider the following blocks of code

.file "hw3.c"

.text

.globl main

.type main, @function

main:

pushq %rbp

movq %rsp, %rbp

movl $5, -12(%rbp)

movl $30, -4(%rbp)

movl $15, -8(%rbp)

.L3:

cmpl $1, -8(%rbp)

je .L2

movl -4(%rbp), %eax

imull -12(%rbp), %eax

movl %eax, -4(%rbp)

subl $1, -8(%rbp)

jmp .L3

.L2:

movl -8(%rbp), %eax

imull -12(%rbp), %eax

movl %eax, -8(%rbp)

movl $0, %eax

popq %rbp

ret .

Consider the compiler places the C variables: b at -4(%rbp), c at -8(%rbp), and a at -12(%rbp).

a) Fill out the C code based on the Assembly code given. (15p)

b) What is the size (in bytes) of variable c ? Why? ( 5p )

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

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions