title: What is the difference between quad operators and long operators
body: <p>Simply put,
  I have the following code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #define MAXNO 100
  void selectionSort(int [], int);
  int main() // main.c
  {
  int no = 0, i ;
  int data[MAXNO] ;
  printf(&quot;Enter the data, terminate with Ctrl+D\n&quot;) ;
  while(scanf(&quot;%d&quot;, &amp;data[no]) != EOF) ++no;
  selectionSort(data, no) ;
  printf(&quot;Data in sorted Order are: &quot;) ;
  for(i = 0; i &lt; no; ++i) printf(&quot;%d &quot;, data[i]);
  putchar('\n') ;
  return 0 ;
  }
  </code></pre>
  <p>And I have the following Assembly code generated when I run
  <code>cc -S -Wall main.c</code></p>
  <pre><code>    .file   &quot;main.c&quot;
      .section    .rodata
      .align 8
  .LC0:
      .string &quot;Enter the data, terminate with Ctrl+D&quot;
  .LC1:
      .string &quot;%d&quot;
  .LC2:
      .string &quot;Data in sorted Order are: &quot;
  .LC3:
      .string &quot;%d &quot;
      .text
      .globl  main
      .type   main, @function
  main:
  .LFB0:
      .cfi_startproc
      pushq   %rbp
      .cfi_def_cfa_offset 16
      .cfi_offset 6, -16
      movq    %rsp, %rbp
      .cfi_def_cfa_register 6
      subq    $416, %rsp
      movl    $0, -408(%rbp)
      movl    $.LC0, %edi
      call    puts
      jmp .L2
  .L3:
      addl    $1, -408(%rbp)
  .L2:
      leaq    -400(%rbp), %rax
      movl    -408(%rbp), %edx
      movslq  %edx, %rdx
      salq    $2, %rdx
      addq    %rdx, %rax
      movq    %rax, %rsi
      movl    $.LC1, %edi
      movl    $0, %eax
      call    __isoc99_scanf
      cmpl    $-1, %eax
      jne .L3
      movl    -408(%rbp), %edx
      leaq    -400(%rbp), %rax
      movl    %edx, %esi
      movq    %rax, %rdi
      call    selectionSort
      movl    $.LC2, %edi
      movl    $0, %eax
      call    printf
      movl    $0, -404(%rbp)
      jmp .L4
  .L5:
      movl    -404(%rbp), %eax
      cltq
      movl    -400(%rbp,%rax,4), %eax
      movl    %eax, %esi
      movl    $.LC3, %edi
      movl    $0, %eax
      call    printf
      addl    $1, -404(%rbp)
  .L4:
      movl    -404(%rbp), %eax
      cmpl    -408(%rbp), %eax
      jl  .L5
      movl    $10, %edi
      call    putchar
      movl    $0, %eax
      leave
      .cfi_def_cfa 7, 8
      ret
      .cfi_endproc
  .LFE0:
      .size   main, .-main
      .ident  &quot;GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4&quot;
      .section    .note.GNU-stack,&quot;&quot;,@progbits
  </code></pre>
  <p><strong>The thing I dont get is:</strong></p>
  <p>What is the difference between quad and long operations like <code>movq</code> and <code>movl</code>. I know that one is for 64bit and the other for 32bit operations but here the integers are taken as 32bit right? So why is there a mix of <code>movq</code>s and <code>movl</code>s (or any other operation, for that matter) in the code?</p>
  <h3>Edit:</h3>
  <p>Forgot to add details of my system:</p>
  <pre><code>Linux Z510 3.13.0-58-generic #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  </code></pre>