Question: Practice Problem 3 5 Suppose we want to generate assembly code for the following C function: int shift _ left 2 _ rightn ( int

Practice Problem 35
Suppose we want to generate assembly code for the following C function:
int shift_left2_rightn(int x, int n)
{
x2;
xn;
return x;
146 Chapter 3 Machine-Level Representation of Programs
The code that follows is a portion of the assembly code that performs the actual
shifts and leaves the final value in register reax. Two key instructions have
been omitted. Parameters x and n are stored at memory locations with offsets
8 and 12, respectively, relative to the address in register 8ebp.
movl 12(8ebp),8ecx Get n
movl 8(8ebp), qeax Get x
x2
x>n
Fill in the missing instructions, following the annotations on the right. The right
shift should be performed arithmetically.
 Practice Problem 35 Suppose we want to generate assembly code for

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!