.section .data arr: .word 3, 5, 9, 33, 10, 59, 22, 95, 23, 24 .section .text .globl _start # # a5 - Holds the current array index address # a1 - The loop counter # t4 - total elements in the array # t1 - the index - actually used to calculate the next # item, always the array member size, can be a loop invariant # t2 - holds the new index address, I'm pretty sure this can use a5 again get_largest_number: la a5, arr lw a0, (a5) li a1, 1 li t4, 10 slli t1, a1, 2 for: bge a1, t4, for_exit add a5, a5, t1 lw t3, (a5) blt t3, a0, skip mv a0, t3 skip: addi a1, a1, 1 j for for_exit: ret _start: call get_largest_number li a7, 93 ecall