Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A) addi $t1, $0, 100 loop: lw $s1, 0($s0) add $s2, $s2, $s1 addi $s0, $s0, 4 sub

ID: 3615206 • Letter: A

Question

A)           addi $t1, $0, 100       loop:    lw   $s1, 0($s0)                  add   $s2, $s2, $s1                  addi  $s0, $s0, 4                   subi  $t1, $t1, 1                  bne    $t1, $0, loop B)                  addi $t1, $s0, 400       loop:    lw   $s1, 0($s0)                  add   $s2, $s2, $s1                  lw     $s1, 4($s0)                  add  $s2, $s2, $s1                  addi $s0, $s0, 8                  bne    $t1, $0, loop Translate the loops into C. Assume that the C-level integer iis held in register $t1, $s2 holds the C-level integer calledresult, and $s0 holds the base address of the integer MemArray. Dofor A and B. A)           addi $t1, $0, 100       loop:    lw   $s1, 0($s0)                  add   $s2, $s2, $s1                  addi  $s0, $s0, 4                   subi  $t1, $t1, 1                  bne    $t1, $0, loop B)                  addi $t1, $s0, 400       loop:    lw   $s1, 0($s0)                  add   $s2, $s2, $s1                  lw     $s1, 4($s0)                  add  $s2, $s2, $s1                  addi $s0, $s0, 8                  bne    $t1, $0, loop       loop:    lw   $s1, 0($s0)                  add   $s2, $s2, $s1                  lw     $s1, 4($s0)                  add  $s2, $s2, $s1                  addi $s0, $s0, 8                  bne    $t1, $0, loop Translate the loops into C. Assume that the C-level integer iis held in register $t1, $s2 holds the C-level integer calledresult, and $s0 holds the base address of the integer MemArray. Dofor A and B.

Explanation / Answer

Dear... A) The array MemArray with 100 elements initialized andsum is avariable of integer with initialized to 0.          for(i=100;i>=0;i--)      {      {         sum=sum+MemArray[i];      } B)      i = MemArray +100;       while(i !=MemArray)        {            sum+=MemArray[0];           MemArray++;           sum += MemArray[1];            MemArray++;         }         }   Hope this will help you...
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote