Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

1 movl 8ebp eax Ge... 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_2

Step: 3

blur-text-image_3

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

A First Course In Probability

Authors: Sheldon Ross

9th Edition

978-9332519077, 9332519072

More Books

Students also viewed these Databases questions

Question

How is a standardized residual different from a residual?

Answered: 1 week ago

Question

-x/2 x/4 If A = -x/2 and A-1 =6 then x equals

Answered: 1 week ago