Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Complete the memory map showing each stack as it evolves. It should include:

ID: 3667429 • Letter: 1

Question

1. Complete the memory map showing each stack as it evolves. It should include: a. The contents of all known stack slots and registers b. Labels on the left side of the stack for all variable locations. c. The locations of each stack pointer on the right side and any offsets from each stack pointer that the program uses. 2. Determine the final value of y when the calls return to main0. What will be printed? // hwk2.c -homework #2 ". int bar (int z) return (z * 17): int foo (int al, int a2, int a3, int a4, int a5, int a6, int a7) // force x to be stored in memory on the stack volatile int x; x=(a1 * a2 + a3 * a4)-(a5 * a6 + a7); return bar (x) int main) int y: y=foo(7, 6, 5, 4, printf ("y= %d ", 3, 2, y) ; 1);

Explanation / Answer

Solution: Note that you have 2 questions, then i solve the second question.

2) Solution: Determine the final value of y:

If you evaluate the main () function you have:

Yfinal = Foo(7,6,5,4,3,2,1)   

Foo(7,6,5,4,3,2,1) = (7*6) + (5*4) - (3*2) +1 =55

return 55 in function Foo(), then the main function print the result of y.

Y =

55