Question: How can I code the C '&&' operator in x86? For example:

```
int a = ...
int b = ...
int c = a && b;

```

What would be the equivalent of the last line in x86?

EDIT: I want to do the above without any jumps.

EDIT: g++ generates this, but I don't understand it:

```
testl   %edi, %edi
setne   %dl
xorl    %eax, %eax
testl   %esi, %esi
setne   %al
andl    %edx, %eax

```

Answer: 
You can't do it without jumps because && is a short-circuit operator.

```
    XOR ecx, ecx
    MOV eax, <value of A>
    MOV ebx, <value of B>
    TEST eax, eax
    JZ testDone
    TEST ebx, ebx
    JZ testDone
    INC ecx
testDone:
    ...

```
This will work (and is the fastest piece of code) **only if** *a* and *b* variables are normalized, i.e. it contains a boolean value 1 to mark true or 0 to mark false.

```
MOV eax, <value>  ; a = ...
MOV ebx, <value>  ; b = ...
MOV ecx, eax
AND ecx, ebx      ; c = a & b

```