The control structure is mainly about If/else switch/case
Don't say much nonsense. Offer code and disassembly analysis.
#include <stdio.h>int main (int argc, char *argv[]) {int nInt = 9;//if (0 = = nInt) __asm{cmp DWORD PTR [ebp-4h], 0; j Le __exit;} __asm{printf ("%d\n", nInt);/*push DWORD PTR [ebp-4h];p ush offset string "%d\n"; call printf; add esp, 8h; */}/*if (NI NT > 9) {printf ("%d>9\n", nInt);} else if (9 = = nInt) {printf ("nInt = 9\n");} else if (8 = = nInt) {printf ("nInt = 8\n");} */switch (nInt) {case 8:nint + = 1; break;case 9:nint-= 9;break;default:nint-= 1;break;} Switch (nInt = scanf ("%d", &nint)) {case 1:printf ("nInt = 1\n"), Break;case 2:printf ("nInt = 2\n"); Break;case 3:printf ( "nInt = 3\n"); Break;case 5:printf ("nInt = 5\n"); Break;case 6:printf ("nInt = 6\n"); Break;case 7:printf ("nInt = 7\n"); break Case 100:printf ("nInt = 100\n"), Break;case 400:printf ("nInt = 400\n"); Break;case 500:printf ("nInt = 500\n"); break; Default:break;} /*0040D76D Lea edx,[ebp-4]0040d770 push edx0040d771 Push offset string "%d" (0042201c) 0040d776 Call scanf (0040FA20) 0040d77b Add esp,80040d77e mov dword ptr [ebp-4],eax0040d781 mov eax,dword ptr [ebp-4]0040d784 mov DWORD ptr [ebp-0ch],eax0040d787 mov ecx,dword ptr [ebp-0ch]0040d78a Sub ecx,1//case Table ind Ex 0->max-10040d78d mov dword ptr [ebp-0ch],ecx0040d790 cmp dword ptr [ebp-0ch],6//maxindex0040d794 JA __exit (0040d7f8) 0040d796 mov edx,dword ptr [ebp-0ch]0040d799 jmp dword ptr [Edx*4+40d8 0bh]//case table47:case 1:48:printf ("nInt = 1\n"); 0040d7a0 push offset string "nInt = 1\n" (004 22FE0) 0040d7a5 call printf (00401070) 0040d7aa add ESP,449:BREAK;0040D7AD jmp __exi T (0040D7F8) <strong> perform a judgment jump to the end of </strong>50:case 2:51:printf ("nInt = 2\n"); 0040d7af Pu SH offset string "nInt = 2\n" (00422fd4) 0040d7b4 call printf (00401070) 0040d7b9 add esp,452: Break;0040d7bcJMP __exit (0040D7F8) 53:case 3:54:printf ("nInt = 3\n"); 0040d7be push offset string "nIn t = 3\n "(00422FC8) 0040d7c3 call printf (00401070) 0040d7c8 add ESP,455:BREAK;0040D7CB jmp __exit (0040D7F8) 56:case 5:57:printf ("nInt = 5\n"); 0040d7cd push offset string "nInt = 5\n "(00422FBC) 0040d7d2 call printf (00401070) 0040d7d7 add Esp,458:break;0040d7da jmp __exit (0040D7F8) 59:case 6:60:printf ("nInt = 6\n"); 0040D7DC push offset string "nInt = 6\n" (00422fb0) 0040d7e1 call printf (00401070) 0040d7e6 add Esp,461:break;0040d7e9 jmp __exit (0040D7F8) 62:case 7:63:printf ("nInt = 7\n"); 0040d7eb push offset string "nInt = 7\n" (00 422FA4) 0040d7f0 call printf (00401070) 0040d7f5 add esp,464:break;65:default:66: BREAK;67:}68: __exit:69:return 0;0040d7f8 XOR EAX,EAX linear structure with array processing, referenced by an index.
0040FAED Lea EDX,[EBP-4]0040FAF0 push EDX0040FAF1 Push offset string "%d" (0042201c) 0040faf6 Call scanf (0040FA20) 0040FAFB add Esp,80040fafe mov dword ptr [EBP-4],EAX0040FB01 mov Eax,dword ptr [ebp-4]0040fb04 mov dword ptr [ebp-0ch],eax0040fb07 cmp dword ptr [ebp-0ch],64h0040fb0 B JG main+0b4h (0040FB34) 0040fb0d cmp dword ptr [Ebp-0ch],64h#1000040fb11 je $L 554+0fh (00 40FBA5) 0040FB17 mov ecx,dword ptr [ebp-0ch]0040fb1a sub ecx,1#index0040fb1d mov dword ptr [E BP-0CH],ECX0040FB20 cmp dword ptr [ebp-0ch],6#maxindex0040fb24 ja __exit (0040fbd0) 0040FB2A mov Edx,dword ptr [ebp-0ch]0040fb2d jmp dword ptr [edx*4+40fbe3h]0040fb34 cmp dword ptr [ebp-0ch],190 H#4000040fb3b JE $L 554+1eh (0040FBB4) 0040fb3d cmp dword ptr [Ebp-0ch],1f4h#5000040fb44 JE $L 554+2DH (0040FBC3) 0040FB46 jmp __exit (0040fbd0) */switch (nInt) {case 2:printf ("nInt = 2\n"); Break;case 3:printf ("nInt = 3\n"); Break;cas E 8:printf ("nInt = 8\n"), Break;case 10:printf ("nInt = 10\n"), Break;case 35:printf ("nInt = 35\n"), Break;case 37:printf (" NInt = 37\n "); Break;case 666:printf (" nInt = 666\n "); break;} /* Non-linearity, there are alternative to the use of binary tree processing.
/*0040FBD0 mov eax,dword ptr [ebp-4]nint-eax0040fbd3 mov dword ptr [EBP-10H],EAX0040FBD6 CMP DWORD ptr [ebp-10h],0ah> 100040FBDA JG $L 554+60h (0040FBF6) 0040FBDC cmp dword ptr [EBP-10H] , 0ah= 100040fbe0 je $L 554+0a4h (0040fc3a) 0040fbe2 cmp dword ptr [Ebp-10h],20040fbe6 JE $L 5 54+77h (0040fc0d) = 2 0040fbe8 cmp dword ptr [ebp-10h],3= 30040FBEC je $L 554+86h (0040fc1c) 0040FBEE CMP dword ptr [Ebp-10h],80040fbf2 je $L 554+95h (0040fc2b) =80040fbf4 jmp __exit (0040fc74) binary tree Right Branch 0040fbf6 cmp DWORD ptr [ebp-10h],23h= 350040FBFA je $L 554+0b3h (0040fc49) 0040FBFC CMP dwor D ptr [ebp-10h],25h= 370040fc00 je $L 554+0c2h (0040fc58) 0040FC02 cmp dword ptr [ebp-10h],29ah= 666004 0fc09 JE $L 554+0d1h (0040fc67) 0040fc0b jmp __exit (0040fc74) Zodi end */__exit:return 0;}
Control structure of CPP disassembly