DISCRETE_STEP(dst_logic_or) {
  set_output(0, (DISCRETE_INPUT(0) || DISCRETE_INPUT(1) || DISCRETE_INPUT(2) ||
                 DISCRETE_INPUT(3))
                    ? 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>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1191 <DISCRETE_STEP+0x71>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1191 <DISCRETE_STEP+0x71>
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1191 <DISCRETE_STEP+0x71>
mov    $0x3,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
movsd  0xe64(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  %xmm1,-0x20(%rbp)
test   $0x1,%al
movsd  %xmm0,-0x18(%rbp)
jne    11bb <DISCRETE_STEP+0x9b>
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>
movsd  0xece(%rip),%xmm0
test   %eax,%eax
jne    117b <DISCRETE_STEP+0x5b>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
je     1150 <DISCRETE_STEP+0x30>
movsd  0xeb2(%rip),%xmm0
jmp    117b <DISCRETE_STEP+0x5b>
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
movsd  0xe9a(%rip),%xmm0
jne    117b <DISCRETE_STEP+0x5b>
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
xorps  %xmm0,%xmm0
test   %eax,%eax
jne    1146 <DISCRETE_STEP+0x26>
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 %15, label %6
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 %15, label %9
9: ; preds = %6
%10 = call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 2)
%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 3)
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %12, %9, %6, %1
%16 = phi i1 [ true, %9 ], [ true, %6 ], [ true, %1 ], [ %14, %12 ]
%17 = zext i1 %16 to i64
%18 = select i1 %16, double 1.000000e+00, double 0.000000e+00
%19 = call i32 (i32, double, ...) bitcast (i32 (...)* @set_output to i32 (i32, double, ...)*)(i32 0, double %18)
%20 = load i32, i32* %2
ret i32 %20
}

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 %4, label %14
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 %7, label %14
7: ; preds = %4
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 2)
%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 3)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, double 0.000000e+00, double 1.000000e+00
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi double [ 1.000000e+00, %7 ], [ 1.000000e+00, %4 ], [ 1.000000e+00, %1 ], [ %13, %10 ]
%16 = tail call i32 (i32, double, ...) bitcast (i32 (...)* @set_output to i32 (i32, double, ...)*)(i32 0, double %15)
ret i32 undef
}