#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 */
scalar_t__ data_hasbuilt(int, int, int);
int data_hasbuiltname(int p, int era, int card) {
  if (data_hasbuilt(p, era, card))
    return 1;
  if (era == 1) {
    if (card == 4 && data_hasbuilt(p, 0, 10))
      return 1;
    if (card == 5 && data_hasbuilt(p, 0, 11))
      return 1;
    if (card == 6 && data_hasbuilt(p, 0, 12))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<data_hasbuiltname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <data_hasbuilt@plt>
cmp    $0x0,%rax
je     1145 <data_hasbuiltname+0x35>
movl   $0x1,-0x4(%rbp)
jmp    11e8 <data_hasbuiltname+0xd8>
cmpl   $0x1,-0xc(%rbp)
jne    11e1 <data_hasbuiltname+0xd1>
cmpl   $0x4,-0x10(%rbp)
jne    117e <data_hasbuiltname+0x6e>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <data_hasbuilt@plt>
cmp    $0x0,%rax
je     117e <data_hasbuiltname+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11e8 <data_hasbuiltname+0xd8>
cmpl   $0x5,-0x10(%rbp)
jne    11ad <data_hasbuiltname+0x9d>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
mov    $0xb,%edx
call   1030 <data_hasbuilt@plt>
cmp    $0x0,%rax
je     11ad <data_hasbuiltname+0x9d>
movl   $0x1,-0x4(%rbp)
jmp    11e8 <data_hasbuiltname+0xd8>
cmpl   $0x6,-0x10(%rbp)
jne    11dc <data_hasbuiltname+0xcc>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <data_hasbuilt@plt>
cmp    $0x0,%rax
je     11dc <data_hasbuiltname+0xcc>
movl   $0x1,-0x4(%rbp)
jmp    11e8 <data_hasbuiltname+0xd8>
jmp    11e1 <data_hasbuiltname+0xd1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_hasbuiltname>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r15d
call   1030 <data_hasbuilt@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    1171 <data_hasbuiltname+0x61>
cmp    $0x1,%ebp
jne    116e <data_hasbuiltname+0x5e>
cmp    $0x6,%ebx
je     114e <data_hasbuiltname+0x3e>
cmp    $0x5,%ebx
je     115a <data_hasbuiltname+0x4a>
cmp    $0x4,%ebx
jne    116e <data_hasbuiltname+0x5e>
mov    %r15d,%edi
xor    %esi,%esi
mov    $0xa,%edx
jmp    1164 <data_hasbuiltname+0x54>
mov    %r15d,%edi
xor    %esi,%esi
mov    $0xc,%edx
jmp    1164 <data_hasbuiltname+0x54>
mov    %r15d,%edi
xor    %esi,%esi
mov    $0xb,%edx
call   1030 <data_hasbuilt@plt>
test   %rax,%rax
jne    1171 <data_hasbuiltname+0x61>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @data_hasbuiltname(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i64 @data_hasbuilt(i32 %8, i32 %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %4
br label %43
14: ; preds = %3
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %42
17: ; preds = %14
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 4
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %5
%22 = call i64 @data_hasbuilt(i32 %21, i32 0, i32 10)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %4
br label %43
25: ; preds = %20, %17
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 5
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load i32, i32* %5
%30 = call i64 @data_hasbuilt(i32 %29, i32 0, i32 11)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 1, i32* %4
br label %43
33: ; preds = %28, %25
%34 = load i32, i32* %7
%35 = icmp eq i32 %34, 6
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %5
%38 = call i64 @data_hasbuilt(i32 %37, i32 0, i32 12)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 1, i32* %4
br label %43
41: ; preds = %36, %33
br label %42
42: ; preds = %41, %14
store i32 0, i32* %4
br label %43
43: ; preds = %42, %40, %32, %24, %13
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
define i32 @data_hasbuiltname(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @data_hasbuilt(i32 %0, i32 %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = icmp eq i32 %1, 1
br i1 %7, label %8, label %18
8: ; preds = %6
switch i32 %2, label %18 [
i32 4, label %9
i32 5, label %12
i32 6, label %15
]
9: ; preds = %8
%10 = tail call i64 @data_hasbuilt(i32 %0, i32 0, i32 10)
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %19
12: ; preds = %8
%13 = tail call i64 @data_hasbuilt(i32 %0, i32 0, i32 11)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %19
15: ; preds = %8
%16 = tail call i64 @data_hasbuilt(i32 %0, i32 0, i32 12)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12, %9, %8, %15, %6
br label %19
19: ; preds = %15, %12, %9, %3, %18
%20 = phi i32 [ 0, %18 ], [ 1, %3 ], [ 1, %9 ], [ 1, %12 ], [ 1, %15 ]
ret i32 %20
}