Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Translate the function myFunction into MIPS assembly language. You do not need t

ID: 3811028 • Letter: T

Question

Translate the function myFunction into MIPS assembly language. You do not need to write the code for the greaterThan() function! Be sure that you follow the MIPS register and call conventions.

int32_t greaterThan(int32_t a, int32_t b)

{

     return a > b;

}

Int32_t myFunction (int32_t a, int32_t b, int32_t c, int32_t d)

{

     if (greaterThan(a, b))

     {

           return a + c;

     }

     else if (greaterThan (d, b))

     {

           return d + c;

     }

     else

     {

           return a + d;

     }

}

Explanation / Answer

The code is correctly produced in c language firstly:

#include<stdio.h>
int greaterThan(int a, int b);
int myFunction (int a, int b, int c, int d);
int main()
{
greaterThan(1,2);
myFunction(1,2,3,4);
return 0;
}
int greaterThan(int a, int b)
{
return a > b;
}

int myFunction (int a, int b, int c, int d)
{
if (greaterThan(a, b))
{
return a + c;
}
else if (greaterThan (d, b))
{
return d + c;
}
else
{
return a + d;
}
}

The assembly code or the MIPS code for the following code is:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote