#include<stdio.h>
int main()
{
int n = 2;
while (n--) {
printf("%d", n);
}
return 0;
}
.LC0:
.string "%d"
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], 2
jmp .L2
.L3:
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
.L2:
mov eax, DWORD PTR [rbp-4]
lea edx, [rax-1]
mov DWORD PTR [rbp-4], edx
test eax, eax
jne .L3
mov eax, 0
leave
ret
#include<stdio.h>
int main()
{
int n = 2;
while (--n) {
printf("%d", n);
}
return 0;
}
.LC0:
.string "%d"
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], 2
jmp .L2
.L3:
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
.L2:
sub DWORD PTR [rbp-4], 1
cmp DWORD PTR [rbp-4], 0
jne .L3
mov eax, 0
leave
ret