Question: 4. (30 points) Assume the following C code. int main() { test (1, 3); } int test (int a int b) int i = sum

4. (30 points) Assume the following C code. int main() { test (1, 3); } int test (int a int b) int i = sum (a+1, 6-1) return i + a + b; } int (int , int d) { returns } Complete assembly code for main(), test(), and sum() functions. Try to use a minimum number of instructions. Note, you will need to use stacks to complete the function calls. Please make sure that which registers' values need to be stored in the stack. Register allocations arguments (a, b, c, and d) return value stack pointer $a and sal $v0 $sp main: / - write your instructions here */ jal test / - assume your program is terminated here - / test: / - write your instructions here -/ jal SU / - write your instructions here */ jr sum: / - write your instructions here */ js
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
