main: # Locals: # $t0: int n # $t1: int tmp li $v0, 4 la $a0, prompt1_msg syscall # printf("Enter a number: "); li $v0, 5 syscall move $t0, $v0 # scanf("%d", &n); rem $t1, $t0, 2 # int tmp = n % 2; beqz $t1, if_even_end # if (tmp == 0) goto if_even_end; bnez $t1, if_odd_end # if (tmp != 0) goto if_odd_end; if_even_end: li $v0, 4 la $a0, even_msg # printf("even\n"); syscall b end # goto end; if_odd_end: li $v0, 4 la $a0, odd_msg # printf("odd\n"); syscall end: li $v0, 0 jr $ra # return 0; .data prompt1_msg: .asciiz "Enter a number: " even_msg: .asciiz "even\n" odd_msg: .asciiz "odd\n"