> How do I translate this code from C to MIPS Assembly language? What would it look like in MIPS?

How do I translate this code from C to MIPS Assembly language? What would it look like in MIPS?

Posted at: 2014-12-18 
I wrote this code in C, how would I translate it into MIPS Assembly language? What would it look like in the MIPS language? I'm at a loss here.

#include

long factorial(int);

int main();

{

int n; //declares variables to be used in program

long f;

print f(“Enter a positive integer value of N: \n”); //gets input from the user

scanf(“%d”, &n); //reads the input from the user and assigns the value to n



if (n < 0) //checks to see if n is positive or negative

{

printf(“Negative integers are not allowed. Please rerun the program using a positive integer. \n”);

}

else

{

f = factorial(n); //calls recursive factorial function

printf(“The value of factorial of %d is %ld\n”, n, f); //outputs the result

}

}

long factorial(int n)

{

if (n == 0) //if the value is 0, the factorial is 1

{

return 1;

}

else //calculates the factorial for any non zero positive integer value for n

{

return(n * factorial(n – 1));

}

}