addi $sp, $zero, 6000 # Assume Stack memory starts at 6000. Do not modify.
# Procedure Main (Do not modify)
Main:
add $a0, $zero, $s0
add $a1, $zero, $s1
jal Sum
add $s2, $s0, $s1
add $s2, $s2, $v0
j End
# Procedure Sum
Sum:
# Type your code here.
# Procedure Dif (Do not modify)
Dif:
sub $v0, $a1, $a0
jr $ra
End:
Extracted text: Given the following C program and the mapping of registers to variables, complete the MIPS implementation of procedure Sum. int Dif(int a, int b) { return b a; } int Sum(int m, int n) { int p Dif(n+1, m-1); int q Dif(m+1, n-1); return p + q; } int main() { int X, У; Z %3D х + у+ Sum (х, у); return 0; }