I'm no ASM expert.. in fact the only thing I know is how to spell it..
BUT - it looks like it is moving the pointer to the stack by 12 BYTES (??), pushing the number 0 onto the stack (the argument to sleep() ). Then it calls the sleep function then restores the pointer to the stack, then returns to the begining of the loop. Not sure exactly why it subtracts 12 from the extended stack pointer though.
[edit]
ESP is the extended (32 bit) pointer to the stack, SUB is a subtraction routine where b is the source and a is the destination.
[/edit]
As for MSVC, this is what you get when you compare the two.. It looks like for (;;) uses less operations!?
Code:
while (true)
00413132 xor eax,eax
00413134 inc eax
00413135 test eax,eax
00413137 je main+36h (41314Ch)
{
Sleep(0);
00413139 mov esi,esp
0041313B push 0
0041313D call dword ptr [__imp__Sleep@4 (42B20Ch)]
00413143 cmp esi,esp
00413145 call @ILT+1055(__RTC_CheckEsp) (411424h)
}
0041314A jmp main+1Ch (413132h)
Code:
for(;;)
{
Sleep(0);
00413132 mov esi,esp
00413134 push 0
00413136 call dword ptr [__imp__Sleep@4 (42B20Ch)]
0041313C cmp esi,esp
0041313E call @ILT+1055(__RTC_CheckEsp) (411424h)
}
00413143 jmp main+1Ch (413132h)