#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_top3(int, double, int, double, int, double);
int /*<<< orphan*/ printf(char *);
void best_class() {
  FILE *file;
  int class = 0, win = 0, lost = 0, i = 0, delete = 0;
  double win_c = 0, lost_c = 0, runs = 0, temp_points = 0;
  int top1 = 0, top2 = 0, top3 = 0, top4 = 0, top5 = 0;
  double p1 = 0, p2 = 0, p3 = 0, p4 = 0, p5 = 0;
  double winp = 0.00;
  for (i = 0; i < 9; i++) {
    file = fopen("Stats.txt", "r");
    while (fscanf(file, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
      if (delete == 0 && class == i + 1) {
        runs++;
        temp_points += win;
      }
    }
    fclose(file);
    p5 = temp_points / runs;
    if (p1 < p5) {
      p1 = p5;
      top1 = i + 1;
    } else if (p2 < p5) {
      p2 = p5;
      top2 = i + 1;
    } else if (p3 < p5) {
      p3 = p5;
      top3 = i + 1;
    }
    temp_points = 0;
    runs = 0;
  }
  printf("\n __________________________________ \n");
  printf(": Best Three Played Classes        :\n"
         ": -------------------------------- :\n");
  print_top3(top1, p1, top2, p2, top3, p3);
  printf(":__________________________________:\n");
}


x86 assembly (clang, -O0):
<best_class>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    134c <best_class+0x1fc>
lea    0xdfc(%rip),%rdi
lea    0xdff(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xded(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x1c(%rbp),%r9
call   1050 <fscanf@plt>
mov    0x2da5(%rip),%rcx
cmp    (%rcx),%rax
je     128d <best_class+0x13d>
cmpl   $0x0,-0x1c(%rbp)
jne    1288 <best_class+0x138>
mov    -0xc(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1288 <best_class+0x138>
movsd  0xd91(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    121c <best_class+0xcc>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
movsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12d1 <best_class+0x181>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    132e <best_class+0x1de>
movsd  -0x68(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12fd <best_class+0x1ad>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1329 <best_class+0x1d9>
movsd  -0x70(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1324 <best_class+0x1d4>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1329 <best_class+0x1d9>
jmp    132e <best_class+0x1de>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fb <best_class+0xab>
lea    0xccd(%rip),%rdi
call   1040 <printf@plt>
lea    0xce8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x44(%rbp),%edi
movsd  -0x60(%rbp),%xmm0
mov    -0x48(%rbp),%esi
movsd  -0x68(%rbp),%xmm1
mov    -0x4c(%rbp),%edx
movsd  -0x70(%rbp),%xmm2
call   1070 <print_top3@plt>
lea    0xd0a(%rip),%rdi
call   1040 <printf@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<best_class>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x4c(%rsp)
movl   $0x0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
xor    %ecx,%ecx
lea    0x24(%rsp),%rbx
lea    0x4c(%rsp),%r14
lea    0x20(%rsp),%r15
mov    0x2e48(%rip),%r13
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x40(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
jmp    11f1 <best_class+0xa1>
xchg   %ax,%ax
mov    0x28(%rsp),%rcx
add    $0x1,%ecx
mov    %ecx,%eax
mov    %ecx,0x1c(%rsp)
movapd %xmm2,%xmm1
movsd  %xmm1,0x40(%rsp)
cmp    $0x9,%ecx
je     136c <best_class+0x21c>
mov    %rcx,0x28(%rsp)
lea    0xe13(%rip),%rdi
lea    0xe16(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
lea    0xe06(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1050 <fscanf@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm3,%xmm3
cmp    0x0(%r13),%rax
jne    1290 <best_class+0x140>
movsd  0x8(%rsp),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12,%rdi
call   1040 <fclose@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x40(%rsp),%xmm1
ucomisd %xmm1,%xmm2
ja     11d0 <best_class+0x80>
ucomisd 0x38(%rsp),%xmm2
jbe    1340 <best_class+0x1f0>
mov    0x28(%rsp),%rcx
add    $0x1,%ecx
mov    %ecx,%eax
mov    %ecx,0x18(%rsp)
movsd  %xmm2,0x38(%rsp)
jmp    11e2 <best_class+0x92>
mov    0x28(%rsp),%rax
lea    0x1(%rax),%ebp
xorpd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm3
jmp    12f1 <best_class+0x1a1>
nopl   0x0(%rax,%rax,1)
movsd  %xmm3,0x50(%rsp)
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
mov    %r12,%rdi
lea    0xd52(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1050 <fscanf@plt>
movsd  0x50(%rsp),%xmm3
movapd %xmm3,%xmm0
cmp    0x0(%r13),%rax
je     123d <best_class+0xed>
mov    0x14(%rsp),%eax
xor    %ebp,%eax
or     0x20(%rsp),%eax
addsd  0xcfd(%rip),%xmm3
je     1320 <best_class+0x1d0>
movsd  0xcfb(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
je     12b0 <best_class+0x160>
jmp    1335 <best_class+0x1e5>
nopw   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sdl 0x24(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
je     12b0 <best_class+0x160>
movapd %xmm0,%xmm3
jmp    12b0 <best_class+0x160>
xchg   %ax,%ax
mov    0x28(%rsp),%rcx
add    $0x1,%ecx
movsd  0x30(%rsp),%xmm0
ucomisd %xmm0,%xmm2
mov    0x10(%rsp),%eax
cmova  %ecx,%eax
mov    %eax,0x10(%rsp)
maxsd  %xmm0,%xmm2
movsd  %xmm2,0x30(%rsp)
jmp    11e2 <best_class+0x92>
lea    0xcb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xccf(%rip),%rdi
call   1030 <puts@plt>
mov    0x1c(%rsp),%edi
movsd  0x40(%rsp),%xmm0
mov    0x18(%rsp),%esi
movsd  0x38(%rsp),%xmm1
mov    0x10(%rsp),%edx
movsd  0x30(%rsp),%xmm2
call   1070 <print_top3@plt>
lea    0xcea(%rip),%rdi
call   1030 <puts@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Stats.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.3 = [39 x i8] c"\0A __________________________________ \0A\00"
@.str.4 = [75 x i8] c": Best Three Played Classes :\0A: -------------------------------- :\0A\00"
@.str.5 = [38 x i8] c":__________________________________:\0A\00"
define void @best_class() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = 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 double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
store i32 0, i32* %5
br label %22
22: ; preds = %80, %0
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 9
br i1 %24, label %25, label %83
25: ; preds = %22
%26 = 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* %26, i32** %1
br label %27
27: ; preds = %47, %25
%28 = load i32*, i32** %1
%29 = call i64 @fscanf(i32* %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %6)
%30 = load i64, i64* @EOF
%31 = icmp ne i64 %29, %30
br i1 %31, label %32, label %48
32: ; preds = %27
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %47
35: ; preds = %32
%36 = load i32, i32* %2
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
%39 = icmp eq i32 %36, %38
br i1 %39, label %40, label %47
40: ; preds = %35
%41 = load double, double* %9
%42 = fadd double %41, 1.000000e+00
store double %42, double* %9
%43 = load i32, i32* %3
%44 = sitofp i32 %43 to double
%45 = load double, double* %10
%46 = fadd double %45, %44
store double %46, double* %10
br label %47
47: ; preds = %40, %35, %32
br label %27
48: ; preds = %27
%49 = load i32*, i32** %1
%50 = call i32 @fclose(i32* %49)
%51 = load double, double* %10
%52 = load double, double* %9
%53 = fdiv double %51, %52
store double %53, double* %20
%54 = load double, double* %16
%55 = load double, double* %20
%56 = fcmp olt double %54, %55
br i1 %56, label %57, label %61
57: ; preds = %48
%58 = load double, double* %20
store double %58, double* %16
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %11
br label %79
61: ; preds = %48
%62 = load double, double* %17
%63 = load double, double* %20
%64 = fcmp olt double %62, %63
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = load double, double* %20
store double %66, double* %17
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %12
br label %78
69: ; preds = %61
%70 = load double, double* %18
%71 = load double, double* %20
%72 = fcmp olt double %70, %71
br i1 %72, label %73, label %77
73: ; preds = %69
%74 = load double, double* %20
store double %74, double* %18
%75 = load i32, i32* %5
%76 = add nsw i32 %75, 1
store i32 %76, i32* %13
br label %77
77: ; preds = %73, %69
br label %78
78: ; preds = %77, %65
br label %79
79: ; preds = %78, %57
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %9
br label %80
80: ; preds = %79
%81 = load i32, i32* %5
%82 = add nsw i32 %81, 1
store i32 %82, i32* %5
br label %22
83: ; preds = %22
%84 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%85 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0))
%86 = load i32, i32* %11
%87 = load double, double* %16
%88 = load i32, i32* %12
%89 = load double, double* %17
%90 = load i32, i32* %13
%91 = load double, double* %18
%92 = call i32 @print_top3(i32 %86, double %87, i32 %88, double %89, i32 %90, double %91)
%93 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, 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.2 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@str = [38 x i8] c"\0A __________________________________ \00"
@str.6 = [74 x i8] c": Best Three Played Classes :\0A: -------------------------------- :\00"
@str.7 = [37 x i8] c":__________________________________:\00"
define void @best_class() {
%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
br label %9
9: ; preds = %0, %57
%10 = phi i32 [ 0, %0 ], [ %58, %57 ]
%11 = phi double [ 0.000000e+00, %0 ], [ %64, %57 ]
%12 = phi double [ 0.000000e+00, %0 ], [ %63, %57 ]
%13 = phi double [ 0.000000e+00, %0 ], [ %62, %57 ]
%14 = phi i32 [ 0, %0 ], [ %61, %57 ]
%15 = phi i32 [ 0, %0 ], [ %60, %57 ]
%16 = phi i32 [ 0, %0 ], [ %59, %57 ]
%17 = 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))
%18 = call i64 @fscanf(i32* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %40, label %21
21: ; preds = %9
%22 = add nuw nsw i32 %10, 1
br label %23
23: ; preds = %21, %23
%24 = phi double [ 0.000000e+00, %21 ], [ %36, %23 ]
%25 = phi double [ 0.000000e+00, %21 ], [ %35, %23 ]
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 0
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, %22
%30 = select i1 %27, i1 %29, i1 false
%31 = fadd double %24, 1.000000e+00
%32 = load i32, i32* %2
%33 = sitofp i32 %32 to double
%34 = select i1 %30, double %33, double -0.000000e+00
%35 = fadd double %25, %34
%36 = select i1 %30, double %31, double %24
%37 = call i64 @fscanf(i32* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%38 = load i64, i64* @EOF
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %23
40: ; preds = %23, %9
%41 = phi double [ 0.000000e+00, %9 ], [ %35, %23 ]
%42 = phi double [ 0.000000e+00, %9 ], [ %36, %23 ]
%43 = call i32 @fclose(i32* %17)
%44 = fdiv double %41, %42
%45 = fcmp olt double %13, %44
br i1 %45, label %46, label %48
46: ; preds = %40
%47 = add nuw nsw i32 %10, 1
br label %57
48: ; preds = %40
%49 = fcmp olt double %12, %44
br i1 %49, label %50, label %52
50: ; preds = %48
%51 = add nuw nsw i32 %10, 1
br label %57
52: ; preds = %48
%53 = fcmp olt double %11, %44
%54 = add nuw nsw i32 %10, 1
%55 = select i1 %53, i32 %54, i32 %15
%56 = select i1 %53, double %44, double %11
br label %57
57: ; preds = %52, %50, %46
%58 = phi i32 [ %51, %50 ], [ %47, %46 ], [ %54, %52 ]
%59 = phi i32 [ %51, %50 ], [ %16, %46 ], [ %16, %52 ]
%60 = phi i32 [ %15, %50 ], [ %15, %46 ], [ %55, %52 ]
%61 = phi i32 [ %14, %50 ], [ %47, %46 ], [ %14, %52 ]
%62 = phi double [ %13, %50 ], [ %44, %46 ], [ %13, %52 ]
%63 = phi double [ %44, %50 ], [ %12, %46 ], [ %12, %52 ]
%64 = phi double [ %11, %50 ], [ %11, %46 ], [ %56, %52 ]
%65 = icmp eq i32 %58, 9
br i1 %65, label %66, label %9
66: ; preds = %57
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.6, i64 0, i64 0))
%69 = call i32 @print_top3(i32 %61, double %62, i32 %59, double %63, i32 %60, double %64)
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
ret void
}