Question: Suppose we want to generate assembly code for the following C function: int shift_left2_rightn(int x, int n){ x < >= n; return x; } The

Suppose we want to generate assembly code for the following C function:

int shift_left2_rightn(int x, int n){

x<<= 2;

x>>= n;

return x;

}

The code that follows is a portion of the assembly code that performs the actual shifts and leaves the final value in register %eax. Two key instructions have been omitted. Parameters x and n are stored at memory location with offsets 8 and 12, respectively, relative to the adress in register %eb

1. movl 8(%ebp), %eax Get x

2. _____ x <<=2

3. movl 12(%ebp), %ecx Get n

4. _____ x>>=n

Fill in the missing instructions, following the annotations on the right. The right shift should be performed arithmetically.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 movl 8ebp eax Ge... View full answer

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!