title: when coding in cpp, what's the difference of memory consumption between reference and varibale
body: <p>I compile following code</p>
  <pre><code>int foo(int num) {
      int &amp;numReference = num;
      int numVarible = num;
      return numVarible;
  }
  </code></pre>
  <p>output assemble translation.</p>
  <pre><code>foo(int):
      push    rbp
      mov     rbp, rsp
      mov     DWORD PTR [rbp-20], edi
      lea     rax, [rbp-20]
      mov     QWORD PTR [rbp-8], rax
      mov     eax, DWORD PTR [rbp-20]
      mov     DWORD PTR [rbp-12], eax
      mov     eax, DWORD PTR [rbp-12]
      pop     rbp
      ret
  </code></pre>
  <p>int &amp;numReference = num; output assemble:</p>
  <pre><code>    lea     rax, [rbp-20]
      mov     QWORD PTR [rbp-8], rax
  </code></pre>
  <p>int numVarible = num; output assemble:</p>
  <pre><code>    mov     eax, DWORD PTR [rbp-20]
      mov     DWORD PTR [rbp-12], eax
  </code></pre>
  <p>the question 1 is what's the difference about memeory comsumption.</p>
  <p>When I change code from &quot;return numVarible;&quot; to &quot;return numReference ;&quot;.
  assemble changes from</p>
  <pre><code>mov     eax, DWORD PTR [rbp-12]
  </code></pre>
  <p>to</p>
  <pre><code>mov     rax, QWORD PTR [rbp-8]
  mov     eax, DWORD PTR [rax]
  </code></pre>
  <p>the question 2 is: when using reference, why assemble shows more line?</p>