Question: For the following C main program and function, write two mips assembly equivalent programs. Use registers to pass arguments and results. int Distance (int a,
For the following C main program and function, write two mips assembly equivalent programs. Use registers to pass arguments and results.
int Distance (int a, int b)
{
int temp;
if (b > a) {
temp = a;
a = b;
b = temp;
}
return (a-b)
void main(void)
{
int var1 = 50;
int var2= 200;
result = distance (var1, var2);
return;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
