if( !A && !B )
seems like it should compile to
mov eax, dword ptr[esp + A_offset]
test eax, dword ptr[esp + B_offset]
jne ~~~~~~~~~~
The compiler actually generates
mov eax, dword ptr[esp + A_offset]
test eax, eax
jne ~~~~~~~~~~
mov eax, dword ptr[esp + B_offset]
test eax, eax
jne ~~~~~~~~~~
See dump here
8B 45 F8 mov eax,dword ptr [b]
83 7D FC 00 cmp dword ptr [a],0
75 04 jne main+32h (0A71072h)
85 C0 test eax,eax
75 00 jne main+32h (0A71072h)
Why doesn't it use a single TEST instruction to save branches and instructions?