Answer:
Code is given below:
Step-by-step explanation:
It does a0*a1+100
int func(int a0,int a1,int a2,int a3)//In mips $a0 to $a4 are arguments to function
{
const int zero = 0;// $zero is register whose value is always 0
int t0 = zero;//t0 is temporary register
while(a1!=0)//beq is like a1!= 0 go out of loop
{
t0 = t0 + a0;//add a0 to "to" a1 times which is like a0*a1
a1 = a1 - 1;
}
t0 = t0 + 100;//a0*a1+100
return t0; // return this value
}
int main()
{
int a0,a1;
printf("Enter a0 and a1\\");
scanf("%d %d",&a0,&a1);
printf("%d*%d+100=%d\\",func(a0,a1,0,0));
}