#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 */

/* Variables and functions */
int add_history_type(int);
int init(void) {
  int tmp;
  int tmp___0;
  int tmp___1;
  int tmp___2;
  {
    tmp = add_history_type(0);
    if (!tmp) {
      return (0);
    }
    tmp___0 = add_history_type(1);
    if (!tmp___0) {
      return (0);
    }
    tmp___1 = add_history_type(2);
    if (!tmp___1) {
      return (0);
    }
    tmp___2 = add_history_type(3);
    if (!tmp___2) {
      return (0);
    }
    return (1);
  }
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
call   1030 <add_history_type@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1138 <init+0x28>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <init+0x98>
mov    $0x1,%edi
call   1030 <add_history_type@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    115b <init+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <init+0x98>
mov    $0x2,%edi
call   1030 <add_history_type@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    117e <init+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <init+0x98>
mov    $0x3,%edi
call   1030 <add_history_type@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11a1 <init+0x91>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <init+0x98>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <add_history_type@plt>
test   %eax,%eax
je     114b <init+0x3b>
mov    $0x1,%edi
call   1030 <add_history_type@plt>
test   %eax,%eax
je     114b <init+0x3b>
mov    $0x2,%edi
call   1030 <add_history_type@plt>
test   %eax,%eax
je     114b <init+0x3b>
mov    $0x3,%edi
call   1030 <add_history_type@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @init() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @add_history_type(i32 0)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %0
store i32 0, i32* %1
br label %26
10: ; preds = %0
%11 = call i32 @add_history_type(i32 1)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 0, i32* %1
br label %26
15: ; preds = %10
%16 = call i32 @add_history_type(i32 2)
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i32 0, i32* %1
br label %26
20: ; preds = %15
%21 = call i32 @add_history_type(i32 3)
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %20
store i32 0, i32* %1
br label %26
25: ; preds = %20
store i32 1, i32* %1
br label %26
26: ; preds = %25, %24, %19, %14, %9
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @init() {
%1 = tail call i32 @add_history_type(i32 0)
%2 = icmp eq i32 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32 @add_history_type(i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32 @add_history_type(i32 2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @add_history_type(i32 3)
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ 0, %0 ], [ 0, %3 ], [ 0, %6 ], [ %12, %9 ]
ret i32 %14
}