So I have this simple code:
.data
n: .long 5
s: .space 4
format: .asciz "%d"
.text
.global main
main:
mov $0, %eax
etloop:
cmp n, %eax
je etexit
movl n, %ebx
pushl %ebx
push $format
call printf
pop %ebx
pop %ebx
push $0
call fflush
pop %ebx
add %eax, s
add $1, %eax
jmp etloop
etexit:
mov $1, %eax
mov $0, %ebx
int $0x80
It is supposed to print the sum of the numbers from 0 to 4. However, it looks like printing inside the loop creates an infinite one, even though the ecx register isn't affected.