#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*/ make_nodes();
int /*<<< orphan*/ printf(char *, int, int const);
int /*<<< orphan*/ remove_nodes();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
scalar_t__ test1();
scalar_t__ test2();
scalar_t__ test3();
scalar_t__ test4();
scalar_t__ test5();
scalar_t__ test6();
scalar_t__ test7();
scalar_t__ test8();
scalar_t__ test9();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ unlink(char *);
int main(void) {
  int num_passed = 0;
  const int total = 9;
  srand(time(NULL));
  make_nodes();
  if (test1() == 0)
    num_passed++;
  if (test2() == 0)
    num_passed++;
  if (test3() == 0)
    num_passed++;
  if (test4() == 0)
    num_passed++;
  if (test5() == 0)
    num_passed++;
  if (test6() == 0)
    num_passed++;
  if (test7() == 0)
    num_passed++;
  if (test8() == 0)
    num_passed++;
  if (test9() == 0)
    num_passed++;
  remove_nodes();
  unlink("testfile.in");
  unlink("testfile.out");
  printf("\nFinal score: %d/%d\n", num_passed, total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
mov    $0x0,%al
call   10b0 <make_nodes@plt>
mov    $0x0,%al
call   1070 <test1@plt>
cmp    $0x0,%rax
jne    123e <main+0x4e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1100 <test2@plt>
cmp    $0x0,%rax
jne    1258 <main+0x68>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test3@plt>
cmp    $0x0,%rax
jne    1272 <main+0x82>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10f0 <test4@plt>
cmp    $0x0,%rax
jne    128c <main+0x9c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <test5@plt>
cmp    $0x0,%rax
jne    12a6 <main+0xb6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10e0 <test6@plt>
cmp    $0x0,%rax
jne    12c0 <main+0xd0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test7@plt>
cmp    $0x0,%rax
jne    12da <main+0xea>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1110 <test8@plt>
cmp    $0x0,%rax
jne    12f4 <main+0x104>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <test9@plt>
cmp    $0x0,%rax
jne    130e <main+0x11e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10c0 <remove_nodes@plt>
lea    0xce4(%rip),%rdi
call   1030 <unlink@plt>
lea    0xce4(%rip),%rdi
call   1030 <unlink@plt>
mov    -0x8(%rbp),%esi
lea    0xce2(%rip),%rdi
mov    $0x9,%edx
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
xor    %eax,%eax
call   10b0 <make_nodes@plt>
xor    %eax,%eax
call   1070 <test1@plt>
xor    %r14d,%r14d
test   %rax,%rax
sete   %r14b
xor    %eax,%eax
call   1100 <test2@plt>
lea    0x1(%r14),%ebx
test   %rax,%rax
cmovne %r14d,%ebx
xor    %eax,%eax
call   1060 <test3@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   10f0 <test4@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   1050 <test5@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   10e0 <test6@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   1040 <test7@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   1110 <test8@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   1090 <test9@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
xor    %eax,%eax
call   10c0 <remove_nodes@plt>
lea    0xd64(%rip),%rdi
call   1030 <unlink@plt>
lea    0xd64(%rip),%rdi
call   1030 <unlink@plt>
lea    0xd65(%rip),%rdi
mov    %ebx,%esi
mov    $0x9,%edx
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"testfile.in\00"
@.str.1 = [13 x i8] c"testfile.out\00"
@.str.2 = [21 x i8] c"\0AFinal score: %d/%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 9, i32* %3
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @make_nodes()
%7 = call i64 (...) @test1()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %0
%13 = call i64 (...) @test2()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %12
%19 = call i64 (...) @test3()
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %24
24: ; preds = %21, %18
%25 = call i64 (...) @test4()
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %24
%31 = call i64 (...) @test5()
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %36
36: ; preds = %33, %30
%37 = call i64 (...) @test6()
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
br label %42
42: ; preds = %39, %36
%43 = call i64 (...) @test7()
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %48
48: ; preds = %45, %42
%49 = call i64 (...) @test8()
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %54
54: ; preds = %51, %48
%55 = call i64 (...) @test9()
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %60
60: ; preds = %57, %54
%61 = call i32 (...) @remove_nodes()
%62 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%63 = call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%64 = load i32, i32* %2
%65 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %64, i32 9)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"testfile.in\00"
@.str.1 = [13 x i8] c"testfile.out\00"
@.str.2 = [21 x i8] c"\0AFinal score: %d/%d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @make_nodes()
%4 = tail call i64 (...) @test1()
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i64 (...) @test2()
%8 = icmp eq i64 %7, 0
%9 = select i1 %5, i32 2, i32 1
%10 = select i1 %8, i32 %9, i32 %6
%11 = tail call i64 (...) @test3()
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %10, %13
%15 = tail call i64 (...) @test4()
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %14, %17
%19 = tail call i64 (...) @test5()
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %18, %21
%23 = tail call i64 (...) @test6()
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = add nuw nsw i32 %22, %25
%27 = tail call i64 (...) @test7()
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = add nuw nsw i32 %26, %29
%31 = tail call i64 (...) @test8()
%32 = icmp eq i64 %31, 0
%33 = zext i1 %32 to i32
%34 = add nuw nsw i32 %30, %33
%35 = tail call i64 (...) @test9()
%36 = icmp eq i64 %35, 0
%37 = zext i1 %36 to i32
%38 = add nuw nsw i32 %34, %37
%39 = tail call i32 (...) @remove_nodes()
%40 = tail call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%41 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%42 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %38, i32 9)
ret i32 0
}