title: Assembly: add 1 to parameter
body: <pre><code>  push rbp
    mov rbp, rsp
    mov dword ptr [rbp - 4], edi
    mov edi, dword ptr [rbp - 4]
    add edi, 1
    mov eax, edi
    pop rbp
    ret
  </code></pre>
  
  <p>Hello! I'm studying assembly and I'm having trouble understanding two things:</p>
  
  <ol>
  <li>Why do we use rbp? I know it's a register that may not be modified by the callee, but I don't see why it cannot be modified, and why we don't just use rsp. Also, shouln't it be rbx instead of rbp? </li>
  <li>From line 3-4, why do we move the element in edi to [rbp-4], and then move it back to edi again? Also, shouln't it be mov rbp-4, [edi] instead of [rbp-4], edi?</li>
  </ol>