Question: Consider the following C code implementing function, f. This function is called with arguments 8 and 6 (in C code: f(8,6)). Upon entry to the

Consider the following C code implementing function, f. This function is called with arguments 8 and 6 (in C code: f(8,6)). Upon entry to the function before the first instruction of the prologue is executed, assume that the value of R7 is 0x3023, R5 is 0xFF31, and R6 is 0xFF29 (e.g. the first argument to f is stored at this location).

Using these initial assumptions, show the stack just after the RET instruction is executed for f. Also, draw an arrow indicating the position of R5 and R6 when the RET instruction is executed.

If you dont know the value held in a memory location, leave it empty. You do not need to show the LC-3 code for this function. All you must do is interpret its updates to the runtime stack.

int f(int x, int y)

{

int i = 0;

int k = 3;

if (x < y)

return x+k;

else

return y-k;

}

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!