Question: C programming language Program foo() {a, b integer; procedure bar(integer x, integer y) {z: integer;/* 0 */z = 3;/* 1 */x = x + y

C programming language

C programming language Program foo() {a, b integer; procedure bar(integer x, integer

Program foo() {a, b integer; procedure bar(integer x, integer y) {z: integer;/* 0 */z = 3;/* 1 */x = x + y + z;/* 2 */y = 1;/* 3 */}//statement body of foo a = 2; b = 5; call bar(a, b); print a, b;} Use the RISC machine instructions load, loadI, loadI, storeAI, add to show the code that needs to be generated for the body of procedure bar (statement (/*1*/through/*3*/). Assume that Formal parameter x is call-by-reference, and formal parameter y is call-by-value. Assume that, bar's parameters x and y have been correctly initialized as part of the procedure call of bar. Use the stack frame layout as shown above. The figure shows the runtime stack when the program execution readies program point/*0*/in procedure bar. What values for a and b does the program print

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!