#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_Compose(struct BoolExpr *, struct BX_Dict *);
int /*<<< orphan*/ BX_DecRef(struct BoolExpr *);
struct BoolExpr *BX_Simplify(struct BoolExpr *);
struct BoolExpr *BX_Restrict(struct BoolExpr *ex, struct BX_Dict *var2const) {
  struct BoolExpr *temp;
  struct BoolExpr *y;
  do {
    if ((temp = BX_Compose(ex, var2const)) == NULL)
      return NULL;
  } while (0);
  do {
    if ((y = BX_Simplify(temp)) == NULL) {
      BX_DecRef(temp);
      return NULL;
    }
  } while (0);
  BX_DecRef(temp);
  return y;
}


x86 assembly (clang, -O0):
<BX_Restrict>:
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_Compose@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1168 <BX_Restrict+0x38>
movq   $0x0,-0x8(%rbp)
jmp    11b5 <BX_Restrict+0x85>
jmp    116d <BX_Restrict+0x3d>
jmp    1172 <BX_Restrict+0x42>
mov    -0x20(%rbp),%rdi
call   1030 <BX_Simplify@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    119f <BX_Restrict+0x6f>
mov    -0x20(%rbp),%rdi
call   1050 <BX_DecRef@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b5 <BX_Restrict+0x85>
jmp    11a4 <BX_Restrict+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_Restrict>:
push   %r14
push   %rbx
push   %rax
call   1040 <BX_Compose@plt>
test   %rax,%rax
je     1159 <BX_Restrict+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <BX_Simplify@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <BX_DecRef@plt>
mov    %r14,%rax
jmp    115b <BX_Restrict+0x2b>
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* @BX_Restrict(%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*
store %struct.BoolExpr* %0, %struct.BoolExpr** %4
store %struct.BX_Dict* %1, %struct.BX_Dict** %5
br label %8
8: ; preds = %2
%9 = load %struct.BoolExpr*, %struct.BoolExpr** %4
%10 = load %struct.BX_Dict*, %struct.BX_Dict** %5
%11 = call %struct.BoolExpr* @BX_Compose(%struct.BoolExpr* %9, %struct.BX_Dict* %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_Simplify(%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 }
%struct.BX_Dict = type { i32 }
define %struct.BoolExpr* @BX_Restrict(%struct.BoolExpr* %0, %struct.BX_Dict* %1) {
%3 = tail call %struct.BoolExpr* @BX_Compose(%struct.BoolExpr* %0, %struct.BX_Dict* %1)
%4 = icmp eq %struct.BoolExpr* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call %struct.BoolExpr* @BX_Simplify(%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
}