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

/* Variables and functions */
int check_end_of_field(struct fact_table *, struct world_list *);
int check_for_extra_fact(struct fact_table *, struct world_list *, int);
int check_for_initial_fact(struct fact_table *, struct world_list *, int);
int check_incorrect(struct fact_table *, struct world_list *);
int check_invalid_start_path(struct fact_table *, struct world_list *);
int check_unknown_id(struct fact_table *, struct world_list *);
scalar_t__ duplicate_fact(struct fact_table *);
int valid_path(struct fact_table *, struct world_list *, int);
int test_everything(struct fact_table *ft, void *data, int bonus) {
  struct world_list *worlds = data;
  if (check_for_initial_fact(ft, worlds, bonus) != 42)
    return 46;
  if (check_for_extra_fact(ft, worlds, bonus) != 42)
    return 43;
  if (duplicate_fact(ft))
    return 50;
  if (check_unknown_id(ft, worlds) != 42)
    return 49;
  if (check_incorrect(ft, worlds) != 42)
    return 44;
  if (check_end_of_field(ft, worlds) != 42)
    return 47;
  if (check_invalid_start_path(ft, worlds) != 42)
    return 48;
  return valid_path(ft, worlds, bonus);
}


x86 assembly (clang, -O0):
<test_everything>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <check_for_initial_fact@plt>
cmp    $0x2a,%eax
je     11c0 <test_everything+0x40>
movl   $0x2e,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1080 <check_for_extra_fact@plt>
cmp    $0x2a,%eax
je     11e5 <test_everything+0x65>
movl   $0x2b,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
call   1030 <duplicate_fact@plt>
cmp    $0x0,%rax
je     1204 <test_everything+0x84>
movl   $0x32,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <check_unknown_id@plt>
cmp    $0x2a,%eax
je     1226 <test_everything+0xa6>
movl   $0x31,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <check_incorrect@plt>
cmp    $0x2a,%eax
je     1248 <test_everything+0xc8>
movl   $0x2c,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <check_end_of_field@plt>
cmp    $0x2a,%eax
je     126a <test_everything+0xea>
movl   $0x2f,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <check_invalid_start_path@plt>
cmp    $0x2a,%eax
je     128c <test_everything+0x10c>
movl   $0x30,-0x4(%rbp)
jmp    129f <test_everything+0x11f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1070 <valid_path@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_everything>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1060 <check_for_initial_fact@plt>
mov    %eax,%ecx
mov    $0x2e,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1080 <check_for_extra_fact@plt>
mov    %eax,%ecx
mov    $0x2b,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
call   1030 <duplicate_fact@plt>
mov    %rax,%rcx
mov    $0x32,%eax
test   %rcx,%rcx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <check_unknown_id@plt>
mov    %eax,%ecx
mov    $0x31,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10a0 <check_incorrect@plt>
mov    %eax,%ecx
mov    $0x2c,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <check_end_of_field@plt>
mov    %eax,%ecx
mov    $0x2f,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <check_invalid_start_path@plt>
mov    %eax,%ecx
mov    $0x30,%eax
cmp    $0x2a,%ecx
jne    1243 <test_everything+0xc3>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <valid_path@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.fact_table = type { i32 }
%struct.world_list = type { i32 }
define i32 @test_everything(%struct.fact_table* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.fact_table*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.world_list*
store %struct.fact_table* %0, %struct.fact_table** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %6
%10 = bitcast i8* %9 to %struct.world_list*
store %struct.world_list* %10, %struct.world_list** %8
%11 = load %struct.fact_table*, %struct.fact_table** %5
%12 = load %struct.world_list*, %struct.world_list** %8
%13 = load i32, i32* %7
%14 = call i32 @check_for_initial_fact(%struct.fact_table* %11, %struct.world_list* %12, i32 %13)
%15 = icmp ne i32 %14, 42
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 46, i32* %4
br label %58
17: ; preds = %3
%18 = load %struct.fact_table*, %struct.fact_table** %5
%19 = load %struct.world_list*, %struct.world_list** %8
%20 = load i32, i32* %7
%21 = call i32 @check_for_extra_fact(%struct.fact_table* %18, %struct.world_list* %19, i32 %20)
%22 = icmp ne i32 %21, 42
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 43, i32* %4
br label %58
24: ; preds = %17
%25 = load %struct.fact_table*, %struct.fact_table** %5
%26 = call i64 @duplicate_fact(%struct.fact_table* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 50, i32* %4
br label %58
29: ; preds = %24
%30 = load %struct.fact_table*, %struct.fact_table** %5
%31 = load %struct.world_list*, %struct.world_list** %8
%32 = call i32 @check_unknown_id(%struct.fact_table* %30, %struct.world_list* %31)
%33 = icmp ne i32 %32, 42
br i1 %33, label %34, label %35
34: ; preds = %29
store i32 49, i32* %4
br label %58
35: ; preds = %29
%36 = load %struct.fact_table*, %struct.fact_table** %5
%37 = load %struct.world_list*, %struct.world_list** %8
%38 = call i32 @check_incorrect(%struct.fact_table* %36, %struct.world_list* %37)
%39 = icmp ne i32 %38, 42
br i1 %39, label %40, label %41
40: ; preds = %35
store i32 44, i32* %4
br label %58
41: ; preds = %35
%42 = load %struct.fact_table*, %struct.fact_table** %5
%43 = load %struct.world_list*, %struct.world_list** %8
%44 = call i32 @check_end_of_field(%struct.fact_table* %42, %struct.world_list* %43)
%45 = icmp ne i32 %44, 42
br i1 %45, label %46, label %47
46: ; preds = %41
store i32 47, i32* %4
br label %58
47: ; preds = %41
%48 = load %struct.fact_table*, %struct.fact_table** %5
%49 = load %struct.world_list*, %struct.world_list** %8
%50 = call i32 @check_invalid_start_path(%struct.fact_table* %48, %struct.world_list* %49)
%51 = icmp ne i32 %50, 42
br i1 %51, label %52, label %53
52: ; preds = %47
store i32 48, i32* %4
br label %58
53: ; preds = %47
%54 = load %struct.fact_table*, %struct.fact_table** %5
%55 = load %struct.world_list*, %struct.world_list** %8
%56 = load i32, i32* %7
%57 = call i32 @valid_path(%struct.fact_table* %54, %struct.world_list* %55, i32 %56)
store i32 %57, i32* %4
br label %58
58: ; preds = %53, %52, %46, %40, %34, %28, %23, %16
%59 = load i32, i32* %4
ret i32 %59
}

LLVM IR (-O2):
%struct.fact_table = type { i32 }
%struct.world_list = type { i32 }
define i32 @test_everything(%struct.fact_table* %0, i8* %1, i32 %2) {
%4 = bitcast i8* %1 to %struct.world_list*
%5 = tail call i32 @check_for_initial_fact(%struct.fact_table* %0, %struct.world_list* %4, i32 %2)
%6 = icmp eq i32 %5, 42
br i1 %6, label %7, label %27
7: ; preds = %3
%8 = tail call i32 @check_for_extra_fact(%struct.fact_table* %0, %struct.world_list* %4, i32 %2)
%9 = icmp eq i32 %8, 42
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = tail call i64 @duplicate_fact(%struct.fact_table* %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %27
13: ; preds = %10
%14 = tail call i32 @check_unknown_id(%struct.fact_table* %0, %struct.world_list* %4)
%15 = icmp eq i32 %14, 42
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = tail call i32 @check_incorrect(%struct.fact_table* %0, %struct.world_list* %4)
%18 = icmp eq i32 %17, 42
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = tail call i32 @check_end_of_field(%struct.fact_table* %0, %struct.world_list* %4)
%21 = icmp eq i32 %20, 42
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = tail call i32 @check_invalid_start_path(%struct.fact_table* %0, %struct.world_list* %4)
%24 = icmp eq i32 %23, 42
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @valid_path(%struct.fact_table* %0, %struct.world_list* %4, i32 %2)
br label %27
27: ; preds = %22, %19, %16, %13, %10, %7, %3, %25
%28 = phi i32 [ %26, %25 ], [ 46, %3 ], [ 43, %7 ], [ 50, %10 ], [ 49, %13 ], [ 44, %16 ], [ 47, %19 ], [ 48, %22 ]
ret i32 %28
}