IT공부/IT서적

[윤성우 열혈 C프로그래밍] 디버깅 빌드, 어셈블리 코드 - Chapter8

shine94 2025. 1. 16. 14:26
#include <stdio.h>

int main(void)
{
007F1960  push        ebp  
007F1961  mov         ebp,esp  
007F1963  sub         esp,0D0h  
007F1969  push        ebx  
007F196A  push        esi  
007F196B  push        edi  
007F196C  lea         edi,[ebp-10h]  
007F196F  mov         ecx,4  
007F1974  mov         eax,0CCCCCCCCh  
007F1979  rep stos    dword ptr es:[edi]  
007F197B  mov         eax,dword ptr [__security_cookie (07FA000h)]  
007F1980  xor         eax,ebp  
007F1982  mov         dword ptr [ebp-4],eax  
007F1985  mov         ecx,offset _A8319CC3_ifBasic@c (07FC008h)  
007F198A  call        @__CheckForDebuggerJustMyCode@4 (07F1339h)  
007F198F  nop  
	int num;
	printf("정수 입력: ");
007F1990  push        offset string "\xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2: " (07F7B30h)  
007F1995  call        _printf (07F10DCh)  
007F199A  add         esp,4  
	scanf_s("%d", &num);
007F199D  lea         eax,[num]  
007F19A0  push        eax  
007F19A1  push        offset string "%d" (07F7B40h)  
007F19A6  call        _scanf_s (07F1294h)  
007F19AB  add         esp,8  

	if (num < 0)
007F19AE  cmp         dword ptr [num],0  
007F19B2  jge         __$EncStackInitStart+55h (07F19C1h)  
		printf("입력값은 0보다 작다\n");
007F19B4  push        offset string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xba\xb8\xb4\xd9 \xc0\xdb\xb4\xd9\n" (07F7B44h)  
007F19B9  call        _printf (07F10DCh)  
007F19BE  add         esp,4  

	if (num > 0)
007F19C1  cmp         dword ptr [num],0  
007F19C5  jle         __$EncStackInitStart+68h (07F19D4h)  
		printf("입력값은 0보다 크다\n");
007F19C7  push        offset string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xba\xb8\xb4\xd9 \xc5\xa9\xb4\xd9\n" (07F7B60h)  
007F19CC  call        _printf (07F10DCh)  
007F19D1  add         esp,4  

	if (num == 0)
007F19D4  cmp         dword ptr [num],0  
007F19D8  jne         __$EncStackInitStart+7Bh (07F19E7h)  
		printf("입력값은 0이다\n");
007F19DA  push        offset string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xc0\xcc\xb4\xd9\n" (07F7B7Ch)  
007F19DF  call        _printf (07F10DCh)  
007F19E4  add         esp,4  

	return 0;
007F19E7  xor         eax,eax  
}
007F19E9  push        edx  
007F19EA  mov         ecx,ebp  
007F19EC  push        eax  
007F19ED  lea         edx,ds:[7F1A18h]  
007F19F3  call        @_RTC_CheckStackVars@8 (07F11F4h)  
007F19F8  pop         eax  
007F19F9  pop         edx  
007F19FA  pop         edi  
007F19FB  pop         esi  
007F19FC  pop         ebx  
007F19FD  mov         ecx,dword ptr [ebp-4]  
007F1A00  xor         ecx,ebp  
007F1A02  call        @__security_check_cookie@4 (07F1159h)  
007F1A07  add         esp,0D0h  
007F1A0D  cmp         ebp,esp  
007F1A0F  call        __RTC_CheckEsp (07F1258h)  
007F1A14  mov         esp,ebp  
007F1A16  pop         ebp  
007F1A17  ret

 

#include <stdio.h>

