I wanted to convert this C code into MIPS.
C Code:
f = A[B[h-g]]
We assume that h > g & B[h-g] > 0. h,g,f are integers.
Also assume that f is assigned to register $s0, g to $s1, h to $s2.
Base addresses of A -> $s6 and B -> $s7
Here is my attempt:
sub $t0, $s2, $s1
mult $t0, $t0, 4
lw $t0, $t0($s7)
mult $t0, $t0, 4
sw $s0, $t0($s6)