title: Purpose of rep stos assembly command in this code from Visual Studio
body: <p>Take a look at the following code:</p>
  
  <pre><code>void f()
  {
  }
  </code></pre>
  
  <p>I compiled this in Visual Studio 2013, debug, 32-bit mode and looked at the dissassembly.</p>
  
  <pre><code>void f()
  {
  00304CB0  push        ebp  
  00304CB1  mov         ebp,esp  
  00304CB3  sub         esp,0C0h  
  00304CB9  push        ebx  
  00304CBA  push        esi  
  00304CBB  push        edi  
  00304CBC  lea         edi,[ebp-0C0h]  
  00304CC2  mov         ecx,30h  
  00304CC7  mov         eax,0CCCCCCCCh  
  00304CCC  rep stos    dword ptr es:[edi]  
  }
  00304CCE  pop         edi  
  00304CCF  pop         esi  
  00304CD0  pop         ebx  
  00304CD1  mov         esp,ebp  
  00304CD3  pop         ebp  
  00304CD4  ret  
  </code></pre>
  
  <p>What is the purpose of the rep stos instruction?</p>
  
  <p>I'm just curious.</p>