int dw_loop(int x, int y, int n);
Register | Variable | Initially |
---|---|---|
%eax | x | x |
%ecx | y | y |
%edx | n | n |
1 2 dw_loop: 3 pushl %ebp 4 movl %esp, %ebp 5 movl 8(%ebp), %eax 6 movl 12(%ebp), %ecx 7 movl 16(%ebp), %edx 8 .L3: L3: 9 addl %edx, %eax x = x + n; 10 imull %edx, %ecx y = y * n; 11 subl $1, %edx n = n - 1; 12 testl %edx, %edx if (n <= 0) goto L5; 13 jle .L5 14 cmpl %edx, %ecx if (y < n) goto L3 15 jl .L3 16 .L5: L5: 17 popl %ebp return x; 18 ret