Question: Question: Given the following C program, please translate it to the corresponding MIPS assembly language code. #include int sum(int a, int b); int prod(int a,
Question: Given the following C program, please translate it to the corresponding MIPS assembly language code.
#include
int sum(int a, int b); int prod(int a, int b);
int main( ) { int x, y, z, t; printf("Enter values of two ints: "); scanf("%d%d", &x, &y); z = sum(x, y); printf("Sum = %d ", z); t = prod(x, y); printf("Prod = %d ", t); printf("Total = %d ", z + t); return 0; }
int sum(int a, int b) { int s; s = a + b;
return s; }
int prod(int a, int b) { int p; p = a * b;
return p; }
Please comment your code, do make variable assignment at the beginning of your .s file, do follow the procedure call conventions we introduced in the lectures. Note that here we only have to deal with leaf procedures.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
