#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 /*<<< orphan*/ BufFinish();
int /*<<< orphan*/ BufInit();
int /*<<< orphan*/ printf(char *);
int testcase1();
int testcase2();
int testcase3();
int main() {
  BufInit();
  if (testcase1() == 1)
    printf("\n testcase 1 complete. \n\n");
  else
    goto out;
  if (testcase2() == 1)
    printf("\n testcase 2 complete. \n\n");
  else
    goto out;
  if (testcase3() == 1)
    printf("\n testcase 3 complete. \n\n");
  else
    goto out;
out:
  BufFinish();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <BufInit@plt>
mov    $0x0,%al
call   1060 <testcase1@plt>
cmp    $0x1,%eax
jne    1197 <main+0x37>
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
jmp    119c <main+0x3c>
jmp    11ed <main+0x8d>
mov    $0x0,%al
call   1030 <testcase2@plt>
cmp    $0x1,%eax
jne    11bd <main+0x5d>
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
jmp    11c2 <main+0x62>
jmp    11ed <main+0x8d>
mov    $0x0,%al
call   1070 <testcase3@plt>
cmp    $0x1,%eax
jne    11e3 <main+0x83>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
jmp    11e8 <main+0x88>
jmp    11ed <main+0x8d>
jmp    11ed <main+0x8d>
mov    $0x0,%al
call   1040 <BufFinish@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <BufInit@plt>
xor    %eax,%eax
call   1060 <testcase1@plt>
cmp    $0x1,%eax
jne    11b0 <main+0x50>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <testcase2@plt>
cmp    $0x1,%eax
jne    11b0 <main+0x50>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <testcase3@plt>
cmp    $0x1,%eax
jne    11b0 <main+0x50>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <BufFinish@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0A testcase 1 complete. \0A\0A\00"
@.str.1 = [26 x i8] c"\0A testcase 2 complete. \0A\0A\00"
@.str.2 = [26 x i8] c"\0A testcase 3 complete. \0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @BufInit()
%3 = call i32 (...) @testcase1()
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
7: ; preds = %0
br label %21
8: ; preds = %5
%9 = call i32 (...) @testcase2()
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %14
13: ; preds = %8
br label %21
14: ; preds = %11
%15 = call i32 (...) @testcase3()
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %20
19: ; preds = %14
br label %21
20: ; preds = %17
br label %21
21: ; preds = %20, %19, %13, %7
%22 = call i32 (...) @BufFinish()
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"\0A testcase 1 complete. \0A\00"
@str.3 = [25 x i8] c"\0A testcase 2 complete. \0A\00"
@str.4 = [25 x i8] c"\0A testcase 3 complete. \0A\00"
define i32 @main() {
%1 = tail call i32 (...) @BufInit()
%2 = tail call i32 (...) @testcase1()
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %14
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @testcase2()
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
%10 = tail call i32 (...) @testcase3()
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
br label %14
14: ; preds = %8, %4, %0, %12
%15 = tail call i32 (...) @BufFinish()
ret i32 0
}