int main(void)
{
00007FF634CE1980  push        rbp  
00007FF634CE1982  push        rdi  
00007FF634CE1983  sub         rsp,108h  
00007FF634CE198A  lea         rbp,[rsp+20h]  
00007FF634CE198F  lea         rdi,[rsp+20h]  
00007FF634CE1994  mov         ecx,0Ah  
00007FF634CE1999  mov         eax,0CCCCCCCCh  
00007FF634CE199E  rep stos    dword ptr [rdi]  
00007FF634CE19A0  mov         rax,qword ptr [__security_cookie (07FF634CED000h)]  
00007FF634CE19A7  xor         rax,rbp  
00007FF634CE19AA  mov         qword ptr [rbp+0D8h],rax  
00007FF634CE19B1  lea         rcx,[__A8319CC3_ifBasic@c (07FF634CF2008h)]  
00007FF634CE19B8  call        __CheckForDebuggerJustMyCode (07FF634CE137Ah)  
00007FF634CE19BD  nop  
	int num;
	printf("정수 입력: ");
00007FF634CE19BE  lea         rcx,[string "\xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2: " (07FF634CEAD28h)]  
00007FF634CE19C5  call        printf (07FF634CE119Ah)  
00007FF634CE19CA  nop  
	scanf_s("%d", &num);
00007FF634CE19CB  lea         rdx,[num]  
00007FF634CE19CF  lea         rcx,[string "%d" (07FF634CEAD38h)]  
00007FF634CE19D6  call        scanf_s (07FF634CE1203h)  
00007FF634CE19DB  nop  

	if (num < 0)
00007FF634CE19DC  cmp         dword ptr [num],0  
00007FF634CE19E0  jge         __$EncStackInitStart+60h (07FF634CE19EFh)  
		printf("입력값은 0보다 작다\n");
00007FF634CE19E2  lea         rcx,[string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xba\xb8\xb4\xd9 \xc0\xdb\xb4\xd9\n" (07FF634CEAD40h)]  
00007FF634CE19E9  call        printf (07FF634CE119Ah)  
00007FF634CE19EE  nop  

	if (num > 0)
00007FF634CE19EF  cmp         dword ptr [num],0  
00007FF634CE19F3  jle         __$EncStackInitStart+73h (07FF634CE1A02h)  
		printf("입력값은 0보다 크다\n");
00007FF634CE19F5  lea         rcx,[string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xba\xb8\xb4\xd9 \xc5\xa9\xb4\xd9\n" (07FF634CEAD60h)]  
00007FF634CE19FC  call        printf (07FF634CE119Ah)  
00007FF634CE1A01  nop  

	if (num == 0)
00007FF634CE1A02  cmp         dword ptr [num],0  
00007FF634CE1A06  jne         __$EncStackInitStart+86h (07FF634CE1A15h)  
		printf("입력값은 0이다\n");
00007FF634CE1A08  lea         rcx,[string "\xc0\xd4\xb7\xc2\xb0\xaa\xc0\xba 0\xc0\xcc\xb4\xd9\n" (07FF634CEAD80h)]  
00007FF634CE1A0F  call        printf (07FF634CE119Ah)  
00007FF634CE1A14  nop  

	return 0;
00007FF634CE1A15  xor         eax,eax  
}
00007FF634CE1A17  mov         edi,eax  
00007FF634CE1A19  lea         rcx,[rbp-20h]  
00007FF634CE1A1D  lea         rdx,[__xt_z+260h (07FF634CEAD00h)]  
00007FF634CE1A24  call        _RTC_CheckStackVars (07FF634CE1316h)  
00007FF634CE1A29  mov         eax,edi  
00007FF634CE1A2B  mov         rcx,qword ptr [rbp+0D8h]  
00007FF634CE1A32  xor         rcx,rbp  
00007FF634CE1A35  call        __security_check_cookie (07FF634CE11B3h)  
00007FF634CE1A3A  lea         rsp,[rbp+0E8h]  
00007FF634CE1A41  pop         rdi  
00007FF634CE1A42  pop         rbp  
00007FF634CE1A43  ret

 


 

#include <stdio.h>

int main(void)
{
00EE1960  push        ebp  
00EE1961  mov         ebp,esp  
00EE1963  sub         esp,100h  
00EE1969  push        ebx  
00EE196A  push        esi  
00EE196B  push        edi  
00EE196C  lea         edi,[ebp-40h]  
00EE196F  mov         ecx,10h  
00EE1974  mov         eax,0CCCCCCCCh  
00EE1979  rep stos    dword ptr es:[edi]  
00EE197B  mov         eax,dword ptr [__security_cookie (0EEA000h)]  
00EE1980  xor         eax,ebp  
00EE1982  mov         dword ptr [ebp-4],eax  
00EE1985  mov         ecx,offset _5ED659BE_CalOne@c (0EEC008h)  
00EE198A  call        @__CheckForDebuggerJustMyCode@4 (0EE1339h)  
00EE198F  nop  
	int opt;
	double num1, num2;
	double result = 0;
00EE1990  xorps       xmm0,xmm0  
00EE1993  movsd       mmword ptr [result],xmm0  

	printf("1.덧셈 2.뺄셈 3.곱셈 4.나눗셈 \n");
00EE1998  push        offset string "1.\xb5\xa1\xbc\xc0 2.\xbb\xac\xbc\xc0 3.\xb0\xf6\xbc\xc0 4.\xb3\xaa\xb4\xb0\xbc\xc0 \n" (0EE7B30h)  
00EE199D  call        _printf (0EE10DCh)  
00EE19A2  add         esp,4  
	printf("선택? ");
00EE19A5  push        offset string "\xbc\xb1\xc5\xc3? " (0EE7B58h)  
00EE19AA  call        _printf (0EE10DCh)  
00EE19AF  add         esp,4  
	scanf_s("%d", &opt);
00EE19B2  lea         eax,[opt]  
00EE19B5  push        eax  
00EE19B6  push        offset string "%d" (0EE7B60h)  
00EE19BB  call        _scanf_s (0EE1294h)  
00EE19C0  add         esp,8  

	printf("두 개의 실수 입력: ");
00EE19C3  push        offset string "\xb5\xce \xb0\xb3\xc0\xc7 \xbd\xc7\xbc\xf6 \xc0\xd4\xb7\xc2: " (0EE7B64h)  
00EE19C8  call        _printf (0EE10DCh)  
00EE19CD  add         esp,4  
	scanf_s("%lf %lf", &num1, &num2);
00EE19D0  lea         eax,[num2]  
00EE19D3  push        eax  
00EE19D4  lea         ecx,[num1]  
00EE19D7  push        ecx  
00EE19D8  push        offset string "%lf %lf" (0EE7B7Ch)  
00EE19DD  call        _scanf_s (0EE1294h)  
00EE19E2  add         esp,0Ch  

	if (opt == 1)
00EE19E5  cmp         dword ptr [opt],1  
00EE19E9  jne         __$EncStackInitStart+8Eh (0EE19FAh)  
		result = num1 + num2;
00EE19EB  movsd       xmm0,mmword ptr [num1]  
00EE19F0  addsd       xmm0,mmword ptr [num2]  
00EE19F5  movsd       mmword ptr [result],xmm0  

	if (opt == 2)
00EE19FA  cmp         dword ptr [opt],2  
00EE19FE  jne         __$EncStackInitStart+0A3h (0EE1A0Fh)  
		result = num1 - num2;
00EE1A00  movsd       xmm0,mmword ptr [num1]  
00EE1A05  subsd       xmm0,mmword ptr [num2]  
00EE1A0A  movsd       mmword ptr [result],xmm0  

	if (opt == 3)
00EE1A0F  cmp         dword ptr [opt],3  
00EE1A13  jne         __$EncStackInitStart+0B8h (0EE1A24h)  
		result = num1 * num2;
00EE1A15  movsd       xmm0,mmword ptr [num1]  
00EE1A1A  mulsd       xmm0,mmword ptr [num2]  
00EE1A1F  movsd       mmword ptr [result],xmm0  

	if (opt == 4)
00EE1A24  cmp         dword ptr [opt],4  
00EE1A28  jne         __$EncStackInitStart+0CDh (0EE1A39h)  
		result = num1 / num2;
00EE1A2A  movsd       xmm0,mmword ptr [num1]  
00EE1A2F  divsd       xmm0,mmword ptr [num2]  
00EE1A34  movsd       mmword ptr [result],xmm0  

	printf("결과 : %f\n", result);
00EE1A39  sub         esp,8  
00EE1A3C  movsd       xmm0,mmword ptr [result]  
00EE1A41  movsd       mmword ptr [esp],xmm0  
00EE1A46  push        offset string "\xb0\xe1\xb0\xfa : %f\n" (0EE7B88h)  
00EE1A4B  call        _printf (0EE10DCh)  
00EE1A50  add         esp,0Ch  

	return 0;
00EE1A53  xor         eax,eax  
}
00EE1A55  push        edx  
00EE1A56  mov         ecx,ebp  
00EE1A58  push        eax  
00EE1A59  lea         edx,ds:[0EE1A84h]  
00EE1A5F  call        @_RTC_CheckStackVars@8 (0EE11F4h)  
00EE1A64  pop         eax  
00EE1A65  pop         edx  
00EE1A66  pop         edi  
00EE1A67  pop         esi  
00EE1A68  pop         ebx  
00EE1A69  mov         ecx,dword ptr [ebp-4]  
00EE1A6C  xor         ecx,ebp  
00EE1A6E  call        @__security_check_cookie@4 (0EE1159h)  
00EE1A73  add         esp,100h  
00EE1A79  cmp         ebp,esp  
00EE1A7B  call        __RTC_CheckEsp (0EE1258h)  
00EE1A80  mov         esp,ebp  
00EE1A82  pop         ebp  
00EE1A83  ret

 

#include <stdio.h>

int main(void)
{
00007FF691841980  push        rbp  
00007FF691841982  push        rdi  
00007FF691841983  sub         rsp,168h  
00007FF69184198A  lea         rbp,[rsp+20h]  
00007FF69184198F  lea         rdi,[rsp+20h]  
00007FF691841994  mov         ecx,22h  
00007FF691841999  mov         eax,0CCCCCCCCh  
00007FF69184199E  rep stos    dword ptr [rdi]  
00007FF6918419A0  mov         rax,qword ptr [__security_cookie (07FF69184E000h)]  
00007FF6918419A7  xor         rax,rbp  
00007FF6918419AA  mov         qword ptr [rbp+138h],rax  
00007FF6918419B1  lea         rcx,[__5ED659BE_CalOne@c (07FF691853008h)]  
00007FF6918419B8  call        __CheckForDebuggerJustMyCode (07FF69184137Ah)  
00007FF6918419BD  nop  
	int opt;
	double num1, num2;
	double result = 0;
00007FF6918419BE  xorps       xmm0,xmm0  
00007FF6918419C1  movsd       mmword ptr [result],xmm0  

	printf("1.덧셈 2.뺄셈 3.곱셈 4.나눗셈 \n");
00007FF6918419C6  lea         rcx,[string "1.\xb5\xa1\xbc\xc0 2.\xbb\xac\xbc\xc0 3.\xb0\xf6\xbc\xc0 4.\xb3\xaa\xb4\xb0\xbc\xc0 \n" (07FF69184ADD0h)]  
00007FF6918419CD  call        printf (07FF69184119Ah)  
00007FF6918419D2  nop  
	printf("선택? ");
00007FF6918419D3  lea         rcx,[string "\xbc\xb1\xc5\xc3? " (07FF69184ADF8h)]  
00007FF6918419DA  call        printf (07FF69184119Ah)  
00007FF6918419DF  nop  
	scanf_s("%d", &opt);
00007FF6918419E0  lea         rdx,[opt]  
00007FF6918419E4  lea         rcx,[string "%d" (07FF69184AE00h)]  
00007FF6918419EB  call        scanf_s (07FF691841203h)  
00007FF6918419F0  nop  

	printf("두 개의 실수 입력: ");
00007FF6918419F1  lea         rcx,[string "\xb5\xce \xb0\xb3\xc0\xc7 \xbd\xc7\xbc\xf6 \xc0\xd4\xb7\xc2: " (07FF69184AE08h)]  
00007FF6918419F8  call        printf (07FF69184119Ah)  
00007FF6918419FD  nop  
	scanf_s("%lf %lf", &num1, &num2);
00007FF6918419FE  lea         r8,[num2]  
00007FF691841A02  lea         rdx,[num1]  
00007FF691841A06  lea         rcx,[string "%lf %lf" (07FF69184AE20h)]  
00007FF691841A0D  call        scanf_s (07FF691841203h)  
00007FF691841A12  nop  

	if (opt == 1)
00007FF691841A13  cmp         dword ptr [opt],1  
00007FF691841A17  jne         __$EncStackInitStart+99h (07FF691841A28h)  
		result = num1 + num2;
00007FF691841A19  movsd       xmm0,mmword ptr [num1]  
00007FF691841A1E  addsd       xmm0,mmword ptr [num2]  
00007FF691841A23  movsd       mmword ptr [result],xmm0  

	if (opt == 2)
00007FF691841A28  cmp         dword ptr [opt],2  
00007FF691841A2C  jne         __$EncStackInitStart+0AEh (07FF691841A3Dh)  
		result = num1 - num2;
00007FF691841A2E  movsd       xmm0,mmword ptr [num1]  
00007FF691841A33  subsd       xmm0,mmword ptr [num2]  
00007FF691841A38  movsd       mmword ptr [result],xmm0  

	if (opt == 3)
00007FF691841A3D  cmp         dword ptr [opt],3  
00007FF691841A41  jne         __$EncStackInitStart+0C3h (07FF691841A52h)  
		result = num1 * num2;
00007FF691841A43  movsd       xmm0,mmword ptr [num1]  
00007FF691841A48  mulsd       xmm0,mmword ptr [num2]  
00007FF691841A4D  movsd       mmword ptr [result],xmm0  

	if (opt == 4)
00007FF691841A52  cmp         dword ptr [opt],4  
00007FF691841A56  jne         __$EncStackInitStart+0D8h (07FF691841A67h)  
		result = num1 / num2;
00007FF691841A58  movsd       xmm0,mmword ptr [num1]  
00007FF691841A5D  divsd       xmm0,mmword ptr [num2]  
00007FF691841A62  movsd       mmword ptr [result],xmm0  

	printf("결과 : %f\n", result);
00007FF691841A67  movsd       xmm1,mmword ptr [result]  
00007FF691841A6C  movq        rdx,xmm1  
00007FF691841A71  lea         rcx,[string "\xb0\xe1\xb0\xfa : %f\n" (07FF69184AE30h)]  
00007FF691841A78  call        printf (07FF69184119Ah)  
00007FF691841A7D  nop  

	return 0;
00007FF691841A7E  xor         eax,eax  
}
00007FF691841A80  mov         edi,eax  
00007FF691841A82  lea         rcx,[rbp-20h]  
00007FF691841A86  lea         rdx,[__xt_z+2F0h (07FF69184AD90h)]  
00007FF691841A8D  call        _RTC_CheckStackVars (07FF691841316h)  
00007FF691841A92  mov         eax,edi  
00007FF691841A94  mov         rcx,qword ptr [rbp+138h]  
00007FF691841A9B  xor         rcx,rbp  
00007FF691841A9E  call        __security_check_cookie (07FF6918411B3h)  
00007FF691841AA3  lea         rsp,[rbp+148h]  
00007FF691841AAA  pop         rdi  
00007FF691841AAB  pop         rbp  
00007FF691841AAC  ret

 


 

#include <stdio.h>

int main(void)
{
00861870  push        ebp  
00861871  mov         ebp,esp  
00861873  sub         esp,0CCh  
00861879  push        ebx  
0086187A  push        esi  
0086187B  push        edi  
0086187C  lea         edi,[ebp-0Ch]  
0086187F  mov         ecx,3  
00861884  mov         eax,0CCCCCCCCh  
00861889  rep stos    dword ptr es:[edi]  
0086188B  mov         ecx,offset _CA56DC76_Mul3Mul4@c (086C008h)  
00861890  call        @__CheckForDebuggerJustMyCode@4 (086132Ah)  
00861895  nop  
	int num;
	for (num = 1; num < 100; num++)
00861896  mov         dword ptr [num],1  
0086189D  jmp         __$EncStackInitStart+2Ch (08618A8h)  
0086189F  mov         eax,dword ptr [num]  
008618A2  add         eax,1  
008618A5  mov         dword ptr [num],eax  
008618A8  cmp         dword ptr [num],64h  
008618AC  jge         __$EncStackInitStart+67h (08618E3h)  
	{
		if (num % 3 == 0 || num % 4 == 0)
008618AE  mov         eax,dword ptr [num]  
008618B1  cdq  
008618B2  mov         ecx,3  
008618B7  idiv        eax,ecx  
008618B9  test        edx,edx  
008618BB  je          __$EncStackInitStart+54h (08618D0h)  
008618BD  mov         eax,dword ptr [num]  
008618C0  and         eax,80000003h  
008618C5  jns         __$EncStackInitStart+50h (08618CCh)  
008618C7  dec         eax  
008618C8  or          eax,0FFFFFFFCh  
008618CB  inc         eax  
008618CC  test        eax,eax  
008618CE  jne         __$EncStackInitStart+65h (08618E1h)  
			printf("3 또는 4의 배수: %d\n", num);
008618D0  mov         eax,dword ptr [num]  
008618D3  push        eax  
008618D4  push        offset string "3 \xb6\xc7\xb4\xc2 4\xc0\xc7 \xb9\xe8\xbc\xf6: %d\n" (0867B30h)  
008618D9  call        _printf (08610D2h)  
008618DE  add         esp,8  
	}
008618E1  jmp         __$EncStackInitStart+23h (086189Fh)  

	return 0;
008618E3  xor         eax,eax  
}
008618E5  pop         edi  
008618E6  pop         esi  
008618E7  pop         ebx  
008618E8  add         esp,0CCh  
008618EE  cmp         ebp,esp  
008618F0  call        __RTC_CheckEsp (086124Eh)  
008618F5  mov         esp,ebp  
008618F7  pop         ebp  
008618F8  ret

 

* js 명령어(Jump if Sign)

   부호 비트가 1일 때,  즉 음수인 경우 점프

 

* jns 명령어(Jump if Not Sign)

   부호 비트가 0일 때, 즉 양수인 경우 점프

 

008618C0     and        eax,80000003h  
   008618C5      jns         $EncStackInitStart+50h (08618CCh)  
   008618C7     dec         eax  
   008618C8     or           eax,0FFFFFFFCh  
   008618CB     inc          eax  
   008618CC     test         eax,eax  

   - 이 부분은 num % 4 연산을 최적화하기 위해 사용된 어셈블리 코드

   - 컴파일러는 2의 거듭제곱 나눗셈(2, 4, 8 등)을 비트 연산으로 대체하여 최적화 수행

   - AND 연산은 나눗셈 연산보다 훨씬 빠름

 

* 80000003h 의미 => 비트 마스킹(Bit Masking) 방식

   - 1000 0000 0000 0000 0000 0000 0000 0011 형태

   - 하위 2비트를 추출하여 나머지 0, 1, 2, 3을 계산

   - 최상위 비트(부호 비트)는 음수 처리를 위해 사용

   (+) 만약에 8이라면 0x80000007h

         ㄴ 1000 0000 0000 0000 0000 0000 0000 0111 형태

 

#include <stdio.h>

int main(void)
{
00007FF765671890  push        rbp  
00007FF765671892  push        rdi  
00007FF765671893  sub         rsp,108h  
00007FF76567189A  lea         rbp,[rsp+20h]  
00007FF76567189F  lea         rcx,[__CA56DC76_Mul3Mul4@c (07FF765682008h)]  
00007FF7656718A6  call        __CheckForDebuggerJustMyCode (07FF76567136Bh)  
00007FF7656718AB  nop  
	int num;
	for (num = 1; num < 100; num++)
00007FF7656718AC  mov         dword ptr [num],1  
00007FF7656718B3  jmp         main+2Dh (07FF7656718BDh)  
00007FF7656718B5  mov         eax,dword ptr [num]  
00007FF7656718B8  inc         eax  
00007FF7656718BA  mov         dword ptr [num],eax  
00007FF7656718BD  cmp         dword ptr [num],64h  
00007FF7656718C1  jge         main+68h (07FF7656718F8h)  
	{
		if (num % 3 == 0 || num % 4 == 0)
00007FF7656718C3  mov         eax,dword ptr [num]  
00007FF7656718C6  cdq  
00007FF7656718C7  mov         ecx,3  
00007FF7656718CC  idiv        eax,ecx  
00007FF7656718CE  mov         eax,edx  
00007FF7656718D0  test        eax,eax  
00007FF7656718D2  je          main+56h (07FF7656718E6h)  
00007FF7656718D4  mov         eax,dword ptr [num]  
00007FF7656718D7  cdq  
00007FF7656718D8  and         edx,3  
00007FF7656718DB  add         eax,edx  
00007FF7656718DD  and         eax,3  
00007FF7656718E0  sub         eax,edx  
00007FF7656718E2  test        eax,eax  
00007FF7656718E4  jne         main+66h (07FF7656718F6h)  
			printf("3 또는 4의 배수: %d\n", num);
00007FF7656718E6  mov         edx,dword ptr [num]  
00007FF7656718E9  lea         rcx,[string "3 \xb6\xc7\xb4\xc2 4\xc0\xc7 \xb9\xe8\xbc\xf6: %d\n" (07FF76567AC28h)]  
00007FF7656718F0  call        printf (07FF765671195h)  
00007FF7656718F5  nop  
	}
00007FF7656718F6  jmp         main+25h (07FF7656718B5h)  

	return 0;
00007FF7656718F8  xor         eax,eax  
}
00007FF7656718FA  lea         rsp,[rbp+0E8h]  
00007FF765671901  pop         rdi  
00007FF765671902  pop         rbp  
00007FF765671903  ret

 

* 00007FF7656718D7     cdq  
   00007FF7656718D8    and         edx,3 
   00007FF7656718DB    add         eax,edx
   00007FF7656718DD    and         eax,3
   00007FF7656718E0     sub         eax,edx
   00007FF7656718E2     test         eax,eax

   - 이 부분은 num % 4 연산을 최적화하기 위해 사용된 어셈블리 코드
   - 컴파일러는 2의 거듭제곱 나눗셈(2, 4, 8 등)을 비트 연산으로 대체하여 최적화 수행
   - AND 연산은 나눗셈 연산보다 훨씬 빠름

 

* 명령어 cdq

   eax에 저장된 값을 부호 확장하여 edx:eax 레지스터 조합을 만듦

 

* 명령어 cdq는 나눗셈 연산(idiv)에서 피제수를 64비트로 확장하기 위해 사용

   이는 32비트 환경에서도 부호를 유지하며 상위 비트를 설정하기 위해 필요하다

   즉, 피제수가 크든 작든, 나눗셈이 항상 edx:eax 조합으로 작동하기 때문에 cdq는 필수적인 명령어이다

 

* idiv 명령어
   edx:eax를 ecx로 나눔
   ㄴ 몫은 eax에 저장
   ㄴ 나머지는 edx에 저장

 


 

#include <stdio.h>

int main(void)
{
00211960  push        ebp  
00211961  mov         ebp,esp  
00211963  sub         esp,100h  
00211969  push        ebx  
0021196A  push        esi  
0021196B  push        edi  
0021196C  lea         edi,[ebp-40h]  
0021196F  mov         ecx,10h  
00211974  mov         eax,0CCCCCCCCh  
00211979  rep stos    dword ptr es:[edi]  
0021197B  mov         eax,dword ptr [__security_cookie (021A000h)]  
00211980  xor         eax,ebp  
00211982  mov         dword ptr [ebp-4],eax  
00211985  mov         ecx,offset _696062EE_CalTwo@c (021C008h)  
0021198A  call        @__CheckForDebuggerJustMyCode@4 (0211339h)  
0021198F  nop  
	int opt;
	double num1, num2;
	double result = 0;
00211990  xorps       xmm0,xmm0  
00211993  movsd       mmword ptr [result],xmm0  

	printf("1.덧셈 2.뺄셈 3.곱셈 4.나눗셈 \n");
00211998  push        offset string "1.\xb5\xa1\xbc\xc0 2.\xbb\xac\xbc\xc0 3.\xb0\xf6\xbc\xc0 4.\xb3\xaa\xb4\xb0\xbc\xc0 \n" (0217B30h)  
0021199D  call        _printf (02110DCh)  
002119A2  add         esp,4  
	printf("선택? ");
002119A5  push        offset string "\xbc\xb1\xc5\xc3? " (0217B58h)  
002119AA  call        _printf (02110DCh)  
002119AF  add         esp,4  
	scanf_s("%d", &opt);
002119B2  lea         eax,[opt]  
002119B5  push        eax  
002119B6  push        offset string "%d" (0217B60h)  
002119BB  call        _scanf_s (0211294h)  
002119C0  add         esp,8  

	printf("두 개의 실수 입력: ");
002119C3  push        offset string "\xb5\xce \xb0\xb3\xc0\xc7 \xbd\xc7\xbc\xf6 \xc0\xd4\xb7\xc2: " (0217B64h)  
002119C8  call        _printf (02110DCh)  
002119CD  add         esp,4  
	scanf_s("%lf %lf", &num1, &num2);
002119D0  lea         eax,[num2]  
002119D3  push        eax  
002119D4  lea         ecx,[num1]  
002119D7  push        ecx  
002119D8  push        offset string "%lf %lf" (0217B7Ch)  
002119DD  call        _scanf_s (0211294h)  
002119E2  add         esp,0Ch  

	if (opt == 1)
002119E5  cmp         dword ptr [opt],1  
002119E9  jne         __$EncStackInitStart+90h (02119FCh)  
		result = num1 + num2;
002119EB  movsd       xmm0,mmword ptr [num1]  
002119F0  addsd       xmm0,mmword ptr [num2]  
002119F5  movsd       mmword ptr [result],xmm0  
002119FA  jmp         __$EncStackInitStart+0D3h (0211A3Fh)  

	else if (opt == 2)
002119FC  cmp         dword ptr [opt],2  
00211A00  jne         __$EncStackInitStart+0A7h (0211A13h)  
		result = num1 - num2;
00211A02  movsd       xmm0,mmword ptr [num1]  
00211A07  subsd       xmm0,mmword ptr [num2]  
00211A0C  movsd       mmword ptr [result],xmm0  
00211A11  jmp         __$EncStackInitStart+0D3h (0211A3Fh)  

	else if (opt == 3)
00211A13  cmp         dword ptr [opt],3  
00211A17  jne         __$EncStackInitStart+0BEh (0211A2Ah)  
		result = num1 * num2;
00211A19  movsd       xmm0,mmword ptr [num1]  
00211A1E  mulsd       xmm0,mmword ptr [num2]  
00211A23  movsd       mmword ptr [result],xmm0  
00211A28  jmp         __$EncStackInitStart+0D3h (0211A3Fh)  

	else if (opt == 4)
00211A2A  cmp         dword ptr [opt],4  
00211A2E  jne         __$EncStackInitStart+0D3h (0211A3Fh)  
		result = num1 / num2;
00211A30  movsd       xmm0,mmword ptr [num1]  
00211A35  divsd       xmm0,mmword ptr [num2]  
00211A3A  movsd       mmword ptr [result],xmm0  

	printf("결과 : %f\n", result);
00211A3F  sub         esp,8  
00211A42  movsd       xmm0,mmword ptr [result]  
00211A47  movsd       mmword ptr [esp],xmm0  
00211A4C  push        offset string "\xb0\xe1\xb0\xfa : %f\n" (0217B88h)  
00211A51  call        _printf (02110DCh)  
00211A56  add         esp,0Ch  

	return 0;
00211A59  xor         eax,eax  
}
00211A5B  push        edx  
00211A5C  mov         ecx,ebp  
00211A5E  push        eax  
00211A5F  lea         edx,ds:[211A8Ch]  
00211A65  call        @_RTC_CheckStackVars@8 (02111F4h)  
00211A6A  pop         eax  
00211A6B  pop         edx  
00211A6C  pop         edi  
00211A6D  pop         esi  
00211A6E  pop         ebx  
00211A6F  mov         ecx,dword ptr [ebp-4]  
00211A72  xor         ecx,ebp  
00211A74  call        @__security_check_cookie@4 (0211159h)  
00211A79  add         esp,100h  
00211A7F  cmp         ebp,esp  
00211A81  call        __RTC_CheckEsp (0211258h)  
00211A86  mov         esp,ebp  
00211A88  pop         ebp  
00211A89  ret

 


 

#include <stdio.h>

int main(void)
{
00C71960  push        ebp  
00C71961  mov         ebp,esp  
00C71963  sub         esp,0E0h  
00C71969  push        ebx  
00C7196A  push        esi  
00C7196B  push        edi  
00C7196C  lea         edi,[ebp-20h]  
00C7196F  mov         ecx,8  
00C71974  mov         eax,0CCCCCCCCh  
00C71979  rep stos    dword ptr es:[edi]  
00C7197B  mov         eax,dword ptr [__security_cookie (0C7A000h)]  
00C71980  xor         eax,ebp  
00C71982  mov         dword ptr [ebp-4],eax  
00C71985  mov         ecx,offset _104E4084_ThreeOperand@c (0C7C008h)  
00C7198A  call        @__CheckForDebuggerJustMyCode@4 (0C71339h)  
00C7198F  nop  
	int num, abs;
	printf("정수 입력 : ");
00C71990  push        offset string "\xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2 : " (0C77B30h)  
00C71995  call        _printf (0C710DCh)  
00C7199A  add         esp,4  
	scanf_s("%d", &num);
00C7199D  lea         eax,[num]  
00C719A0  push        eax  
00C719A1  push        offset string "%d" (0C77B40h)  
00C719A6  call        _scanf_s (0C71294h)  
00C719AB  add         esp,8  

	abs = num > 0 ? num : num * (-1);
00C719AE  cmp         dword ptr [num],0  
00C719B2  jle         __$EncStackInitStart+53h (0C719BFh)  
00C719B4  mov         eax,dword ptr [num]  
00C719B7  mov         dword ptr [ebp-0E0h],eax  
00C719BD  jmp         __$EncStackInitStart+5Dh (0C719C9h)  
00C719BF  imul        ecx,dword ptr [num],0FFFFFFFFh  
00C719C3  mov         dword ptr [ebp-0E0h],ecx  
00C719C9  mov         edx,dword ptr [ebp-0E0h]  
00C719CF  mov         dword ptr [abs],edx  
	printf("절대값 : %d", abs);
00C719D2  mov         eax,dword ptr [abs]  
00C719D5  push        eax  
00C719D6  push        offset string "\xc0\xfd\xb4\xeb\xb0\xaa : %d" (0C77B44h)  
00C719DB  call        _printf (0C710DCh)  
00C719E0  add         esp,8  

	return 0;
00C719E3  xor         eax,eax  
}
00C719E5  push        edx  
00C719E6  mov         ecx,ebp  
00C719E8  push        eax  
00C719E9  lea         edx,ds:[0C71A14h]  
00C719EF  call        @_RTC_CheckStackVars@8 (0C711F4h)  
00C719F4  pop         eax  
00C719F5  pop         edx  
00C719F6  pop         edi  
00C719F7  pop         esi  
00C719F8  pop         ebx  
00C719F9  mov         ecx,dword ptr [ebp-4]  
00C719FC  xor         ecx,ebp  
00C719FE  call        @__security_check_cookie@4 (0C71159h)  
00C71A03  add         esp,0E0h  
00C71A09  cmp         ebp,esp  
00C71A0B  call        __RTC_CheckEsp (0C71258h)  
00C71A10  mov         esp,ebp  
00C71A12  pop         ebp  
00C71A13  ret

 


 

#include <stdio.h>

int main(void)
{
00271870  push        ebp  
00271871  mov         ebp,esp  
00271873  sub         esp,0D8h  
00271879  push        ebx  
0027187A  push        esi  
0027187B  push        edi  
0027187C  lea         edi,[ebp-18h]  
0027187F  mov         ecx,6  
00271884  mov         eax,0CCCCCCCCh  
00271889  rep stos    dword ptr es:[edi]  
0027188B  mov         ecx,offset _2C08BCA5_WhenOver5000@c (027C008h)  
00271890  call        @__CheckForDebuggerJustMyCode@4 (027132Ah)  
00271895  nop  
	int sum = 0, num = 0;
00271896  mov         dword ptr [sum],0  
0027189D  mov         dword ptr [num],0  

	while (1)
002718A4  mov         eax,1  
002718A9  test        eax,eax  
002718AB  je          __$EncStackInitStart+50h (02718CCh)  
	{
		sum += num;
002718AD  mov         eax,dword ptr [sum]  
002718B0  add         eax,dword ptr [num]  
002718B3  mov         dword ptr [sum],eax  
		if (sum > 5000)
002718B6  cmp         dword ptr [sum],1388h  
002718BD  jle         __$EncStackInitStart+45h (02718C1h)  
			break;
002718BF  jmp         __$EncStackInitStart+50h (02718CCh)  
		num++;
002718C1  mov         eax,dword ptr [num]  
002718C4  add         eax,1  
002718C7  mov         dword ptr [num],eax  
	}
002718CA  jmp         __$EncStackInitStart+28h (02718A4h)  

	printf("sum : %d\n", sum);
002718CC  mov         eax,dword ptr [sum]  
002718CF  push        eax  
002718D0  push        offset string "sum : %d\n" (0277B30h)  
002718D5  call        _printf (02710D2h)  
002718DA  add         esp,8  
	printf("num : %d\n", num);
002718DD  mov         eax,dword ptr [num]  
002718E0  push        eax  
002718E1  push        offset string "num : %d\n" (0277B3Ch)  
002718E6  call        _printf (02710D2h)  
002718EB  add         esp,8  

	return 0;
002718EE  xor         eax,eax  
}
002718F0  pop         edi  
002718F1  pop         esi  
002718F2  pop         ebx  
002718F3  add         esp,0D8h  
002718F9  cmp         ebp,esp  
002718FB  call        __RTC_CheckEsp (027124Eh)  
00271900  mov         esp,ebp  
00271902  pop         ebp  
00271903  ret

 


 

#include <stdio.h>

int main(void)
{
000B1870  push        ebp  
000B1871  mov         ebp,esp  
000B1873  sub         esp,0D8h  
000B1879  push        ebx  
000B187A  push        esi  
000B187B  push        edi  
000B187C  lea         edi,[ebp-18h]  
000B187F  mov         ecx,6  
000B1884  mov         eax,0CCCCCCCCh  
000B1889  rep stos    dword ptr es:[edi]  
000B188B  mov         ecx,offset _2C08BCA5_WhenOver5000@c (0BC008h)  
000B1890  call        @__CheckForDebuggerJustMyCode@4 (0B132Ah)  
000B1895  nop  
	int sum = 0, num = 0;
000B1896  mov         dword ptr [sum],0  
000B189D  mov         dword ptr [num],0  

	for (;;)
	{
		sum += num;
000B18A4  mov         eax,dword ptr [sum]  
000B18A7  add         eax,dword ptr [num]  
000B18AA  mov         dword ptr [sum],eax  
		if (sum > 5000)
000B18AD  cmp         dword ptr [sum],1388h  
000B18B4  jle         __$EncStackInitStart+3Ch (0B18B8h)  
			break;
000B18B6  jmp         __$EncStackInitStart+47h (0B18C3h)  
		num++;
000B18B8  mov         eax,dword ptr [num]  
000B18BB  add         eax,1  
000B18BE  mov         dword ptr [num],eax  
	}
000B18C1  jmp         __$EncStackInitStart+28h (0B18A4h)  

	printf("sum : %d\n", sum);
000B18C3  mov         eax,dword ptr [sum]  
000B18C6  push        eax  
000B18C7  push        offset string "sum : %d\n" (0B7B30h)  
000B18CC  call        _printf (0B10D2h)  
000B18D1  add         esp,8  
	printf("num : %d\n", num);
000B18D4  mov         eax,dword ptr [num]  
000B18D7  push        eax  
000B18D8  push        offset string "num : %d\n" (0B7B3Ch)  
000B18DD  call        _printf (0B10D2h)  
000B18E2  add         esp,8  

	return 0;
000B18E5  xor         eax,eax  
}
000B18E7  pop         edi  
000B18E8  pop         esi  
000B18E9  pop         ebx  
000B18EA  add         esp,0D8h  
000B18F0  cmp         ebp,esp  
000B18F2  call        __RTC_CheckEsp (0B124Eh)  
000B18F7  mov         esp,ebp  
000B18F9  pop         ebp  
000B18FA  ret

 

* 무한루프 while(1), for(;;) 차이

 


 

#include <stdio.h>

int main(void)
{
00981870  push        ebp  
00981871  mov         ebp,esp  
00981873  sub         esp,0CCh  
00981879  push        ebx  
0098187A  push        esi  
0098187B  push        edi  
0098187C  lea         edi,[ebp-0Ch]  
0098187F  mov         ecx,3  
00981884  mov         eax,0CCCCCCCCh  
00981889  rep stos    dword ptr es:[edi]  
0098188B  mov         ecx,offset _553762D7_ExceptMul2Mul3@c (098C008h)  
00981890  call        @__CheckForDebuggerJustMyCode@4 (098132Ah)  
00981895  nop  
	int num;
	printf("start!");
00981896  push        offset string "start!" (0987B30h)  
0098189B  call        _printf (09810D2h)  
009818A0  add         esp,4  

	for (num = 1; num < 20; num++)
009818A3  mov         dword ptr [num],1  
009818AA  jmp         __$EncStackInitStart+39h (09818B5h)  
009818AC  mov         eax,dword ptr [num]  
009818AF  add         eax,1  
009818B2  mov         dword ptr [num],eax  
009818B5  cmp         dword ptr [num],14h  
009818B9  jge         __$EncStackInitStart+76h (09818F2h)  
	{
		if (num % 2 == 0 || num % 3 == 0)
009818BB  mov         eax,dword ptr [num]  
009818BE  and         eax,80000001h  
009818C3  jns         __$EncStackInitStart+4Eh (09818CAh)  
009818C5  dec         eax  
009818C6  or          eax,0FFFFFFFEh  
009818C9  inc         eax  
009818CA  test        eax,eax  
009818CC  je          __$EncStackInitStart+61h (09818DDh)  
009818CE  mov         eax,dword ptr [num]  
009818D1  cdq  
009818D2  mov         ecx,3  
009818D7  idiv        eax,ecx  
009818D9  test        edx,edx  
009818DB  jne         __$EncStackInitStart+63h (09818DFh)  
			continue;
009818DD  jmp         __$EncStackInitStart+30h (09818ACh)  
		printf("%d ", num);
009818DF  mov         eax,dword ptr [num]  
009818E2  push        eax  
009818E3  push        offset string "%d " (0987B38h)  
009818E8  call        _printf (09810D2h)  
009818ED  add         esp,8  
	}
009818F0  jmp         __$EncStackInitStart+30h (09818ACh)  

	printf("end! \n");
009818F2  push        offset string "end! \n" (0987B3Ch)  
009818F7  call        _printf (09810D2h)  
009818FC  add         esp,4  

	return 0;
009818FF  xor         eax,eax  
}
00981901  pop         edi  
00981902  pop         esi  
00981903  pop         ebx  
00981904  add         esp,0CCh  
0098190A  cmp         ebp,esp  
0098190C  call        __RTC_CheckEsp (098124Eh)  
00981911  mov         esp,ebp  
00981913  pop         ebp  
00981914  ret

 

* 오버플로우

   - sign 기준 (signed char 기준)

      ① 최소값 : -128 - 1 = +127

           0b   1000 0000

           0b   1111 1111

        --------------------------

           0b 1 0111 1111

      ② 최대값 : +127 + 1 = -128

           0b   0111 1111

           0b   1111 1111

        --------------------------

           0b   1111 1111

   - unsign 기준 (unsigned char 기준)

      ① 최소값 : 0 - 1 = +255

           0b   0000 0000

           0b   1111 1111

        --------------------------

           0b   1111 1111

      ② 양수 최고값 : +255 + 1 = 0

           0b    1111 1111

           0b    1111 1111

        --------------------------

           0b 1 0000 0000

 

#include <iostream>
using namespace std;

int main(void)
{
	char a = -128;
	printf("%d\n", a);

	a = a - 1;
	printf("최소값 - 1 : %d\n", a);

	a = 127;
	a = a + 1;
	printf("최대값 + 1 : %d\n", a);

	unsigned char b = 0;
	printf("%d\n", b);

	b = b - 1;
	printf("최소값 - 1 : %d\n", b);

	b = 255;
	b = b + 1;
	printf("최대값 + 1 : %d\n", b);

	return 0;
}

 

 


 

#include <stdio.h>

int main(void)
{
007D1960  push        ebp  
007D1961  mov         ebp,esp  
007D1963  sub         esp,0D4h  
007D1969  push        ebx  
007D196A  push        esi  
007D196B  push        edi  
007D196C  lea         edi,[ebp-14h]  
007D196F  mov         ecx,5  
007D1974  mov         eax,0CCCCCCCCh  
007D1979  rep stos    dword ptr es:[edi]  
007D197B  mov         eax,dword ptr [__security_cookie (07DA000h)]  
007D1980  xor         eax,ebp  
007D1982  mov         dword ptr [ebp-4],eax  
007D1985  mov         ecx,offset _19C553D5_EnglishSchool@c (07DC008h)  
007D198A  call        @__CheckForDebuggerJustMyCode@4 (07D1339h)  
007D198F  nop  
	int num;
	printf("1이상 5이하의 정수 입력: ");
007D1990  push        offset string "1\xc0\xcc\xbb\xf3 5\xc0\xcc\xc7\xcf\xc0\xc7 \xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2: " (07D7B30h)  
007D1995  call        _printf (07D10DCh)  
007D199A  add         esp,4  
	scanf_s("%d", &num);
007D199D  lea         eax,[num]  
007D19A0  push        eax  
007D19A1  push        offset string "%d" (07D7B50h)  
007D19A6  call        _scanf_s (07D1294h)  
007D19AB  add         esp,8  

	switch (num)
007D19AE  mov         eax,dword ptr [num]  
007D19B1  mov         dword ptr [ebp-0D4h],eax  
007D19B7  mov         ecx,dword ptr [ebp-0D4h]  
007D19BD  sub         ecx,1  
007D19C0  mov         dword ptr [ebp-0D4h],ecx  
007D19C6  cmp         dword ptr [ebp-0D4h],4  
007D19CD  ja          $LN8+0Fh (07D1A27h)  
007D19CF  mov         edx,dword ptr [ebp-0D4h]  
007D19D5  jmp         dword ptr [edx*4+7D1A80h]  
	{
	case 1:
		printf("1 One\n");
007D19DC  push        offset string "1 One\n" (07D7B54h)  
007D19E1  call        _printf (07D10DCh)  
007D19E6  add         esp,4  
		break;
007D19E9  jmp         $LN8+1Ch (07D1A34h)  
	case 2:
		printf("2 Two\n");
007D19EB  push        offset string "2 Two\n" (07D7B5Ch)  
007D19F0  call        _printf (07D10DCh)  
007D19F5  add         esp,4  
		break;
007D19F8  jmp         $LN8+1Ch (07D1A34h)  
	case 3:
		printf("3 Three\n");
007D19FA  push        offset string "3 Three\n" (07D7B64h)  
007D19FF  call        _printf (07D10DCh)  
007D1A04  add         esp,4  
		break;
007D1A07  jmp         $LN8+1Ch (07D1A34h)  
	case 4:
		printf("4 Four\n");
007D1A09  push        offset string "4 Four\n" (07D7B70h)  
007D1A0E  call        _printf (07D10DCh)  
007D1A13  add         esp,4  
		break;
007D1A16  jmp         $LN8+1Ch (07D1A34h)  
	case 5:
		printf("5 Five\n");
007D1A18  push        offset string "5 Five\n" (07D7B7Ch)  
007D1A1D  call        _printf (07D10DCh)  
007D1A22  add         esp,4  
		break;
007D1A25  jmp         $LN8+1Ch (07D1A34h)  
	default:
		printf("I don't know!\n");
007D1A27  push        offset string "I don't know!\n" (07D7B88h)  
007D1A2C  call        _printf (07D10DCh)  
007D1A31  add         esp,4  
	}

	return 0;
007D1A34  xor         eax,eax  
}
007D1A36  push        edx  
007D1A37  mov         ecx,ebp  
007D1A39  push        eax  
007D1A3A  lea         edx,ds:[7D1A68h]  
007D1A40  call        @_RTC_CheckStackVars@8 (07D11F4h)  
007D1A45  pop         eax  
007D1A46  pop         edx  
007D1A47  pop         edi  
007D1A48  pop         esi  
007D1A49  pop         ebx  
007D1A4A  mov         ecx,dword ptr [ebp-4]  
007D1A4D  xor         ecx,ebp  
007D1A4F  call        @__security_check_cookie@4 (07D1159h)  
007D1A54  add         esp,0D4h  
007D1A5A  cmp         ebp,esp  
007D1A5C  call        __RTC_CheckEsp (07D1258h)  
007D1A61  mov         esp,ebp  
007D1A63  pop         ebp  
007D1A64  ret

 

 

#include <stdio.h>

int main(void)
{
00007FF705D51980  push        rbp  
00007FF705D51982  push        rdi  
00007FF705D51983  sub         rsp,108h  
00007FF705D5198A  lea         rbp,[rsp+20h]  
00007FF705D5198F  lea         rdi,[rsp+20h]  
00007FF705D51994  mov         ecx,0Ah  
00007FF705D51999  mov         eax,0CCCCCCCCh  
00007FF705D5199E  rep stos    dword ptr [rdi]  
00007FF705D519A0  mov         rax,qword ptr [__security_cookie (07FF705D5D000h)]  
00007FF705D519A7  xor         rax,rbp  
00007FF705D519AA  mov         qword ptr [rbp+0D8h],rax  
00007FF705D519B1  lea         rcx,[__19C553D5_EnglishSchool@c (07FF705D62008h)]  
00007FF705D519B8  call        __CheckForDebuggerJustMyCode (07FF705D5137Ah)  
00007FF705D519BD  nop  
	int num;
	printf("1이상 5이하의 정수 입력: ");
00007FF705D519BE  lea         rcx,[string "1\xc0\xcc\xbb\xf3 5\xc0\xcc\xc7\xcf\xc0\xc7 \xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2: " (07FF705D5AD28h)]  
00007FF705D519C5  call        printf (07FF705D5119Ah)  
00007FF705D519CA  nop  
	scanf_s("%d", &num);
00007FF705D519CB  lea         rdx,[num]  
00007FF705D519CF  lea         rcx,[string "%d" (07FF705D5AD48h)]  
00007FF705D519D6  call        scanf_s (07FF705D51203h)  
00007FF705D519DB  nop  

	switch (num)
00007FF705D519DC  mov         eax,dword ptr [num]  
00007FF705D519DF  mov         dword ptr [rbp+0D4h],eax  
00007FF705D519E5  cmp         dword ptr [rbp+0D4h],1  
00007FF705D519EC  je          __$EncStackInitStart+85h (07FF705D51A14h)  
00007FF705D519EE  cmp         dword ptr [rbp+0D4h],2  
00007FF705D519F5  je          __$EncStackInitStart+94h (07FF705D51A23h)  
00007FF705D519F7  cmp         dword ptr [rbp+0D4h],3  
00007FF705D519FE  je          __$EncStackInitStart+0A3h (07FF705D51A32h)  
00007FF705D51A00  cmp         dword ptr [rbp+0D4h],4  
00007FF705D51A07  je          __$EncStackInitStart+0B2h (07FF705D51A41h)  
00007FF705D51A09  cmp         dword ptr [rbp+0D4h],5  
00007FF705D51A10  je          __$EncStackInitStart+0C1h (07FF705D51A50h)  
00007FF705D51A12  jmp         __$EncStackInitStart+0D0h (07FF705D51A5Fh)  
	{
	case 1:
		printf("1 One\n");
00007FF705D51A14  lea         rcx,[string "1 One\n" (07FF705D5AD4Ch)]  
00007FF705D51A1B  call        printf (07FF705D5119Ah)  
00007FF705D51A20  nop  
		break;
00007FF705D51A21  jmp         __$EncStackInitStart+0DDh (07FF705D51A6Ch)  
	case 2:
		printf("2 Two\n");
00007FF705D51A23  lea         rcx,[string "2 Two\n" (07FF705D5AD54h)]  
00007FF705D51A2A  call        printf (07FF705D5119Ah)  
00007FF705D51A2F  nop  
		break;
00007FF705D51A30  jmp         __$EncStackInitStart+0DDh (07FF705D51A6Ch)  
	case 3:
		printf("3 Three\n");
00007FF705D51A32  lea         rcx,[string "3 Three\n" (07FF705D5AD60h)]  
00007FF705D51A39  call        printf (07FF705D5119Ah)  
00007FF705D51A3E  nop  
		break;
00007FF705D51A3F  jmp         __$EncStackInitStart+0DDh (07FF705D51A6Ch)  
	case 4:
		printf("4 Four\n");
00007FF705D51A41  lea         rcx,[string "4 Four\n" (07FF705D5AD70h)]  
00007FF705D51A48  call        printf (07FF705D5119Ah)  
00007FF705D51A4D  nop  
		break;
00007FF705D51A4E  jmp         __$EncStackInitStart+0DDh (07FF705D51A6Ch)  
	case 5:
		printf("5 Five\n");
00007FF705D51A50  lea         rcx,[string "5 Five\n" (07FF705D5AD80h)]  
00007FF705D51A57  call        printf (07FF705D5119Ah)  
00007FF705D51A5C  nop  
		break;
00007FF705D51A5D  jmp         __$EncStackInitStart+0DDh (07FF705D51A6Ch)  
	default:
		printf("I don't know!\n");
00007FF705D51A5F  lea         rcx,[string "I don't know!\n" (07FF705D5AD90h)]  
00007FF705D51A66  call        printf (07FF705D5119Ah)  
00007FF705D51A6B  nop  
	}

	return 0;
00007FF705D51A6C  xor         eax,eax  
}
00007FF705D51A6E  mov         edi,eax  
00007FF705D51A70  lea         rcx,[rbp-20h]  
00007FF705D51A74  lea         rdx,[__xt_z+260h (07FF705D5AD00h)]  
00007FF705D51A7B  call        _RTC_CheckStackVars (07FF705D51316h)  
00007FF705D51A80  mov         eax,edi  
00007FF705D51A82  mov         rcx,qword ptr [rbp+0D8h]  
00007FF705D51A89  xor         rcx,rbp  
00007FF705D51A8C  call        __security_check_cookie (07FF705D511B3h)  
00007FF705D51A91  lea         rsp,[rbp+0E8h]  
00007FF705D51A98  pop         rdi  
00007FF705D51A99  pop         rbp  
00007FF705D51A9A  ret

 

* 32비트에서는 Jump Table이 생겼는데, 64비트에서는 Jump Table이 안생김

   혹시나 기준 개수에 따른 차이인가 싶어서 case문을 한 개 추가하니 Jump Table이 생겼음

   ㄴ Jump Table 생기는 기준 : 32비트는 4개, 64비트는 6개

 

#include <stdio.h>

int main(void)
{
00007FF6E4161960  push        rbp  
00007FF6E4161962  push        rdi  
00007FF6E4161963  sub         rsp,108h  
00007FF6E416196A  lea         rbp,[rsp+20h]  
00007FF6E416196F  lea         rdi,[rsp+20h]  
00007FF6E4161974  mov         ecx,0Ah  
00007FF6E4161979  mov         eax,0CCCCCCCCh  
00007FF6E416197E  rep stos    dword ptr [rdi]  
00007FF6E4161980  mov         rax,qword ptr [__security_cookie (07FF6E416D000h)]  
00007FF6E4161987  xor         rax,rbp  
00007FF6E416198A  mov         qword ptr [rbp+0D8h],rax  
00007FF6E4161991  lea         rcx,[__19C553D5_EnglishSchool@c (07FF6E4172008h)]  
00007FF6E4161998  call        __CheckForDebuggerJustMyCode (07FF6E416137Ah)  
00007FF6E416199D  nop  
	int num;
	printf("1이상 5이하의 정수 입력: ");
00007FF6E416199E  lea         rcx,[string "1\xc0\xcc\xbb\xf3 5\xc0\xcc\xc7\xcf\xc0\xc7 \xc1\xa4\xbc\xf6 \xc0\xd4\xb7\xc2: " (07FF6E416AD28h)]  
00007FF6E41619A5  call        printf (07FF6E416119Ah)  
00007FF6E41619AA  nop  
	scanf_s("%d", &num);
00007FF6E41619AB  lea         rdx,[num]  
00007FF6E41619AF  lea         rcx,[string "%d" (07FF6E416AD48h)]  
00007FF6E41619B6  call        scanf_s (07FF6E4161203h)  
00007FF6E41619BB  nop  

	switch (num)
00007FF6E41619BC  mov         eax,dword ptr [num]  
00007FF6E41619BF  mov         dword ptr [rbp+0D4h],eax  
00007FF6E41619C5  mov         eax,dword ptr [rbp+0D4h]  
00007FF6E41619CB  dec         eax  
00007FF6E41619CD  mov         dword ptr [rbp+0D4h],eax  
00007FF6E41619D3  cmp         dword ptr [rbp+0D4h],5  
00007FF6E41619DA  ja          $LN9+0Fh (07FF6E4161A50h)  
00007FF6E41619DC  movsxd      rax,dword ptr [rbp+0D4h]  
00007FF6E41619E3  lea         rcx,[__ImageBase (07FF6E4150000h)]  
00007FF6E41619EA  mov         eax,dword ptr [rcx+rax*4+11A8Ch]  
00007FF6E41619F1  add         rax,rcx  
00007FF6E41619F4  jmp         rax  
	{
	case 1:
		printf("1 One\n");
00007FF6E41619F6  lea         rcx,[string "1 One\n" (07FF6E416AD4Ch)]  
00007FF6E41619FD  call        printf (07FF6E416119Ah)  
00007FF6E4161A02  nop  
		break;
00007FF6E4161A03  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	case 2:
		printf("2 Two\n");
00007FF6E4161A05  lea         rcx,[string "2 Two\n" (07FF6E416AD54h)]  
00007FF6E4161A0C  call        printf (07FF6E416119Ah)  
00007FF6E4161A11  nop  
		break;
00007FF6E4161A12  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	case 3:
		printf("3 Three\n");
00007FF6E4161A14  lea         rcx,[string "3 Three\n" (07FF6E416AD60h)]  
00007FF6E4161A1B  call        printf (07FF6E416119Ah)  
00007FF6E4161A20  nop  
		break;
00007FF6E4161A21  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	case 4:
		printf("4 Four\n");
00007FF6E4161A23  lea         rcx,[string "4 Four\n" (07FF6E416AD70h)]  
00007FF6E4161A2A  call        printf (07FF6E416119Ah)  
00007FF6E4161A2F  nop  
		break;
00007FF6E4161A30  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	case 5:
		printf("5 Five\n");
00007FF6E4161A32  lea         rcx,[string "5 Five\n" (07FF6E416AD80h)]  
00007FF6E4161A39  call        printf (07FF6E416119Ah)  
00007FF6E4161A3E  nop  
		break;
00007FF6E4161A3F  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	case 6:
		printf("5 Five\n");
00007FF6E4161A41  lea         rcx,[string "5 Five\n" (07FF6E416AD80h)]  
00007FF6E4161A48  call        printf (07FF6E416119Ah)  
00007FF6E4161A4D  nop  
		break;
00007FF6E4161A4E  jmp         $LN9+1Ch (07FF6E4161A5Dh)  
	default:
		printf("I don't know!\n");
00007FF6E4161A50  lea         rcx,[string "I don't know!\n" (07FF6E416AD90h)]  
00007FF6E4161A57  call        printf (07FF6E416119Ah)  
00007FF6E4161A5C  nop  
	}

	return 0;
00007FF6E4161A5D  xor         eax,eax  
}
00007FF6E4161A5F  mov         edi,eax  
00007FF6E4161A61  lea         rcx,[rbp-20h]  
00007FF6E4161A65  lea         rdx,[__xt_z+260h (07FF6E416AD00h)]  
00007FF6E4161A6C  call        _RTC_CheckStackVars (07FF6E4161316h)  
00007FF6E4161A71  mov         eax,edi  
00007FF6E4161A73  mov         rcx,qword ptr [rbp+0D8h]  
00007FF6E4161A7A  xor         rcx,rbp  
00007FF6E4161A7D  call        __security_check_cookie (07FF6E41611B3h)  
00007FF6E4161A82  lea         rsp,[rbp+0E8h]  
00007FF6E4161A89  pop         rdi  
00007FF6E4161A8A  pop         rbp  
00007FF6E4161A8B  ret

 

 


 

#include <stdio.h>

int main(void)
{
00E71960  push        ebp  
00E71961  mov         ebp,esp  
00E71963  sub         esp,0D4h  
00E71969  push        ebx  
00E7196A  push        esi  
00E7196B  push        edi  
00E7196C  lea         edi,[ebp-14h]  
00E7196F  mov         ecx,5  
00E71974  mov         eax,0CCCCCCCCh  
00E71979  rep stos    dword ptr es:[edi]  
00E7197B  mov         eax,dword ptr [__security_cookie (0E7A000h)]  
00E71980  xor         eax,ebp  
00E71982  mov         dword ptr [ebp-4],eax  
00E71985  mov         ecx,offset _4791B0BF_AdvanEnglishSchool@c (0E7C008h)  
00E7198A  call        @__CheckForDebuggerJustMyCode@4 (0E71339h)  
00E7198F  nop  
	char sel;
	printf("M 오전, A 오후, E 저녁\n");
00E71990  push        offset string "M \xbf\xc0\xc0\xfc, A \xbf\xc0\xc8\xc4, E \xc0\xfa\xb3\xe1\n" (0E77B30h)  
00E71995  call        _printf (0E710DCh)  
00E7199A  add         esp,4  
	printf("입력 : ");
00E7199D  push        offset string "\xc0\xd4\xb7\xc2 : " (0E77B4Ch)  
00E719A2  call        _printf (0E710DCh)  
00E719A7  add         esp,4  
	scanf_s("%c", &sel, 1);
00E719AA  push        1  
00E719AC  lea         eax,[sel]  
00E719AF  push        eax  
00E719B0  push        offset string "%c" (0E77B58h)  
00E719B5  call        _scanf_s (0E71294h)  
00E719BA  add         esp,0Ch  

	switch (sel)
00E719BD  movsx       eax,byte ptr [sel]  
00E719C1  mov         dword ptr [ebp-0D4h],eax  
00E719C7  mov         ecx,dword ptr [ebp-0D4h]  
00E719CD  sub         ecx,41h  
00E719D0  mov         dword ptr [ebp-0D4h],ecx  
00E719D6  cmp         dword ptr [ebp-0D4h],2Ch  
00E719DD  ja          $LN8+0Dh (0E71A1Eh)  
00E719DF  mov         edx,dword ptr [ebp-0D4h]  
00E719E5  movzx       eax,byte ptr [edx+0E71A78h]  
00E719EC  jmp         dword ptr [eax*4+0E71A68h]  
	{
	case 'M':
	case 'm':
		printf("Morning!\n");
00E719F3  push        offset string "Morning!\n" (0E77B5Ch)  
00E719F8  call        _printf (0E710DCh)  
00E719FD  add         esp,4  
		break;
00E71A00  jmp         $LN8+0Dh (0E71A1Eh)  
	case 'A':
	case 'a':
		printf("Afternoon\n");
00E71A02  push        offset string "Afternoon\n" (0E77B68h)  
00E71A07  call        _printf (0E710DCh)  
00E71A0C  add         esp,4  
		break;
00E71A0F  jmp         $LN8+0Dh (0E71A1Eh)  
	case 'E':
	case'e':
		printf("Evening\n");
00E71A11  push        offset string "Evening\n" (0E77B78h)  
00E71A16  call        _printf (0E710DCh)  
00E71A1B  add         esp,4  
		break;
	}

	return 0;
00E71A1E  xor         eax,eax  
}
00E71A20  push        edx  
00E71A21  mov         ecx,ebp  
00E71A23  push        eax  
00E71A24  lea         edx,ds:[0E71A50h]  
00E71A2A  call        @_RTC_CheckStackVars@8 (0E711F4h)  
00E71A2F  pop         eax  
00E71A30  pop         edx  
00E71A31  pop         edi  
00E71A32  pop         esi  
00E71A33  pop         ebx  
00E71A34  mov         ecx,dword ptr [ebp-4]  
00E71A37  xor         ecx,ebp  
00E71A39  call        @__security_check_cookie@4 (0E71159h)  
00E71A3E  add         esp,0D4h  
00E71A44  cmp         ebp,esp  
00E71A46  call        __RTC_CheckEsp (0E71258h)  
00E71A4B  mov         esp,ebp  
00E71A4D  pop         ebp  
00E71A4E  ret

 

 

#include <stdio.h>

int main(void)
{
00007FF7026B1980  push        rbp  
00007FF7026B1982  push        rdi  
00007FF7026B1983  sub         rsp,108h  
00007FF7026B198A  lea         rbp,[rsp+20h]  
00007FF7026B198F  lea         rdi,[rsp+20h]  
00007FF7026B1994  mov         ecx,0Ah  
00007FF7026B1999  mov         eax,0CCCCCCCCh  
00007FF7026B199E  rep stos    dword ptr [rdi]  
00007FF7026B19A0  mov         rax,qword ptr [__security_cookie (07FF7026BD000h)]  
00007FF7026B19A7  xor         rax,rbp  
00007FF7026B19AA  mov         qword ptr [rbp+0D8h],rax  
00007FF7026B19B1  lea         rcx,[__4791B0BF_AdvanEnglishSchool@c (07FF7026C2008h)]  
00007FF7026B19B8  call        __CheckForDebuggerJustMyCode (07FF7026B137Ah)  
00007FF7026B19BD  nop  
	char sel;
	printf("M 오전, A 오후, E 저녁\n");
00007FF7026B19BE  lea         rcx,[string "M \xbf\xc0\xc0\xfc, A \xbf\xc0\xc8\xc4, E \xc0\xfa\xb3\xe1\n" (07FF7026BAD28h)]  
00007FF7026B19C5  call        printf (07FF7026B119Ah)  
00007FF7026B19CA  nop  
	printf("입력 : ");
00007FF7026B19CB  lea         rcx,[string "\xc0\xd4\xb7\xc2 : " (07FF7026BAD48h)]  
00007FF7026B19D2  call        printf (07FF7026B119Ah)  
00007FF7026B19D7  nop  
	scanf_s("%c", &sel, 1);
00007FF7026B19D8  mov         r8d,1  
00007FF7026B19DE  lea         rdx,[sel]  
00007FF7026B19E2  lea         rcx,[string "%c" (07FF7026BAD54h)]  
00007FF7026B19E9  call        scanf_s (07FF7026B1203h)  
00007FF7026B19EE  nop  

	switch (sel)
00007FF7026B19EF  movsx       eax,byte ptr [sel]  
00007FF7026B19F3  mov         dword ptr [rbp+0D4h],eax  
00007FF7026B19F9  mov         eax,dword ptr [rbp+0D4h]  
00007FF7026B19FF  sub         eax,41h  
00007FF7026B1A02  mov         dword ptr [rbp+0D4h],eax  
00007FF7026B1A08  cmp         dword ptr [rbp+0D4h],2Ch  
00007FF7026B1A0F  ja          $LN9+0Dh (07FF7026B1A5Eh)  
00007FF7026B1A11  movsxd      rax,dword ptr [rbp+0D4h]  
00007FF7026B1A18  lea         rcx,[__ImageBase (07FF7026A0000h)]  
00007FF7026B1A1F  movzx       eax,byte ptr [rcx+rax+11AACh]  
00007FF7026B1A27  mov         eax,dword ptr [rcx+rax*4+11A90h]  
00007FF7026B1A2E  add         rax,rcx  
00007FF7026B1A31  jmp         rax  
	{
	case 'M':
	case 'm':
		printf("Morning!\n");
00007FF7026B1A33  lea         rcx,[string "Morning!\n" (07FF7026BAD58h)]  
00007FF7026B1A3A  call        printf (07FF7026B119Ah)  
00007FF7026B1A3F  nop  
		break;
00007FF7026B1A40  jmp         $LN9+0Dh (07FF7026B1A5Eh)  
	case 'A':
	case 'a':
		printf("Afternoon\n");
00007FF7026B1A42  lea         rcx,[string "Afternoon\n" (07FF7026BAD68h)]  
00007FF7026B1A49  call        printf (07FF7026B119Ah)  
00007FF7026B1A4E  nop  
		break;
00007FF7026B1A4F  jmp         $LN9+0Dh (07FF7026B1A5Eh)  
	case 'E':
	case'e':
		printf("Evening\n");
00007FF7026B1A51  lea         rcx,[string "Evening\n" (07FF7026BAD78h)]  
00007FF7026B1A58  call        printf (07FF7026B119Ah)  
00007FF7026B1A5D  nop  
		break;
	}

	return 0;
00007FF7026B1A5E  xor         eax,eax  
}
00007FF7026B1A60  mov         edi,eax  
00007FF7026B1A62  lea         rcx,[rbp-20h]  
00007FF7026B1A66  lea         rdx,[__xt_z+260h (07FF7026BAD00h)]  
00007FF7026B1A6D  call        _RTC_CheckStackVars (07FF7026B1316h)  
00007FF7026B1A72  mov         eax,edi  
00007FF7026B1A74  mov         rcx,qword ptr [rbp+0D8h]  
00007FF7026B1A7B  xor         rcx,rbp  
00007FF7026B1A7E  call        __security_check_cookie (07FF7026B11B3h)  
00007FF7026B1A83  lea         rsp,[rbp+0E8h]  
00007FF7026B1A8A  pop         rdi  
00007FF7026B1A8B  pop         rbp  
00007FF7026B1A8C  ret

 


 

#include <stdio.h>

int main(void)
{
00881960  push        ebp  
00881961  mov         ebp,esp  
00881963  sub         esp,0D0h  
00881969  push        ebx  
0088196A  push        esi  
0088196B  push        edi  
0088196C  lea         edi,[ebp-10h]  
0088196F  mov         ecx,4  
00881974  mov         eax,0CCCCCCCCh  
00881979  rep stos    dword ptr es:[edi]  
0088197B  mov         eax,dword ptr [__security_cookie (088A000h)]  
00881980  xor         eax,ebp  
00881982  mov         dword ptr [ebp-4],eax  
00881985  mov         ecx,offset _A019B742_GoToBasic@c (088C008h)  
0088198A  call        @__CheckForDebuggerJustMyCode@4 (0881339h)  
0088198F  nop  
	int num;
	printf("자연수 입력: ");
00881990  push        offset string "\xc0\xda\xbf\xac\xbc\xf6 \xc0\xd4\xb7\xc2: " (0887B30h)  
00881995  call        _printf (08810DCh)  
0088199A  add         esp,4  
	scanf_s("%d", &num);
0088199D  lea         eax,[num]  
008819A0  push        eax  
008819A1  push        offset string "%d" (0887B40h)  
008819A6  call        _scanf_s (0881294h)  
008819AB  add         esp,8  

	if (num == 1)
008819AE  cmp         dword ptr [num],1  
008819B2  jne         main+58h (08819B8h)  
		goto ONE;
008819B4  jmp         main+64h (08819C4h)  
008819B6  jmp         main+64h (08819C4h)  
	else if (num == 2)
008819B8  cmp         dword ptr [num],2  
008819BC  jne         main+62h (08819C2h)  
		goto TWO;
008819BE  jmp         main+73h (08819D3h)  
008819C0  jmp         main+64h (08819C4h)  
	else
		goto OTHER;
008819C2  jmp         main+82h (08819E2h)  

ONE:
	printf("1을 입력하셨습니다\n");
008819C4  push        offset string "1\xc0\xbb \xc0\xd4\xb7\xc2\xc7\xcf\xbc\xcc\xbd\xc0\xb4\xcf\xb4\xd9\n" (0887B44h)  
008819C9  call        _printf (08810DCh)  
008819CE  add         esp,4  
	goto END;
008819D1  jmp         END (08819EFh)  
TWO:
	printf("2을 입력하셨습니다\n");
008819D3  push        offset string "2\xc0\xbb \xc0\xd4\xb7\xc2\xc7\xcf\xbc\xcc\xbd\xc0\xb4\xcf\xb4\xd9\n" (0887B5Ch)  
008819D8  call        _printf (08810DCh)  
008819DD  add         esp,4  
	goto END;
008819E0  jmp         END (08819EFh)  
OTHER:
	printf("3 혹은 다른 값을 입력하셨습니다\n");
008819E2  push        offset string "3 \xc8\xa4\xc0\xba \xb4\xd9\xb8\xa5 \xb0\xaa\xc0\xbb \xc0\xd4\xb7\xc2\xc7\xcf\xbc\xcc\xbd\xc0\xb4\xcf\xb4\xd9@"... (0887B74h)  
008819E7  call        _printf (08810DCh)  
008819EC  add         esp,4  


END:
	return 0;
008819EF  xor         eax,eax  
}
008819F1  push        edx  
008819F2  mov         ecx,ebp  
008819F4  push        eax  
008819F5  lea         edx,ds:[881A20h]  
008819FB  call        @_RTC_CheckStackVars@8 (08811F4h)  
00881A00  pop         eax  
00881A01  pop         edx  
00881A02  pop         edi  
00881A03  pop         esi  
00881A04  pop         ebx  
00881A05  mov         ecx,dword ptr [ebp-4]  
00881A08  xor         ecx,ebp  
00881A0A  call        @__security_check_cookie@4 (0881159h)  
00881A0F  add         esp,0D0h  
00881A15  cmp         ebp,esp  
00881A17  call        __RTC_CheckEsp (0881258h)  
00881A1C  mov         esp,ebp  
00881A1E  pop         ebp  
00881A1F  ret