int add(int i, int j) {
if (i == 0)
return j;
return add(--i, ++j);

Need to convert this piece of code to something like this
add $s0, $s1, $s2 # $s0 = g + h
add $s1, $s3, $s4 # $s1 = i + j
sub $s0, $s0, $s1 # f = (g + h) - (i + j)
someone can help me with this?

Whenever this comes up I remember how this is done at the office. We have a Microchip MIPS system so we use the C compiler and tell the compiler to save the assembler output for examination.

Seems simple enough. And free.

Thanks, I'll head out and get it.

@Jose_17: You might want to consider whether your professor really wants you to do that or not, in something that is clearly meant as a lesson on how to write assembly code. You might also want to consider whether they are going to be watching fora like this one to see if someone posts their assignment in order to get someone to do it (ProTip: they are).

I recommend reading the forum Posting Rules, Terms of Service and Asking Questions Advice before proceeding here. Specifically those pertaining to asking for help on homework. This one in particular seems relevant:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

commented: OP didn't write this was school work. Why not learn how this is done IRL? +15