Created
October 1, 2010 19:56
-
-
Save DmitrySoshnikov/606760 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loop-code-gen.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
int i = 0, n = 1; | |
while (i++ < n) if (i == 1) break; | |
while (i++ < n && i != 1); | |
return 0; | |
} | |
// code gen of MS 2005 in debug mode | |
int i = 0, n = 1; | |
0041137E mov dword ptr [i],0 | |
00411385 mov dword ptr [n],1 | |
while (i++ < n) if (i == 1) break; | |
0041138C mov eax,dword ptr [i] | |
0041138F mov ecx,dword ptr [n] | |
00411392 mov edx,dword ptr [i] | |
00411395 add edx,1 | |
00411398 mov dword ptr [i],edx | |
0041139B cmp eax,ecx | |
0041139D jge wmain+4Bh (4113ABh) | |
0041139F mov dword ptr [ebp-0DCh],1 | |
004113A9 jmp wmain+55h (4113B5h) | |
004113AB mov dword ptr [ebp-0DCh],0 | |
004113B5 cmp dword ptr [ebp-0DCh],0 | |
004113BC je wmain+68h (4113C8h) | |
004113BE cmp dword ptr [i],1 | |
004113C2 jne wmain+66h (4113C6h) | |
004113C4 jmp wmain+68h (4113C8h) | |
while (i++ < n && i != 1); | |
004113C6 jmp wmain+2Ch (41138Ch) | |
004113C8 mov eax,dword ptr [i] | |
004113CB mov ecx,dword ptr [n] | |
004113CE mov edx,dword ptr [i] | |
004113D1 add edx,1 | |
004113D4 mov dword ptr [i],edx | |
004113D7 cmp eax,ecx | |
004113D9 jge wmain+87h (4113E7h) | |
004113DB mov dword ptr [ebp-0DCh],1 | |
004113E5 jmp wmain+91h (4113F1h) | |
004113E7 mov dword ptr [ebp-0DCh],0 | |
004113F1 cmp dword ptr [ebp-0DCh],0 | |
004113F8 je wmain+0A2h (411402h) | |
004113FA cmp dword ptr [i],1 | |
004113FE je wmain+0A2h (411402h) | |
00411400 jmp wmain+68h (4113C8h) | |
return 0; | |
00411402 xor eax,eax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment