3.2 “Popping”

“Pop” is opposite of “push”. “Pop” removes an item from the stack. For example, if we need to restore the value of eax saved from the previous section, we can use the following instructions:

movl (%esp),%eax 
addl $4,%esp

This is exactly the opposite of the instructions to push an item on the stack. First, whatever is pointed to by esp is “retrieved” from the stack using a movl instruction. Then the boundary separating the used and unused portions of the stack is moved so that four bytes are “deallocated” and become available again.