.text # # num = 884736454 # count = 0 # # while num > 0: # count = count + (num & 1) # num = num >> 1 # # print count # This MIPS assembly language program mimics # the Python program by using the div instruction # to determine if a number is odd (has a one in the least # significant bit) and to divide it by 2. main: lui $t0, 13500 # the number 884736454 ori $t0, $t0, 454 ori $t1, $zero, 0 # loop count ori $t2, $zero, 2 # the constant 2 while: beq $t0, $zero endwhile andi $t3, $t0, 1 add $t1, $t1, $t3 srl $t0, $t0, 1 j while endwhile: jr $ra