#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct BoolExpr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BX_DecRef(struct BoolExpr *);
struct BoolExpr *BX_Not(struct BoolExpr *);
struct BoolExpr *BX_Or(size_t, struct BoolExpr **);
struct BoolExpr *BX_Nor(size_t n, struct BoolExpr **xs) {
  struct BoolExpr *temp;
  struct BoolExpr *y;
  do {
    if ((temp = BX_Or(n, xs)) == NULL)
      return NULL;
  } while (0);
  do {
    if ((y = BX_Not(temp)) == NULL) {
      BX_DecRef(temp);
      return NULL;
    }
  } while (0);
  BX_DecRef(temp);
  return y;
}


x86 assembly (clang, -O0):
<BX_Nor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <BX_Or@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1168 <BX_Nor+0x38>
movq   $0x0,-0x8(%rbp)
jmp    11b5 <BX_Nor+0x85>
jmp    116d <BX_Nor+0x3d>
jmp    1172 <BX_Nor+0x42>
mov    -0x20(%rbp),%rdi
call   1030 <BX_Not@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    119f <BX_Nor+0x6f>
mov    -0x20(%rbp),%rdi
call   1050 <BX_DecRef@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b5 <BX_Nor+0x85>
jmp    11a4 <BX_Nor+0x74>
mov    -0x20(%rbp),%rdi
call   1050 <BX_DecRef@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BX_Nor>:
push   %r14
push   %rbx
push   %rax
call   1040 <BX_Or@plt>
test   %rax,%rax
je     1159 <BX_Nor+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <BX_Not@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <BX_DecRef@plt>
mov    %r14,%rax
jmp    115b <BX_Nor+0x2b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.BoolExpr = type { i32 }
define %struct.BoolExpr* @BX_Nor(i64 %0, %struct.BoolExpr** %1) {
%3 = alloca %struct.BoolExpr*
%4 = alloca i64
%5 = alloca %struct.BoolExpr**
%6 = alloca %struct.BoolExpr*
%7 = alloca %struct.BoolExpr*
store i64 %0, i64* %4
store %struct.BoolExpr** %1, %struct.BoolExpr*** %5
br label %8
8: ; preds = %2
%9 = load i64, i64* %4
%10 = load %struct.BoolExpr**, %struct.BoolExpr*** %5
%11 = call %struct.BoolExpr* @BX_Or(i64 %9, %struct.BoolExpr** %10)
store %struct.BoolExpr* %11, %struct.BoolExpr** %6
%12 = icmp eq %struct.BoolExpr* %11, null
br i1 %12, label %13, label %14
13: ; preds = %8
store %struct.BoolExpr* null, %struct.BoolExpr** %3
br label %28
14: ; preds = %8
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
%17 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%18 = call %struct.BoolExpr* @BX_Not(%struct.BoolExpr* %17)
store %struct.BoolExpr* %18, %struct.BoolExpr** %7
%19 = icmp eq %struct.BoolExpr* %18, null
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%22 = call i32 @BX_DecRef(%struct.BoolExpr* %21)
store %struct.BoolExpr* null, %struct.BoolExpr** %3
br label %28
23: ; preds = %16
br label %24
24: ; preds = %23
%25 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%26 = call i32 @BX_DecRef(%struct.BoolExpr* %25)
%27 = load %struct.BoolExpr*, %struct.BoolExpr** %7
store %struct.BoolExpr* %27, %struct.BoolExpr** %3
br label %28
28: ; preds = %24, %20, %13
%29 = load %struct.BoolExpr*, %struct.BoolExpr** %3
ret %struct.BoolExpr* %29
}

LLVM IR (-O2):
%struct.BoolExpr = type { i32 }
define %struct.BoolExpr* @BX_Nor(i64 %0, %struct.BoolExpr** %1) {
%3 = tail call %struct.BoolExpr* @BX_Or(i64 %0, %struct.BoolExpr** %1)
%4 = icmp eq %struct.BoolExpr* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call %struct.BoolExpr* @BX_Not(%struct.BoolExpr* %3)
%7 = tail call i32 @BX_DecRef(%struct.BoolExpr* %3)
br label %8
8: ; preds = %5, %2
%9 = phi %struct.BoolExpr* [ null, %2 ], [ %6, %5 ]
ret %struct.BoolExpr* %9
}