title: EBP, ESP and stack frame in assembly
body: <p>I have a few questions about EBP, ESP and stack frame in following code.</p>
  <ol>
  <li><p>Why did we subtract 28 from esp? We have two local variables x and y in main. So why didn't we subtract 8?</p>
  </li>
  <li><p>And don't we put values to stack from right (or top) to left (or bottom)? So why did we  add 1 to [eax+8] instead of [eax+4]?</p>
  </li>
  </ol>
  <hr />
  <pre><code>func(int a, int b, int c)
  {
    return a+b+c;
  }
  main()
  {
   int x, y=3;
   x=func(y,2,1);
  }
  </code></pre>
  <p><img src="https://i.stack.imgur.com/S5Ig6.png" alt="Passing Parameters in Assembly " /></p>