Code test and debug on MIPSym a MIPS assembly language program to calculate recu
ID: 3715687 • Letter: C
Question
Code test and debug on MIPSym a MIPS assembly language program to calculate recursively the functionComb(n,m) = (if m == 0 || n == m ) ? 1 : Comb(n-1,m)+Comb(n-1,m-1);
Comb is 0 if m>n or n<0 or m<0
Your code should include a main routine that asks the user for input values of m and n and displays the result of the function call. The main routine should loop until the value that the function returns is zero. Code test and debug on MIPSym a MIPS assembly language program to calculate recursively the function
Comb(n,m) = (if m == 0 || n == m ) ? 1 : Comb(n-1,m)+Comb(n-1,m-1);
Comb is 0 if m>n or n<0 or m<0
Your code should include a main routine that asks the user for input values of m and n and displays the result of the function call. The main routine should loop until the value that the function returns is zero.
Explanation / Answer
Following is the MIPS code. You can generate it by first writing the C code and then compiling as "gcc -S test.c"
.file "test.c"
.text
.globl comb
.type comb, @function
comb:
pushl