title: What is the meaning/use of the MOVZX, CDQE instructions in this code output by a C compiler?
body: <p>I have following C snippet:</p>
  
  <pre><code>int main() {
  
      int tablica [100];
      bool visited [100];
      int counter;
      int i;
  
      for(i=0;i&lt;=99;i++) {
          if (visited[i]==0) {
              counter=counter+1;
          }
      }
  
  }
  </code></pre>
  
  <p>which I converted to assembler. I received the following output:</p>
  
  <pre><code>   ; ...
  
      mov     eax, DWORD PTR [rbp-8]
      cdqe
      movzx   eax, BYTE PTR [rbp-528+rax]
      xor     eax, 1
      test    al, al
      je      .L3
  
      ; ...
  </code></pre>
  
  <p>Could anybody explain to me what is the meaning and purpose of the <code>CDQE</code> and <code>MOVZX</code> instructions in this code? I also don't understand what the use of the <code>XOR</code> instruction is.</p>