#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*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
void pre_stats() {
  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(": Statistics                       :\n");
  while (fscanf(file, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
    if (delete == 0) {
      win_c += win;
      lost_c += lost;
      runs++;
    }
  }
  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");
}


x86 assembly (clang, -O0):
<pre_stats>:
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    0xe89(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x1c(%rbp),%r9
call   1040 <fscanf@plt>
mov    0x2e16(%rip),%rcx
cmp    (%rcx),%rax
je     1205 <pre_stats+0xd5>
cmpl   $0x0,-0x1c(%rbp)
jne    1200 <pre_stats+0xd0>
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    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ab <pre_stats+0x7b>
cvtsi2sdl -0x20(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xddc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    $0x0,%eax
jne    1244 <pre_stats+0x114>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <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    0xe25(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pre_stats>:
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    0xe94(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf67(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rbx,%rdi
call   1050 <fscanf@plt>
mov    0x2e25(%rip),%rcx
xor    %r15d,%r15d
mov    $0x0,%ebp
mov    $0x0,%r14d
cmp    (%rcx),%rax
jne    1249 <pre_stats+0x109>
mov    %ebp,%ebx
xorpd  %xmm1,%xmm1
add    %r15d,%ebx
je     11fd <pre_stats+0xbd>
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
cvtsi2sd %ebp,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
mulsd  0xe03(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xe0a(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
mov    %ebp,%r8d
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
lea    0x4(%rsp),%r13
mov    %rsp,%r12
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    128f <pre_stats+0x14f>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xdaa(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r13,%r8
mov    %r12,%r9
call   1050 <fscanf@plt>
mov    0x2d62(%rip),%rcx
cmp    (%rcx),%rax
je     11d6 <pre_stats+0x96>
cmpl   $0x0,(%rsp)
jne    1260 <pre_stats+0x120>
add    0x8(%rsp),%r15d
add    0x4(%rsp),%ebp
add    $0x1,%r14d
jmp    1260 <pre_stats+0x120>

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": Statistics :\0A\00"
@.str.4 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.5 = [38 x i8] c": -------------------------------- :\0A\00"
@.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 = [39 x i8] c":__________________________________: \0A\00"
define void @pre_stats() {
%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))
br label %14
14: ; preds = %31, %0
%15 = load i32*, i32** %1
%16 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %6)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %32
19: ; preds = %14
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load i32, i32* %3
%24 = load i32, i32* %7
%25 = add nsw i32 %24, %23
store i32 %25, i32* %7
%26 = load i32, i32* %4
%27 = load i32, i32* %8
%28 = add nsw i32 %27, %26
store i32 %28, i32* %8
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %31
31: ; preds = %22, %19
br label %14
32: ; preds = %14
%33 = load i32, i32* %7
%34 = sitofp i32 %33 to double
%35 = load i32, i32* %7
%36 = sitofp i32 %35 to double
%37 = load i32, i32* %8
%38 = sitofp i32 %37 to double
%39 = fadd double %36, %38
%40 = fdiv double %34, %39
%41 = fmul double %40, 1.000000e+02
store double %41, double* %10
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = add nsw i32 %42, %43
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %32
store double 0.000000e+00, double* %10
br label %47
47: ; preds = %46, %32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = add nsw i32 %49, %50
%52 = load i32, i32* %9
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = load double, double* %10
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.6, i64 0, i64 0), i32 %51, i32 %52, i32 %53, i32 %54, double %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Stats.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.4 = [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": Statistics :\00"
@str.9 = [37 x i8] c": -------------------------------- :\00"
@str.10 = [38 x i8] c":__________________________________: \00"
define void @pre_stats() {
%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 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %34, label %15
15: ; preds = %0, %27
%16 = phi i32 [ %30, %27 ], [ 0, %0 ]
%17 = phi i32 [ %29, %27 ], [ 0, %0 ]
%18 = phi i32 [ %28, %27 ], [ 0, %0 ]
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i32, i32* %2
%23 = add nsw i32 %22, %18
%24 = load i32, i32* %3
%25 = add nsw i32 %24, %17
%26 = add nsw i32 %16, 1
br label %27
27: ; preds = %21, %15
%28 = phi i32 [ %23, %21 ], [ %18, %15 ]
%29 = phi i32 [ %25, %21 ], [ %17, %15 ]
%30 = phi i32 [ %26, %21 ], [ %16, %15 ]
%31 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%32 = load i64, i64* @EOF
%33 = icmp eq i64 %31, %32
br i1 %33, label %34, label %15
34: ; preds = %27, %0
%35 = phi i32 [ 0, %0 ], [ %28, %27 ]
%36 = phi i32 [ 0, %0 ], [ %29, %27 ]
%37 = phi i32 [ 0, %0 ], [ %30, %27 ]
%38 = sitofp i32 %35 to double
%39 = sitofp i32 %36 to double
%40 = fadd double %38, %39
%41 = fdiv double %38, %40
%42 = fmul double %41, 1.000000e+02
%43 = add nsw i32 %36, %35
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, double 0.000000e+00, double %42
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.9, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([183 x i8], [183 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %37, i32 %35, i32 %36, double %45)
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.10, i64 0, i64 0))
ret void
}