This is the code that I am using:
printing:
decq %r13
movq $0, %rax
movq %r8, %rsi
movq $output, %rdi
call printf
cmpq $0, %r13
jg printing
where %r13 is used as the counter.
So as I saw while debugging in GDB, if I have a value of 5 in %r13, the subroutine printing does get executed 5 times, 1 after another. But for some reason, I never get the value that is in %r8 printed more than once. No matter if the number in %r13 is 1 or 50.
And if I change the value of %r8 or %rsi, then that value also gets printed only once.
What could be causing printf just not to print the contents of %r8 more than one time?