The given C statement:

The registers, $s0, $s1, $s2, $s3, and $s4 are assigned with f, g, h, i, and j respectively.
The base address of the arrays A and B are stored in the registers $s6 and $s7. The elements of the arrays are 4 byte words.
With above information, the MIPS code for the given C statement is as follows:
sll $t0,$s1,2
add $t0,$t0,$s7
lw $t0, 0($t0)
addi $t0,$t0,1
sll $t0, $t0,2
lw $s0,0($t0)
Instruction | Explanation |
sll $t0,$s1,2 | Shift left logical instruction will shift 4 spaces in $s1 register that is g. $t0🡨-4*g |
add $t0,$t0,$s7 | The values of $t0 and $s7 will be added and the result will be stored in $t0.The $t0 will have the address of array B with value g. $t0🡨Address of B[g] |
lw $t0,0($t0) | Now, the value of B[g] will be loaded to $t0. $t0🡨B[g] |
addi $t0,$t0,1 | The value of B[g] will be added with the immediate 1. $t0🡨B[g]+1 |
sll $t0,$t0,2 | Now the logical shift of 4 will be pointed to B[g]+1 and the address of B[g]+1 will be assigned. |
lw $s0,0($t0) | The f will be assigned with the value of A[B[g]+1] |