Function epilogue in assembly
<p>I'm trying to follow along with the author of my book, and he gives us the example function with a prologue and epilogue (no local variables in function)</p>

<pre><code>1:    push ebp
2:    mov ebp, esp
3:    ...
4:    movsx eax, word ptr [ebp+8]
5:    movsx eax, word ptr [ebp+0Ch]
6:    add eax, ecx
7:    ...
8:    mov esp, ebp
9:    pop ebp
10:   retn
</code></pre>

<p>that is invoked by</p>

<pre><code>push eax     ; param 2
push ecx     ; param 1
call addme
add esp, 8   ; cleanup stack
</code></pre>

<p>In this example, is <strong>line 8</strong> not a redundant instruction? I mean, is <code>EBP</code> not already equal to <code>ESP</code> in this context? Nothing has been <code>PUSH</code> or <code>POP</code> in the stack since.</p>

<p>My assumption is that this line would only be necessary if we had local variables that were pushed onto the stack, and this would be a method to clear the stack of those local variables?</p>

<p>I would just like to clarify that this is the case</p>