#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ print_class1(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_all() {
  FILE *file;
  int class = 0, win = 0, lost = 0, i = 0, delete = 0;
  int win_c = 0, lost_c = 0, runs = 0;
  double winp = 0.00;
  file = fopen("Stats.txt", "r");
  printf("\n __________________________________ \n");
  printf(": All Arena Runs                   :\n");
  printf(": -------------------------------- :\n");
  while (fscanf(file, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
    if (delete == 0) {
      win_c += win;
      lost_c += lost;
      print_class1(class, win, lost);
      runs++;
      i++;
    }
  }
  winp = ((double)win_c / ((double)win_c + (double)lost_c)) * 100;
  if (win_c + lost_c == 0) {
    winp = 0;
  }
  printf(": -------------------------------- :\n");
  printf(": Matches: %4d                    :\n"
         ": Runs:    %4d                    :\n"
         ": Wins:    %4d                    :\n"
         ": Loss:    %4d                    :\n"
         ": Win Percentage: %.2lf %%          :\n",
         win_c + lost_c, runs, win_c, lost_c, winp);
  printf(":__________________________________: \n\n");
  fclose(file);
}


x86 assembly (clang, -O0):
<print_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xe69(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x1c(%rbp),%r9
call   1060 <fscanf@plt>
mov    0x2de8(%rip),%rcx
cmp    (%rcx),%rax
je     124a <print_all+0xfa>
cmpl   $0x0,-0x1c(%rbp)
jne    1245 <print_all+0xf5>
mov    -0x10(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <print_class1@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d9 <print_all+0x89>
cvtsi2sdl -0x20(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xd97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    $0x0,%eax
jne    1289 <print_all+0x139>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
add    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
movsd  -0x30(%rbp),%xmm0
lea    0xde0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_all>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe74(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf47(%rip),%rdi
call   1030 <puts@plt>
lea    0xf60(%rip),%rdi
call   1030 <puts@plt>
lea    0xe46(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %r14,%rdi
call   1070 <fscanf@plt>
mov    0x2df9(%rip),%rcx
xor    %ebx,%ebx
mov    $0x0,%ebp
mov    $0x0,%r15d
cmp    (%rcx),%rax
jne    127c <print_all+0x11c>
mov    %ebp,%r12d
xorpd  %xmm1,%xmm1
add    %ebx,%r12d
je     1228 <print_all+0xc8>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
cvtsi2sd %ebp,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
mulsd  0xdd8(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0xddf(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
lea    0x4(%rsp),%r13
mov    %rsp,%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    12bf <print_all+0x15f>
nopl   (%rax)
mov    %r14,%rdi
lea    0xd7a(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r13,%r8
mov    %r12,%r9
call   1070 <fscanf@plt>
mov    0x2d32(%rip),%rcx
cmp    (%rcx),%rax
je     1201 <print_all+0xa1>
cmpl   $0x0,(%rsp)
jne    1290 <print_all+0x130>
mov    0x8(%rsp),%esi
add    %esi,%ebx
mov    0x4(%rsp),%edx
add    %edx,%ebp
mov    0xc(%rsp),%edi
call   1060 <print_class1@plt>
add    $0x1,%r15d
jmp    1290 <print_all+0x130>

LLVM IR (-O0):
@.str = [10 x i8] c"Stats.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [39 x i8] c"\0A __________________________________ \0A\00"
@.str.3 = [38 x i8] c": All Arena Runs :\0A\00"
@.str.4 = [38 x i8] c": -------------------------------- :\0A\00"
@.str.5 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.6 = [183 x i8] c": Matches: %4d :\0A: Runs: %4d :\0A: Wins: %4d :\0A: Loss: %4d :\0A: Win Percentage: %.2lf %% :\0A\00"
@.str.7 = [40 x i8] c":__________________________________: \0A\0A\00"
define void @print_all() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store double 0.000000e+00, double* %10
%11 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %38, %0
%16 = load i32*, i32** %1
%17 = call i64 @fscanf(i32* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %6)
%18 = load i64, i64* @EOF
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %39
20: ; preds = %15
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load i32, i32* %3
%25 = load i32, i32* %7
%26 = add nsw i32 %25, %24
store i32 %26, i32* %7
%27 = load i32, i32* %4
%28 = load i32, i32* %8
%29 = add nsw i32 %28, %27
store i32 %29, i32* %8
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 @print_class1(i32 %30, i32 %31, i32 %32)
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %23, %20
br label %15
39: ; preds = %15
%40 = load i32, i32* %7
%41 = sitofp i32 %40 to double
%42 = load i32, i32* %7
%43 = sitofp i32 %42 to double
%44 = load i32, i32* %8
%45 = sitofp i32 %44 to double
%46 = fadd double %43, %45
%47 = fdiv double %41, %46
%48 = fmul double %47, 1.000000e+02
store double %48, double* %10
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = add nsw i32 %49, %50
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %39
store double 0.000000e+00, double* %10
br label %54
54: ; preds = %53, %39
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%56 = load i32, i32* %7
%57 = load i32, i32* %8
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %9
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = load double, double* %10
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.6, i64 0, i64 0), i32 %58, i32 %59, i32 %60, i32 %61, double %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%65 = load i32*, i32** %1
%66 = call i32 @fclose(i32* %65)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Stats.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.5 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.6 = [183 x i8] c": Matches: %4d :\0A: Runs: %4d :\0A: Wins: %4d :\0A: Loss: %4d :\0A: Win Percentage: %.2lf %% :\0A\00"
@str = [38 x i8] c"\0A __________________________________ \00"
@str.8 = [37 x i8] c": All Arena Runs :\00"
@str.10 = [37 x i8] c": -------------------------------- :\00"
@str.11 = [39 x i8] c":__________________________________: \0A\00"
define void @print_all() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.8, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.10, i64 0, i64 0))
%13 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %37, label %16
16: ; preds = %0, %30
%17 = phi i32 [ %33, %30 ], [ 0, %0 ]
%18 = phi i32 [ %32, %30 ], [ 0, %0 ]
%19 = phi i32 [ %31, %30 ], [ 0, %0 ]
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, %19
%25 = load i32, i32* %3
%26 = add nsw i32 %25, %18
%27 = load i32, i32* %1
%28 = call i32 @print_class1(i32 %27, i32 %23, i32 %25)
%29 = add nsw i32 %17, 1
br label %30
30: ; preds = %22, %16
%31 = phi i32 [ %24, %22 ], [ %19, %16 ]
%32 = phi i32 [ %26, %22 ], [ %18, %16 ]
%33 = phi i32 [ %29, %22 ], [ %17, %16 ]
%34 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%35 = load i64, i64* @EOF
%36 = icmp eq i64 %34, %35
br i1 %36, label %37, label %16
37: ; preds = %30, %0
%38 = phi i32 [ 0, %0 ], [ %31, %30 ]
%39 = phi i32 [ 0, %0 ], [ %32, %30 ]
%40 = phi i32 [ 0, %0 ], [ %33, %30 ]
%41 = sitofp i32 %38 to double
%42 = sitofp i32 %39 to double
%43 = fadd double %41, %42
%44 = fdiv double %41, %43
%45 = fmul double %44, 1.000000e+02
%46 = add nsw i32 %39, %38
%47 = icmp eq i32 %46, 0
%48 = select i1 %47, double 0.000000e+00, double %45
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.10, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([183 x i8], [183 x i8]* @.str.6, i64 0, i64 0), i32 %46, i32 %40, i32 %38, i32 %39, double %48)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.11, i64 0, i64 0))
%52 = call i32 @fclose(i32* %9)
ret void
}