#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 */
struct BoolExpr *BX_Dict_Search(struct BX_Dict *, struct BoolExpr *);
struct BoolExpr *BX_IncRef(struct BoolExpr *);
struct BoolExpr *_var_compose(struct BoolExpr *var, struct BX_Dict *var2ex) {
  struct BoolExpr *ex;
  ex = BX_Dict_Search(var2ex, var);
  if (ex == (struct BoolExpr *)NULL)
    return BX_IncRef(var);
  return BX_IncRef(ex);
}


x86 assembly (clang, -O0):
<_var_compose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <BX_Dict_Search@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115e <_var_compose+0x3e>
mov    -0x10(%rbp),%rdi
call   1040 <BX_IncRef@plt>
mov    %rax,-0x8(%rbp)
jmp    116b <_var_compose+0x4b>
mov    -0x20(%rbp),%rdi
call   1040 <BX_IncRef@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_var_compose>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <BX_Dict_Search@plt>
test   %rax,%rax
je     113d <_var_compose+0x1d>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <BX_IncRef@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <BX_IncRef@plt>

LLVM IR (-O0):
%struct.BoolExpr = type { i32 }
%struct.BX_Dict = type { i32 }
define %struct.BoolExpr* @_var_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*
store %struct.BoolExpr* %0, %struct.BoolExpr** %4
store %struct.BX_Dict* %1, %struct.BX_Dict** %5
%7 = load %struct.BX_Dict*, %struct.BX_Dict** %5
%8 = load %struct.BoolExpr*, %struct.BoolExpr** %4
%9 = call %struct.BoolExpr* @BX_Dict_Search(%struct.BX_Dict* %7, %struct.BoolExpr* %8)
store %struct.BoolExpr* %9, %struct.BoolExpr** %6
%10 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%11 = icmp eq %struct.BoolExpr* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load %struct.BoolExpr*, %struct.BoolExpr** %4
%14 = call %struct.BoolExpr* @BX_IncRef(%struct.BoolExpr* %13)
store %struct.BoolExpr* %14, %struct.BoolExpr** %3
br label %18
15: ; preds = %2
%16 = load %struct.BoolExpr*, %struct.BoolExpr** %6
%17 = call %struct.BoolExpr* @BX_IncRef(%struct.BoolExpr* %16)
store %struct.BoolExpr* %17, %struct.BoolExpr** %3
br label %18
18: ; preds = %15, %12
%19 = load %struct.BoolExpr*, %struct.BoolExpr** %3
ret %struct.BoolExpr* %19
}

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