title: What is the difference between retq and ret?
body: <p>Let's consider the following program, which computes an unsigned square of the argument:</p>
  
  <pre><code>.global foo
  .text
  foo:
      mov %rdi, %rax
      mul %rdi
      ret
  </code></pre>
  
  <p>This is properly compiled by <code>as</code>, but disassembles to </p>
  
  <pre><code>0000000000000000 &lt;foo&gt;:
     0:   48 89 f8                mov    %rdi,%rax
     3:   48 f7 e7                mul    %rdi
     6:   c3                      retq   
  </code></pre>
  
  <p>Is there any difference between <code>ret</code> and <code>retq</code>?</p>