#include <iostream> using namespace Std; int main () { int A, B; Cin >> a >> b; ① cout << (A = = 5? 5:6); Ii cout << (A = = 6? 3:10); cout << (a <= 7? 2:11); cout << (a 8:b); System ("pause"); return 0; } |
#include <iostream> using namespace Std; int main () { ............. Slightly int A, B; Cin >> a >> b; ............... Slightly ① cout << (A = = 5? 5:6); 003d5eb6 cmp DWORD ptr [a],5 003d5eba jne main+68h (03d5ec8h) 003D5EBC mov dword ptr [ebp-0e0h],5 003D5EC6 jmp main+72h (03D5ED2H) 003D5EC8 mov dword ptr [ebp-0e0h],6 003D5ED2 mov Esi,esp 003D5ED4 mov eax,dword ptr [ebp-0e0h] 003d5eda push EAX 003d5edb mov ecx,dword ptr ds:[3e10a8h]
cout << (A = = 5? 5:6); 003d5ee1 call DWORD ptr ds:[3e1094h] 003d5ee7 CMP ESI,ESP 003d5ee9 call __rtc_checkesp (03d1339h) //② cout << (A = = 6? 3:10); 003D5EEE cmp DWORD ptr [a],6 003d5ef2 jne main+0a0h (03d5f00h) 003D5EF4 mov dword ptr [ebp-0e0h],3 003d5efe jmp Main+0aah (03d5f0ah) 003D5F00 mov dword ptr [ebp-0e0h],0ah 003D5F0A mov Esi,esp 003D5F0C mov eax,dword ptr [ebp-0e0h] 003D5F12 push EAX 003D5F13 mov ecx,dword ptr ds:[3e10a8h] 003d5f19 call DWORD ptr ds:[3e1094h] 003D5F1F CMP ESI,ESP 003D5F21 call __rtc_checkesp (03d1339h) cout << (a <= 7? 2:11); 003D5F26 cmp DWORD ptr [a],7 003D5F2A JG main+0d8h (03d5f38h) 003D5F2C mov dword ptr [ebp-0e0h],2 003D5F36 jmp main+0e2h (03D5F42H) 003D5F38 mov dword ptr [EBP-0E0H],0BH 003D5F42 mov Esi,esp 003D5F44 mov eax,dword ptr [ebp-0e0h] 003D5F4A push EAX 003D5F4B mov ecx,dword ptr ds:[3e10a8h] 003d5f51 call DWORD ptr ds:[3e1094h] 003D5F57 CMP ESI,ESP 003d5f59 call __rtc_checkesp (03d1339h) cout << (a 8:b); 003D5F5E cmp DWORD ptr [a],0 cout << (a 8:b); 003d5f62 JE main+110h (03d5f70h) 003D5F64 mov dword ptr [ebp-0e0h],8 003d5f6e jmp main+119h (03d5f79h) 003D5F70 mov Eax,dword ptr [b] 003D5F73 mov dword ptr [Ebp-0e0h],eax 003D5F79 mov Esi,esp 003D5F7B mov ecx,dword ptr [ebp-0e0h] 003D5F81 push ECX 003D5F82 mov ecx,dword ptr ds:[3e10a8h] 003d5f88 call DWORD ptr ds:[3e1094h] 003D5F8E CMP ESI,ESP 003d5f90 call __rtc_checkesp (03d1339h) System ("pause"); ............ Slightly return 0; 003d5fac XOR Eax,eax } .......... Slightly |
#include <iostream> using namespace Std; int main () { 012612A0 Push EBP 012612A1 mov Ebp,esp 012612a3 Sub Esp,0ch 012612A6 mov eax,dword ptr ds:[01264000h] 012612AB XOR EAX,EBP 012612AD mov dword ptr [Ebp-4],eax int A, B; Cin >> a >> b; 012612B0 mov ecx,dword ptr ds:[1263038h] int A, B; Cin >> a >> b; 012612B6 Lea Eax,[b] 012612B9 push EAX 012612BA Lea Eax,[a] 012612BD push EAX 012612BE call DWORD ptr ds:[1263028h] 012612C4 mov ecx,eax 012612c6 call DWORD ptr ds:[1263028h] //① cout << (A = = 5? 5:6); 012612CC mov ecx,dword ptr ds:[126303ch] 012612D2 XOR Eax,eax 012612D4 cmp DWORD ptr [a],5 If a==5, the EAX is set to 0, otherwise the EAX is set to 1, then eax+5, Results of final output eax+5 012612d8 Setne AL 012612DB Add eax,5 012612DE push EAX 012612DF call DWORD ptr ds:[1263024h] //② cout << (A = = 6? 3:10); 012612E5 cmp DWORD ptr [a],6 012612E9 mov ecx,3 012612EE mov eax,0ah Based on the influence of the CMP's most ZF bit, if zf=1, then the a==6 is represented, the ECX (3) is transmitted to the EAX for output, otherwise the value of EAX is preserved (10) for output 012612F3 Cmove EAX,ECX 012612F6 mov ecx,dword ptr ds:[126303ch] 012612FC push EAX 012612FD call DWORD ptr ds:[1263024h] cout << (a <= 7? 2:11); 01261303 cmp DWORD ptr [a],7 01261307 mov ecx,2 0126130C mov eax,0bh The judgment here is ZF and of, if zf=1 (equal) or zf!=of (overflow, i.e. a<7), the value of ECX (2) is transferred to the EAX for output, otherwise the value of EAX (11) is preserved for output 01261311 Cmovle EAX,ECX 01261314 mov ecx,dword ptr ds:[126303ch] 0126131A push EAX 0126131B call DWORD ptr ds:[1263024h] cout << (a 8:b); 01261321 cmp DWORD ptr [a],0 cout << (a 8:b); 01261325 mov ecx,8 0126132A mov Eax,dword ptr [b] Collation is to judge A's true and false, to see the ZF flag bit 0126132D Cmovne EAX,ECX 01261330 mov ecx,dword ptr ds:[126303ch] 01261336 push EAX 01261337 call DWORD ptr ds:[1263024h] System ("pause"); 0126133D Push 126319Ch 01261342 call DWORD ptr ds:[12630c4h] return 0; } ........ Slightly |