003A1000 >/$ 55 push ebp ; 1
003A1001 |. 8BEC mov ebp,esp ; 1
003A1003 |. 51 push ecx ; 1
003A1004 |. 68 F4203A00 push for.003A20F4 ; /format = "dada"
003A1009 |. FF15 A0203A00 call dword ptr ds:[<&MSVCR90.printf>] ; \1
003A100F |. 83C4 04 add esp,0x4 ; 这时候还0x8-0x4=0x4 1
003A1012 |. C745 FC 01000>mov dword ptr ss:[ebp-0x4],0x1 ; i=1初始化 把0x1放进去 1
003A1019 |. EB 09 jmp short for.003A1024 ; 然后跳转到cmp那进行比较 1
003A101B |> 8B45 FC /mov eax,dword ptr ss:[ebp-0x4]
003A101E |. 83C0 01 |add eax,0x1 ; 进行+1
003A1021 |. 8945 FC |mov dword ptr ss:[ebp-0x4],eax
003A1024 837D FC 0A cmp dword ptr ss:[ebp-0x4],0xA ; 比较eax的值10大小
003A1028 7F 14 jg short for.003A103E ; 这个语句是如果eax的值大于0xa就跳转到介绍的地方
003A102A 8B4D FC mov ecx,dword ptr ss:[ebp-0x4] ; 把当前i的值给ecx
003A102D |. 51 |push ecx ; /<%d> = 6FD9215C (1876500828.)
003A102E |. 68 FC203A00 |push for.003A20FC ; |format = "%d,"
003A1033 |. FF15 A0203A00 |call dword ptr ds:[<&MSVCR90.printf>] ; \输出ecx的值
003A1039 |. 83C4 08 |add esp,0x8 ; 平衡堆栈
003A103C |.^ EB DD \jmp short for.003A101B
003A103E |> 33C0 xor eax,eax
003A1040 |. 8BE5 mov esp,ebp
003A1042 |. 5D pop ebp
003A1043 \. C3 retn
/最小化优化
//00401000 /$ 56 PUSH ESI
//00401001 |. 33F6 XOR ESI,ESI ; i=0;
//00401003 |. 46 INC ESI ; i=1;
//00401004 |> 56 /PUSH ESI ; /<%d>
//00401005 |. 68 F4204000 |PUSH for.004020F4 ; |format = "%d,"
//0040100A |. FF15 A0204000 |CALL DWORD PTR DS:[<&MSVCR90.printf>] ; \printf
//00401010 |. 46 |INC ESI ; i++
//00401011 |. 83FE 0A |CMP ESI,0A ; if (i<=10) goto 401004
//00401014 |. 59 |POP ECX
//00401015 |. 59 |POP ECX
//00401016 |.^ 7E EC \JLE SHORT for.00401004
//00401018 |. 33C0 XOR EAX,EAX
//0040101A |. 5E POP ESI
//0040101B \. C3 RETN ; 33-1B
//最大化速度优化
//00401000 /$ 56 PUSH ESI
//00401001 |. 57 PUSH EDI
//00401002 |. 8B3D A0204000 MOV EDI,DWORD PTR DS:[<&MSVCR90.printf>] ; MSVCR90.printf
//00401008 |. BE 01000000 MOV ESI,1 ; int i=1;
//0040100D |. 8D49 00 LEA ECX,DWORD PTR DS:[ECX] ; ecx=ecx
//00401010 |> 56 /PUSH ESI
//00401011 |. 68 F4204000 |PUSH for.004020F4 ; ASCII "%d,"
//00401016 |. FFD7 |CALL EDI ; call dword ptr [printf]
//00401018 |. 46 |INC ESI ; i++;
//00401019 |. 83C4 08 |ADD ESP,8
//0040101C |. 83FE 0A |CMP ESI,0A ; 0B
//0040101F |.^ 7E EF \JLE SHORT for.00401010 ; if (i<=10) 继续循环 goto 401010
//00401021 |. 5F POP EDI
//00401022 |. 33C0 XOR EAX,EAX
//00401024 |. 5E POP ESI
//00401025 \. C3 RETN
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
printf("dada");
for (int i=1;i<=10;i++)
{
printf("%d,",i);
}
return 0;
}