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

Problem 3. Write the assembly code for the folowing C code. Assume i is stored i

ID: 3752924 • Letter: P

Question

Problem 3. Write the assembly code for the folowing C code. Assume i is stored in $s0 and j is stored in $s1: nt i-0 nt j-20 i-jti Problem 4. Write the assembly code for the folowing C code. Assume &al0] is store in $s0 and i is stored in registers $s2 nt i-0 while [kS9) aD)-all+6 ini+5 Problem S. The given assembly code is not correct for a procedure. Write the corrected version of the following assembly code. Your corrected version should preserve the functions main, funcl, and furc2 and also ensure that their main operations do not change. Please pay special attention to the line comments below addi $a0, S0, 20 addi $al, S0,45 addi Ss3,Sad, 6 do not change this line jal funcl add $s1, Sv0, $s3 #Sa3 needs to be Sao+6 as in line3 addi $s3, $a0, 50 ado not change this line add $a2, Ss3, Sal ado not change this line jal tunc2 addi Sva, sv1, Sa0 r Sra addi 3v1,Sa2,100 r Sra

Explanation / Answer

Solution:

Note: The first question is done as per Chegg guidelines, please repost others.

3)

code:

#j=$s1

main:

          li $s0,20

          li $s1,0

loop:

      bgt $s1,20,exit

     addi $s1,$s1,1

      j loop

      add $s0,$s0,$s1

exit

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

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