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 as a single pdf file on Canvas. Show your solution steps so you receive partial credit for incorrect answers.
new-proc:
sll $a0, $a0, 8
srl $a0, $a0, 16
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