start: addi $sp, $sp, -4 # adjust stack for 1 item sw $s0, 0($sp) # save $s0 add
ID: 3888584 • Letter: S
Question
start: addi $sp, $sp, -4 # adjust stack for 1 item
sw $s0, 0($sp) # save $s0
add $s0, $zero, $zero # i = 0
L1: add $t1, $s0, $a1 # addr of y[i] in $t1
lbu $t2, 0($t1) # $t2 = y[i]
add $t3, $s0, $a0 # addr of x[i] in $t3
sb $t2, 0($t3) # x[i] = y[i]
beq $t2, $zero, L2 # exit loop if y[i] == 0
addi $s0, $s0, 1 # i = i + 1
j L1 # next iteration of loop
L2: lw $s0, 0($sp) # restore saved $s0
addi $sp, $sp, 4 # pop 1 item from stack
jr $ra # and return
This is a set of MIPS instructions, Convert it to ARM version.
Thank you.
Explanation / Answer
POP {R0, R1, R5, PC}
LDC2L P0, C11, [PC], #0x2BC
MOVS R0, R0
MOVS R0, R0
MOVS R0, #0x80
LSLS R2, R0, #0x14
MOVS R0, #0x48
CMP R2, #0x91
MOVS R0, R0
LSLS R2, R0, #0x10
MOVS R0, #0x58
LDR R1, [R4, #0x28]
MOVS R0, R0
ANDS R1, R2
LSLS R0, R0, #8
ASRS R2, R4, #0x20
LSLS R0, R0, #4
MOVS R0, R1
LSLS R0, R0, #0xC
SUB SP, #0x3C
MOVS R0, R0
POP {R0, R1, R5, PC}
LSLS R0, R0, #0x10
B #0x3A
LSRS R0, R0, #0x20
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.