#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_class(int);
int /*<<< orphan*/ printf(char *, ...);
void print_run(int class_num) {
  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");
  print_class(class_num);
  printf("\n: -------------------------------- :\n");
  while (fscanf(file, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
    if (class == class_num && delete == 0) {
      win_c += win;
      lost_c += lost;
      printf(": %d ~ Wins - %4d   Loss - %4d    :\n", i + 1, 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_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%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)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe66(%rip),%rdi
lea    0xe69(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <print_class@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1050 <fscanf@plt>
mov    0x2deb(%rip),%rcx
cmp    (%rcx),%rax
je     125f <print_run+0x10f>
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    125a <print_run+0x10a>
cmpl   $0x0,-0x24(%rbp)
jne    125a <print_run+0x10a>
mov    -0x18(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d6 <print_run+0x86>
cvtsi2sdl -0x28(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xd82(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
cmp    $0x0,%eax
jne    129e <print_run+0x14e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
add    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
movsd  -0x38(%rbp),%xmm0
lea    0xdcb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_run>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r15d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe71(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xf4f(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%edi
call   1070 <print_class@plt>
lea    0xf61(%rip),%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %r14,%rdi
call   1060 <fscanf@plt>
mov    0x2dfa(%rip),%rcx
xor    %ebx,%ebx
mov    $0x0,%ebp
mov    $0x0,%r12d
cmp    (%rcx),%rax
jne    127b <print_run+0x11b>
mov    %ebp,%r15d
xorpd  %xmm1,%xmm1
add    %ebx,%r15d
je     1227 <print_run+0xc7>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
cvtsi2sd %ebp,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
mulsd  0xdd9(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xe05(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xee9(%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    %r12d,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    12c1 <print_run+0x161>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
lea    0xd7a(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
call   1060 <fscanf@plt>
mov    0x2d30(%rip),%rcx
cmp    (%rcx),%rax
je     1200 <print_run+0xa0>
cmp    %r15d,0xc(%rsp)
jne    1290 <print_run+0x130>
cmpl   $0x0,(%rsp)
jne    1290 <print_run+0x130>
mov    0x8(%rsp),%edx
add    %edx,%ebx
mov    0x4(%rsp),%ecx
add    %ecx,%ebp
add    $0x1,%r13d
lea    0xd3b(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12d
jmp    1290 <print_run+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 = [39 x i8] c"\0A: -------------------------------- :\0A\00"
@.str.4 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.5 = [37 x i8] c": %d ~ Wins - %4d Loss - %4d :\0A\00"
@.str.6 = [38 x i8] c": -------------------------------- :\0A\00"
@.str.7 = [183 x i8] c": Matches: %4d :\0A: Runs: %4d :\0A: Wins: %4d :\0A: Loss: %4d :\0A: Win Percentage: %.2lf %% :\0A\00"
@.str.8 = [40 x i8] c":__________________________________: \0A\0A\00"
define void @print_run(i32 %0) {
%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 i32
%11 = alloca i32
%12 = alloca double
store i32 %0, i32* %2
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 i32 0, i32* %10
store i32 0, i32* %11
store double 0.000000e+00, double* %12
%13 = 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* %13, i32** %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = call i32 @print_class(i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %46, %1
%19 = load i32*, i32** %3
%20 = call i64 @fscanf(i32* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %8)
%21 = load i64, i64* @EOF
%22 = icmp ne i64 %20, %21
br i1 %22, label %23, label %47
23: ; preds = %18
%24 = load i32, i32* %4
%25 = load i32, i32* %2
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %46
27: ; preds = %23
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load i32, i32* %5
%32 = load i32, i32* %9
%33 = add nsw i32 %32, %31
store i32 %33, i32* %9
%34 = load i32, i32* %6
%35 = load i32, i32* %10
%36 = add nsw i32 %35, %34
store i32 %36, i32* %10
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %38, i32 %39, i32 %40)
%42 = load i32, i32* %11
%43 = add nsw i32 %42, 1
store i32 %43, i32* %11
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %46
46: ; preds = %30, %27, %23
br label %18
47: ; preds = %18
%48 = load i32, i32* %9
%49 = sitofp i32 %48 to double
%50 = load i32, i32* %9
%51 = sitofp i32 %50 to double
%52 = load i32, i32* %10
%53 = sitofp i32 %52 to double
%54 = fadd double %51, %53
%55 = fdiv double %49, %54
%56 = fmul double %55, 1.000000e+02
store double %56, double* %12
%57 = load i32, i32* %9
%58 = load i32, i32* %10
%59 = add nsw i32 %57, %58
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %47
store double 0.000000e+00, double* %12
br label %62
62: ; preds = %61, %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = add nsw i32 %64, %65
%67 = load i32, i32* %11
%68 = load i32, i32* %9
%69 = load i32, i32* %10
%70 = load double, double* %12
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.7, i64 0, i64 0), i32 %66, i32 %67, i32 %68, i32 %69, double %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%73 = load i32*, i32** %3
%74 = call i32 @fclose(i32* %73)
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.5 = [37 x i8] c": %d ~ Wins - %4d Loss - %4d :\0A\00"
@.str.7 = [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.9 = [38 x i8] c"\0A: -------------------------------- :\00"
@str.10 = [37 x i8] c": -------------------------------- :\00"
@str.11 = [39 x i8] c":__________________________________: \0A\00"
define void @print_run(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%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 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = 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))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @print_class(i32 %0)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.9, i64 0, i64 0))
%14 = call i64 @fscanf(i32* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %43, label %17
17: ; preds = %1, %35
%18 = phi i32 [ %39, %35 ], [ 0, %1 ]
%19 = phi i32 [ %38, %35 ], [ 0, %1 ]
%20 = phi i32 [ %37, %35 ], [ 0, %1 ]
%21 = phi i32 [ %36, %35 ], [ 0, %1 ]
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, %0
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 0
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %27, label %35
27: ; preds = %17
%28 = load i32, i32* %3
%29 = add nsw i32 %28, %20
%30 = load i32, i32* %4
%31 = add nsw i32 %30, %19
%32 = add nsw i32 %21, 1
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %32, i32 %28, i32 %30)
%34 = add nsw i32 %18, 1
br label %35
35: ; preds = %27, %17
%36 = phi i32 [ %32, %27 ], [ %21, %17 ]
%37 = phi i32 [ %29, %27 ], [ %20, %17 ]
%38 = phi i32 [ %31, %27 ], [ %19, %17 ]
%39 = phi i32 [ %34, %27 ], [ %18, %17 ]
%40 = call i64 @fscanf(i32* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%41 = load i64, i64* @EOF
%42 = icmp eq i64 %40, %41
br i1 %42, label %43, label %17
43: ; preds = %35, %1
%44 = phi i32 [ 0, %1 ], [ %37, %35 ]
%45 = phi i32 [ 0, %1 ], [ %38, %35 ]
%46 = phi i32 [ 0, %1 ], [ %39, %35 ]
%47 = sitofp i32 %44 to double
%48 = sitofp i32 %45 to double
%49 = fadd double %47, %48
%50 = fdiv double %47, %49
%51 = fmul double %50, 1.000000e+02
%52 = add nsw i32 %45, %44
%53 = icmp eq i32 %52, 0
%54 = select i1 %53, double 0.000000e+00, double %51
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.10, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([183 x i8], [183 x i8]* @.str.7, i64 0, i64 0), i32 %52, i32 %46, i32 %44, i32 %45, double %54)
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.11, i64 0, i64 0))
%58 = call i32 @fclose(i32* %10)
ret void
}