title: Help deciphering simple Assembly Code
body: <p>I am learning assembly using GDB &amp; Eclipse
  <br />Here is a simple C code.</p>
  
  <pre><code>int absdiff(int x, int y)
  {  
  if(x &lt; y)  
    return y-x;
  else  
    return x-y;
  }
  
  int main(void) {  
  int x = 10;  
  int y = 15;  
  absdiff(x,y);
  return EXIT_SUCCESS;  
  }
  </code></pre>
  
  <p>Here is corresponding assembly instructions for main()</p>
  
  <pre><code>          main:
  080483bb:   push %ebp  #push old frame pointer onto the stack
  080483bc:   mov %esp,%ebp #move the frame pointer down, to the position of stack pointer
  080483be:   sub $0x18,%esp  # ???
  25         int x = 10;    
  080483c1:   movl $0xa,-0x4(%ebp) #move the "x(10)" to 4 address below frame pointer (why not push?)
  26         int y = 15;
  080483c8:   movl $0xf,-0x8(%ebp) #move the "y(15)" to 8 address below frame pointer (why not push?)
  28         absdiff(x,y);
  080483cf:   mov -0x8(%ebp),%eax # -0x8(%ebp) == 15 = y, and move it into %eax
  080483d2:   mov %eax,0x4(%esp) # from this point on, I am confused
  080483d6:   mov -0x4(%ebp),%eax 
  080483d9:   mov %eax,(%esp)
  080483dc:   call 0x8048394 &lt;absdiff&gt;
  31         return EXIT_SUCCESS;
  080483e1:   mov $0x0,%eax
  32        }
  </code></pre>
  
  <p>Basically, I am asking to help me to make sense of this assembly code, and why it is doing things in this particular order. Point where I am stuck, is shown in assembly comments. Thanks !</p>