#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;
};
struct BX_Dict {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BX_DecRef(struct BoolExpr *);
struct BoolExpr *BX_Not(struct BoolExpr *);
struct BoolExpr *_var_compose(struct BoolExpr *, struct BX_Dict *);
struct BoolExpr *_comp_compose(struct BoolExpr *comp, struct BX_Dict *var2ex) {
  struct BoolExpr *var;
  struct BoolExpr *temp;
  struct BoolExpr *y;
  do {
    if ((var = BX_Not(comp)) == NULL)
      return NULL;
  } while (0);
  do {
    if ((temp = _var_compose(var, var2ex)) == NULL) {
      BX_DecRef(var);
      return NULL;
    }
  } while (0);
  BX_DecRef(var);
  do {
    if ((y = BX_Not(temp)) == NULL) {
      BX_DecRef(temp);
      return NULL;
    }
  } while (0);
  BX_DecRef(temp);
  return y;
}


x86 assembly (clang, -O0):
<_comp_compose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <BX_Not@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1164 <_comp_compose+0x34>
movq   $0x0,-0x8(%rbp)
jmp    11f0 <_comp_compose+0xc0>
jmp    1169 <_comp_compose+0x39>
jmp    116e <_comp_compose+0x3e>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <_var_compose@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    119f <_comp_compose+0x6f>
mov    -0x20(%rbp),%rdi
call   1050 <BX_DecRef@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f0 <_comp_compose+0xc0>
jmp    11a4 <_comp_compose+0x74>
mov    -0x20(%rbp),%rdi
call   1050 <BX_DecRef@plt>
mov    -0x28(%rbp),%rdi
call   1030 <BX_Not@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11da <_comp_compose+0xaa>
mov    -0x28(%rbp),%rdi
call   1050 <BX_DecRef@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f0 <_comp_compose+0xc0>
jmp    11df <_comp_compose+0xaf>
mov    -0x28(%rbp),%rdi
call   1050 <BX_DecRef@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_comp_compose>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <BX_Not@plt>
test   %rax,%rax
je     1177 <_comp_compose+0x47>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <_var_compose@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <BX_DecRef@plt>
test   %r14,%r14
je     1177 <_comp_compose+0x47>
mov    %r14,%rdi
call   1030 <BX_Not@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <BX_DecRef@plt>
mov    %rbx,%rax
jmp    1179 <_comp_compose+0x49>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.BoolExpr = type { i32 }
%struct.BX_Dict = type { i32 }
define %struct.BoolExpr* @_comp_compose(%struct.BoolExpr* %0, %struct.BX_Dict* %1) {
%3 = alloca %struct.BoolExpr*
%4 = alloca %struct.BoolExpr*
%5 = alloca %struct.BX_Dict*
%6 = alloca %struct.BoolExpr*
%7 = alloca %struct.BoolExpr*
%8 = alloca %struct.BoolExpr*
store %struct.BoolExpr* %0, %struct.BoolExpr** %4
store %struct.BX_Dict* %1, %struct.BX_Dict** %5
br label %9
9: ; preds = %2
%10 = load %struct.BoolExpr*, %struct.BoolExpr** %4
%11 = call %struct.BoolExpr* @BX_Not(%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 = %9
store %struct.BoolExpr* null, %struct.BoolExpr** %3
br label %40
14: ; preds = %9
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
%17 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%18 = load %struct.BX_Dict*, %struct.BX_Dict** %5
%19 = call %struct.BoolExpr* @_var_compose(%struct.BoolExpr* %17, %struct.BX_Dict* %18)
store %struct.BoolExpr* %19, %struct.BoolExpr** %7
%20 = icmp eq %struct.BoolExpr* %19, null
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%23 = call i32 @BX_DecRef(%struct.BoolExpr* %22)
store %struct.BoolExpr* null, %struct.BoolExpr** %3
br label %40
24: ; preds = %16
br label %25
25: ; preds = %24
%26 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%27 = call i32 @BX_DecRef(%struct.BoolExpr* %26)
br label %28
28: ; preds = %25
%29 = load %struct.BoolExpr*, %struct.BoolExpr** %7
%30 = call %struct.BoolExpr* @BX_Not(%struct.BoolExpr* %29)
store %struct.BoolExpr* %30, %struct.BoolExpr** %8
%31 = icmp eq %struct.BoolExpr* %30, null
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load %struct.BoolExpr*, %struct.BoolExpr** %7
%34 = call i32 @BX_DecRef(%struct.BoolExpr* %33)
store %struct.BoolExpr* null, %struct.BoolExpr** %3
br label %40
35: ; preds = %28
br label %36
36: ; preds = %35
%37 = load %struct.BoolExpr*, %struct.BoolExpr** %7
%38 = call i32 @BX_DecRef(%struct.BoolExpr* %37)
%39 = load %struct.BoolExpr*, %struct.BoolExpr** %8
store %struct.BoolExpr* %39, %struct.BoolExpr** %3
br label %40
40: ; preds = %36, %32, %21, %13
%41 = load %struct.BoolExpr*, %struct.BoolExpr** %3
ret %struct.BoolExpr* %41
}

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