# print array of ints # register use # - $t0: int i # - $t1: int n # - $t5..$t7: temporary results main: li $t0, 0 # int i = 0; loop_1: bge $t0, 5, end_1 # if (i >= 5) goto end_1; la $t5, numbers # int n = numbers[i]; mul $t6, $t0, 4 add $t7, $t5, $t6 lw $t1, 0($t7) move $a0, $t1 # printf("%d", n); li $v0, 1 syscall li $a0, '\n' # printf("%c", '\n'); li $v0, 11 syscall addi $t0, $t0, 1 # i++ b loop_1 # goto loop_1 end_1: li $v0, 0 # return 0 jr $ra .data numbers: # int numbers[10] = { 3, 9, 27, 81, 243}; .word 3, 9, 27, 81, 243