DISCRETE_STEP(dst_logic_xor) {
  set_output(0, ((DISCRETE_INPUT(0) && !DISCRETE_INPUT(1)) ||
                 (!DISCRETE_INPUT(0) && DISCRETE_INPUT(1)))
                    ? 1.0
                    : 0.0);
}


x86 assembly (clang, -O0):
<DISCRETE_STEP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
cmp    $0x0,%eax
je     1159 <DISCRETE_STEP+0x39>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     118d <DISCRETE_STEP+0x6d>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
jne    1187 <DISCRETE_STEP+0x67>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
movsd  0xe68(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  %xmm1,-0x20(%rbp)
test   $0x1,%al
movsd  %xmm0,-0x18(%rbp)
jne    11b7 <DISCRETE_STEP+0x97>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xor    %edi,%edi
mov    $0x1,%al
call   1040 <set_output@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DISCRETE_STEP>:
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
je     113e <DISCRETE_STEP+0x1e>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
je     1161 <DISCRETE_STEP+0x41>
xor    %edi,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
xorps  %xmm0,%xmm0
test   %eax,%eax
jne    1169 <DISCRETE_STEP+0x49>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
xorps  %xmm0,%xmm0
test   %eax,%eax
je     1169 <DISCRETE_STEP+0x49>
movsd  0xe97(%rip),%xmm0
xor    %edi,%edi
mov    $0x1,%al
pop    %rcx
jmp    1040 <set_output@plt>

LLVM IR (-O0):
define i32 @DISCRETE_STEP(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 0)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 1)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6, %1
%10 = call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 0)
%11 = icmp ne i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 1)
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ false, %9 ], [ %14, %12 ]
br label %17
17: ; preds = %15, %6
%18 = phi i1 [ true, %6 ], [ %16, %15 ]
%19 = zext i1 %18 to i64
%20 = select i1 %18, double 1.000000e+00, double 0.000000e+00
%21 = call i32 (i32, double, ...) bitcast (i32 (...)* @set_output to i32 (i32, double, ...)*)(i32 0, double %20)
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @DISCRETE_STEP(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4, %1
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 1)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, double 0.000000e+00, double 1.000000e+00
br label %14
14: ; preds = %7, %10, %4
%15 = phi double [ 1.000000e+00, %4 ], [ 0.000000e+00, %7 ], [ %13, %10 ]
%16 = tail call i32 (i32, double, ...) bitcast (i32 (...)* @set_output to i32 (i32, double, ...)*)(i32 0, double %15)
ret i32 undef
}