Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A function with prototype int decode2(int x, int y, int z); is compiled into IA32 assembly code. The body of the code is as follows:

A function with prototype

int decode2(int x, int y, int z);

is compiled into IA32 assembly code. The body of the code is as follows:

x at %ebp+8, y at %ebp+12, z at %ebp+16

1 movl 12(%ebp), %edx

2 subl 16(%ebp), %edx

3 movl %edx, %eax

4 sall $31, %eax

5 sarl $31, %eax

6 imull 8(%ebp), %edx

7 xorl %edx, %eax

Parameters x, y, and z are stored at memory locations with offsets 8, 12, and 16 relative to the address in register %ebp. The code stores the return value in register %eax. Write C code for decode2 that will have an effect equivalent to our assembly code.

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago

Question

What is loss of bone density and strength as ?

Answered: 1 week ago