title: What is the purpose of XORing a register with itself?
body: <p><code>xor eax, eax</code> will always set <code>eax</code> to zero, right? So, why does MSVC++ sometimes put it in my executable's code? Is it more efficient that <code>mov eax, 0</code>?</p>
  
  <pre><code>012B1002  in          al,dx 
  012B1003  push        ecx  
      int i = 5;
  012B1004  mov         dword ptr [i],5 
      return 0;
  012B100B  xor         eax,eax 
  </code></pre>
  
  <p>Also, what does it mean to do <code>in al, dx</code>?</p>