0
int add(int i, int j) {
if (i == 0)
return j;
else
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?

3
Contributors
3
Replies
22
Views
6 Months
Discussion Span
Last Post by Schol-R-LEA
1

@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

Edited by Schol-R-LEA

Votes + Comments
OP didn't write this was school work. Why not learn how this is done IRL?
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.