title: C program spends 77% of the time in _platform_memmove$VARIANT$Haswell
body: <p>I'm profiling some numerical code written in C (profiler is Instruments, compiler is <code>clang</code> on Mac OSX 10.11.6). As much as 77.3% of the running time is spent in <code>_platform_memmove$VARIANT$Haswell</code>.</p>
  
  <p>In the assembly output, the above function is called by <code>DYLD-STUB$$memcpy</code>. However, I have no <code>memcpy</code>'s in my C code (I do have some <code>malloc</code>'s though).</p>
  
  <p>Going deeper, it seems that the assembly command <code>rep</code> is responsible for taking up so much time. From <a href="https://stackoverflow.com/questions/7086220/what-does-rep-nop-mean-in-x86-assembly">this</a> post, it seems that <code>rep</code> is not doing anything useful. Why does the compiler insert it? And where do the <code>memcpy</code>'s come from?</p>
  
  <p>I also tried compiling with <code>-g</code>, but then <code>_platform_memmove$VARIANT$Haswell</code> is not gobbling up almost all of the time anymore.</p>