Question: convert this code to c language. . array: .word 2, 4, 11, 34, 56, 40 main: la a0, array li a1,0 li a2, 5 li

convert this code to c language. .

array:

.word 2, 4, 11, 34, 56, 40

main:

la a0, array

li a1,0

li a2, 5

li t0, 56

loop:

beq a1, a2, end

add t1, a1, a2

srli t1, t1, 1

add t1, t1, a0

lw t2, 0(t1)

bgt t2, t0, right

addi a1, t1, 4

j loop

right:

addi a2, a1, -4

j loop

end: bne t2, t0, not_found

li a0, 1

j end_main

not_found:

li a0, 0

end_main:

jr ra

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!