What compiler/linker arguments are you using? I haven't used pelles before but I assume it has something similar to the debug/release modes in visual studio.
My results, with VS2010 default settings, were
Release build: both loops always takes 600-700ms.
Debug build: on most attempts both loops takes 1100-1200ms to execute, but rarely the first loop takes ~3900ms and then the following ones takes ~1100ms again.
I'm not entirely sure, but I think it has something to do with speedstep as I can see the cpu frequency changing in cpu-z. Although why it only affects debug and not release I have no answer for. Perhaps the extra buffer security checks in debug mode does something weird.