#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_top3a(int, double, int, double, int, double);
int /*<<< orphan*/ printf(char *);
void played_class() {
  FILE *file;
  int class = 0, win = 0, lost = 0, i = 0, delete = 0;
  int 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++;
      }
    }
    fclose(file);
    if (p1 > runs) {
      if (p2 > runs) {
        if (p3 > runs) {
          runs = 0;
        } else {
          p3 = runs;
          top3 = i + 1;
        }
      } else {
        p2 = runs;
        top2 = i + 1;
      }
    } else {
      p1 = runs;
      top1 = i + 1;
    }
    runs = 0;
  }
  printf("\n __________________________________ \n");
  printf(": Three Most Played Classes        :\n"
         ": -------------------------------- :\n");
  print_top3a(top1, p1, top2, p2, top3, p3);
  printf(":__________________________________:\n");
}


x86 assembly (clang, -O0):
<played_class>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    1314 <played_class+0x1c4>
lea    0xdfe(%rip),%rdi
lea    0xe01(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdef(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x1c(%rbp),%r9
call   1060 <fscanf@plt>
mov    0x2daf(%rip),%rcx
cmp    (%rcx),%rax
je     126b <played_class+0x11b>
cmpl   $0x0,-0x1c(%rbp)
jne    1266 <played_class+0x116>
mov    -0xc(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1266 <played_class+0x116>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1212 <played_class+0xc2>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    12ec <played_class+0x19c>
movsd  -0x50(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    12d4 <played_class+0x184>
movsd  -0x58(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    12bc <played_class+0x16c>
movl   $0x0,-0x28(%rbp)
jmp    12cf <played_class+0x17f>
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12e7 <played_class+0x197>
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12ff <played_class+0x1af>
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11f1 <played_class+0xa1>
lea    0xcfd(%rip),%rdi
call   1050 <printf@plt>
lea    0xd18(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%edi
movsd  -0x48(%rbp),%xmm0
mov    -0x34(%rbp),%esi
movsd  -0x50(%rbp),%xmm1
mov    -0x38(%rbp),%edx
movsd  -0x58(%rbp),%xmm2
call   1030 <print_top3a@plt>
lea    0xd3a(%rip),%rdi
call   1050 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<played_class>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x4c(%rsp)
movl   $0x0,0x48(%rsp)
movl   $0x0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %ecx,%ecx
lea    0xe7b(%rip),%rbx
lea    0x1c(%rsp),%r14
lea    0x4c(%rsp),%r13
lea    0x48(%rsp),%r15
lea    0x18(%rsp),%r12
movl   $0x0,0x14(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
jmp    1201 <played_class+0xb1>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x20(%rsp),%rcx
add    $0x1,%ecx
movapd %xmm0,%xmm2
mov    %ecx,%eax
mov    %ecx,0x14(%rsp)
movsd  %xmm2,0x38(%rsp)
cmp    $0x9,%ecx
je     1329 <played_class+0x1d9>
mov    %rcx,0x20(%rsp)
lea    0xdf3(%rip),%rdi
lea    0xdf6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,0x50(%rsp)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1060 <fscanf@plt>
mov    $0x0,%ebp
mov    0x2da7(%rip),%rcx
cmp    (%rcx),%rax
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%r8
mov    %r12,%rbx
je     12a7 <played_class+0x157>
mov    0x20(%rsp),%rax
add    $0x1,%eax
mov    %eax,0x44(%rsp)
xor    %ebp,%ebp
mov    0x1c(%rsp),%eax
xor    0x44(%rsp),%eax
xor    %ecx,%ecx
or     0x18(%rsp),%eax
sete   %cl
add    %ecx,%ebp
mov    0x50(%rsp),%rdi
mov    %rsi,%r14
mov    %r13,%rcx
mov    %r13,%r15
mov    %rdx,%r13
mov    %r8,%r12
mov    %rbx,%r9
call   1060 <fscanf@plt>
mov    %r12,%r8
mov    %r13,%rdx
mov    %r15,%r13
mov    %r14,%rsi
mov    0x2d46(%rip),%rcx
cmp    (%rcx),%rax
jne    1260 <played_class+0x110>
mov    %rbx,%r12
mov    %r8,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    0x50(%rsp),%rdi
call   1050 <fclose@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x38(%rsp),%xmm2
ucomisd %xmm0,%xmm2
jbe    11e0 <played_class+0x90>
movsd  0x30(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1310 <played_class+0x1c0>
mov    0x20(%rsp),%rcx
add    $0x1,%ecx
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    0xc(%rsp),%eax
cmovbe %ecx,%eax
mov    %eax,0xc(%rsp)
maxsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
jmp    11f2 <played_class+0xa2>
nopl   0x0(%rax)
mov    0x20(%rsp),%rcx
add    $0x1,%ecx
mov    %ecx,%eax
mov    %ecx,0x10(%rsp)
movsd  %xmm0,0x30(%rsp)
jmp    11f2 <played_class+0xa2>
lea    0xce8(%rip),%rdi
call   1030 <puts@plt>
lea    0xd02(%rip),%rdi
call   1030 <puts@plt>
mov    0x14(%rsp),%edi
movsd  0x38(%rsp),%xmm0
mov    0x10(%rsp),%esi
movsd  0x30(%rsp),%xmm1
mov    0xc(%rsp),%edx
movsd  0x28(%rsp),%xmm2
call   1040 <print_top3a@plt>
lea    0xd1d(%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": Three Most Played Classes :\0A: -------------------------------- :\0A\00"
@.str.5 = [38 x i8] c":__________________________________:\0A\00"
define void @played_class() {
%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 i32
%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 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 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 = %43, %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 %44
32: ; preds = %27
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %43
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 %43
40: ; preds = %35
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %43
43: ; preds = %40, %35, %32
br label %27
44: ; preds = %27
%45 = load i32*, i32** %1
%46 = call i32 @fclose(i32* %45)
%47 = load double, double* %16
%48 = load i32, i32* %9
%49 = sitofp i32 %48 to double
%50 = fcmp ogt double %47, %49
br i1 %50, label %51, label %74
51: ; preds = %44
%52 = load double, double* %17
%53 = load i32, i32* %9
%54 = sitofp i32 %53 to double
%55 = fcmp ogt double %52, %54
br i1 %55, label %56, label %68
56: ; preds = %51
%57 = load double, double* %18
%58 = load i32, i32* %9
%59 = sitofp i32 %58 to double
%60 = fcmp ogt double %57, %59
br i1 %60, label %61, label %62
61: ; preds = %56
store i32 0, i32* %9
br label %67
62: ; preds = %56
%63 = load i32, i32* %9
%64 = sitofp i32 %63 to double
store double %64, double* %18
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %13
br label %67
67: ; preds = %62, %61
br label %73
68: ; preds = %51
%69 = load i32, i32* %9
%70 = sitofp i32 %69 to double
store double %70, double* %17
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %12
br label %73
73: ; preds = %68, %67
br label %79
74: ; preds = %44
%75 = load i32, i32* %9
%76 = sitofp i32 %75 to double
store double %76, double* %16
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 1
store i32 %78, i32* %11
br label %79
79: ; preds = %74, %73
store i32 0, i32* %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_top3a(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": Three Most Played Classes :\0A: -------------------------------- :\00"
@str.7 = [37 x i8] c":__________________________________:\00"
define void @played_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, %51
%10 = phi i32 [ 0, %0 ], [ %52, %51 ]
%11 = phi i32 [ 0, %0 ], [ %58, %51 ]
%12 = phi double [ 0.000000e+00, %0 ], [ %57, %51 ]
%13 = phi double [ 0.000000e+00, %0 ], [ %56, %51 ]
%14 = phi double [ 0.000000e+00, %0 ], [ %55, %51 ]
%15 = phi i32 [ 0, %0 ], [ %54, %51 ]
%16 = phi i32 [ 0, %0 ], [ %53, %51 ]
%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 %35, label %21
21: ; preds = %9
%22 = add nuw nsw i32 %10, 1
br label %23
23: ; preds = %21, %23
%24 = phi i32 [ 0, %21 ], [ %31, %23 ]
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 0
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, %22
%29 = select i1 %26, i1 %28, i1 false
%30 = zext i1 %29 to i32
%31 = add nuw nsw i32 %24, %30
%32 = 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)
%33 = load i64, i64* @EOF
%34 = icmp eq i64 %32, %33
br i1 %34, label %35, label %23
35: ; preds = %23, %9
%36 = phi i32 [ 0, %9 ], [ %31, %23 ]
%37 = call i32 @fclose(i32* %17)
%38 = sitofp i32 %36 to double
%39 = fcmp ogt double %14, %38
br i1 %39, label %40, label %49
40: ; preds = %35
%41 = fcmp ogt double %13, %38
br i1 %41, label %42, label %47
42: ; preds = %40
%43 = fcmp ogt double %12, %38
%44 = add nuw nsw i32 %10, 1
%45 = select i1 %43, i32 %16, i32 %44
%46 = select i1 %43, double %12, double %38
br label %51
47: ; preds = %40
%48 = add nuw nsw i32 %10, 1
br label %51
49: ; preds = %35
%50 = add nuw nsw i32 %10, 1
br label %51
51: ; preds = %42, %47, %49
%52 = phi i32 [ %48, %47 ], [ %50, %49 ], [ %44, %42 ]
%53 = phi i32 [ %16, %47 ], [ %16, %49 ], [ %45, %42 ]
%54 = phi i32 [ %48, %47 ], [ %15, %49 ], [ %15, %42 ]
%55 = phi double [ %14, %47 ], [ %38, %49 ], [ %14, %42 ]
%56 = phi double [ %38, %47 ], [ %13, %49 ], [ %13, %42 ]
%57 = phi double [ %12, %47 ], [ %12, %49 ], [ %46, %42 ]
%58 = phi i32 [ %11, %47 ], [ %50, %49 ], [ %11, %42 ]
%59 = icmp eq i32 %52, 9
br i1 %59, label %60, label %9
60: ; preds = %51
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.6, i64 0, i64 0))
%63 = call i32 @print_top3a(i32 %58, double %55, i32 %54, double %56, i32 %53, double %57)
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
ret void
}