.data
x: .word 1234
.text
main:
lw $t0, x
li $t1, 0x80000000 #mask
li $t2, 0 #count
li $t3, 0 #i
for:
bge $t3, 32, end_for
and $t4, $t1, $t0
beqz $t4, end_if
if:
addi $t2, $t2, 1
end_if:
srl $t1, $t1, 1
addi $t3, $t3, 1 #i++
j for
end_for:
li $v0, 1
move $a0, $t2
syscall
li $v0, 0
jr $ra