Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume x ' s base address is in $t 0 and i is in $t 1 . Convert the following C statement to assembly. i

Assume x's base address is in $t0 and i is in $t1. Convert the following C statement to assembly.
i =0;
while (i <4){
x[i]= x[i]+1;
i = i + i;
}
Group of answer choices
addi $t1, $zero, 0
addi $t2, $zero, 4
Loop: blt $t1, $t2, After
add $t3, $t1, $t0
lw $t4,0($t3)
addi $t4, $t4,1
sw $t4,0($t3)
addi $t1, $t1,1
j Loop
After:
addi $t1, $zero, 0
addi $t2, $zero, 4
Loop: bge $t1, $t2, After
add $t3, $t1, $t0
lw $t4,0($t3)
addi $t4, $t4,1
sw $t4,0($t3)
addi $t1, $t1,1
j Loop
After:
addi $t1, $zero, 0
addi $t2, $zero, 4
Loop: bge $t1, $t2, After
mul $t3, $t1, $t2
add $t3, $t3, $t0
lw $t4,0($t3)
addi $t4, $t4,1
sw $t4,0($t3)
addi $t1, $t1,1
j Loop
After:
addi $t1, $zero, 0
addi $t2, $zero, 4
Loop: blt $t1, $t2, After
mul $t3, $t1, $t2
add $t3, $t3, $t0
lw $t4,0($t3)
addi $t4, $t4,1
sw $t4,0($t3)
addi $t1, $t1,1
j Loop
After:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions