Note: Make reasonable assumptions where necessary and clearly state them. Feel free to discuss problems with classmates, but the only written material that you may consult while writing your solutions are the textbook and lecture slides/videos. Solutions should be uploaded on Gradescope. Show your solution steps so you receive partial credit for incorrect answers and we know you have understood the material. Don't just show us the final answer.
Every homework has an automatic penalty-free 1.5 day extension to accommodate any covid/family-related disruptions. In other words, try to finish your homework by Tuesday 10:45am to keep up with the lecture content, but if necessary, you may take until Wednesday 11:59pm.
new-proc:
sll $a0, $a0, 24
srl $a0, $a0, 24
add $v0, $a0, $zero
jr $ra
new-proc:
blt $a1, $zero, loop2
loop1:
beq $a1, $zero, proc-end
sll $a0, $a0, 1
addi $a1, $a1, -1
j loop1
loop2:
beq $a1, $zero, proc-end
srl $a0, $a0, 1
addi $a1, $a1, 1
j loop2
proc-end:
add $v0, $a0, $zero
jr $ra