Question: Please help me with the following assignment!! 1 . Convert the folllowing function into 3 AC int g; int a ( int b , int

Please help me with the following assignment!!
1. Convert the folllowing function into 3AC
int g;
int a(int b, int c){
if (b){
return 0;
} else {
b = b-1*c;
}
return b;
}
2. Convert the following function into 3AC.
int v(int a){
while (a<2){
while (a<3){
a++;
}
a++;
}
return a;
}
3. Convert the following procedure into A. Assume variables are local unless otherwise specified.
enter k
getarg 1,[b]
[i]=[b]
lbl_1: [t]=[i] LT6410
ifz [v] goto lbl_2
[i]=[i] ADD641
WRITE [i]
goto lbl_1
lbl_2: nop
leave k
4. Assume a language that allows for pass-by-reference or pass-by-value parameters. What would the 3AC code look like for a pass-by-reference call? Illustrate with an example.

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 Programming Questions!