# square array of ints and then print array # register use # - $t0: int i # - $t1: int n # - $t2: int m # - $t5..$t7: temporary results main: li $t0, 0 # int i = 0; loop_0: bge $t0, 5, end_0 # if (i >= 5) goto end_0; li $v0, 5 # scanf("%d", &m); syscall # move $t2, $v0 # la $t5, numbers # inumbers[i] = m; mul $t6, $t0, 4 add $t7, $t5, $t6 sw $t2, 0($t7) addi $t0, $t0, 1 # i++ b loop_0 # goto loop_0 end_0: li $t0, 4 # int i = 4; loop_1: blt $t0, 0, end_1 # if (i < 0) 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]; .space 40