previous | start | next

Reverse engineering: loops (1)

 int dw_loop(int x, int y, int 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:
    9           addl    %edx, %eax
   10           imull   %edx, %ecx
   11           subl    $1, %edx
   12           testl   %edx, %edx
   13           jle     .L5
   14           cmpl    %edx, %ecx
   15           jl      .L3
   16   .L5:
   17           popl    %ebp
   18           ret
Register Variable Initially
%eax x x
%ecx y y
%edx n n


previous | start | next