DISCRETE_STEP(dst_logic_nand) {
  set_output(0, (DISCRETE_INPUT(0) && DISCRETE_INPUT(1) && DISCRETE_INPUT(2) &&
                 DISCRETE_INPUT(3))
                    ? 0.0
                    : 1.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
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1191 <DISCRETE_STEP+0x71>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1191 <DISCRETE_STEP+0x71>
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <DISCRETE_INPUT@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     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
xorps  %xmm0,%xmm0
movsd  0xe61(%rip),%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
je     117b <DISCRETE_STEP+0x5b>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
je     1173 <DISCRETE_STEP+0x53>
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
movsd  0xea4(%rip),%xmm0
je     117b <DISCRETE_STEP+0x5b>
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <DISCRETE_INPUT@plt>
test   %eax,%eax
je     1173 <DISCRETE_STEP+0x53>
xorps  %xmm0,%xmm0
jmp    117b <DISCRETE_STEP+0x5b>
movsd  0xe85(%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 %15
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 %15
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 %12, label %15
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 [ false, %9 ], [ false, %6 ], [ false, %1 ], [ %14, %12 ]
%17 = zext i1 %16 to i64
%18 = select i1 %16, double 0.000000e+00, double 1.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 %14, 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
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @DISCRETE_INPUT to i32 (i32, ...)*)(i32 2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
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 1.000000e+00, double 0.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
}