#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 /*<<< orphan*/ print_class(int);
int /*<<< orphan*/ printf(char *, int, ...);
void view_late() {
  FILE *file;
  int class = 0, win = 0, lost = 0, i = 0;
  file = fopen("Stats.txt", "r");
  while (fscanf(file, "%d %d %d", &class, &win, &lost) != EOF) {
    i++;
  }
  printf("\n __________________________________ \n"
         ": Latest Arena Run  Nr. %d         :\n"
         ":__________________________________:\n"
         ":                                  :\n\n",
         i);
  print_class(class);
  printf(": Wins - %d   Loss - %d\n\n"
         ":__________________________________:\n\n",
         win, lost);
  fclose(file);
}


x86 assembly (clang, -O0):
<view_late>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe85(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1050 <fscanf@plt>
mov    0x2e3a(%rip),%rcx
cmp    (%rcx),%rax
je     11c5 <view_late+0x75>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118b <view_late+0x3b>
mov    -0x18(%rbp),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
call   1060 <print_class@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<view_late>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe83(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    $0xffffffff,%ebp
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
mov    0x2e41(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xe52(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1050 <fscanf@plt>
add    $0x1,%ebp
cmp    (%r14),%rax
jne    11b0 <view_late+0x60>
lea    0xe3e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%edi
call   1060 <print_class@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x18,%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 = [9 x i8] c"%d %d %d\00"
@EOF = global i64 0
@.str.3 = [151 x i8] c"\0A __________________________________ \0A: Latest Arena Run Nr. %d :\0A:__________________________________:\0A: :\0A\0A\00"
@.str.4 = [64 x i8] c": Wins - %d Loss - %d\0A\0A:__________________________________:\0A\0A\00"
define void @view_late() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = 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* %6, i32** %1
br label %7
7: ; preds = %12, %0
%8 = load i32*, i32** %1
%9 = call i64 @fscanf(i32* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%10 = load i64, i64* @EOF
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
br label %7
15: ; preds = %7
%16 = load i32, i32* %5
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = call i32 @print_class(i32 %18)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i32 %20, i32 %21)
%23 = load i32*, i32** %1
%24 = call i32 @fclose(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Stats.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d %d %d\00"
@EOF = global i64 0
@.str.3 = [151 x i8] c"\0A __________________________________ \0A: Latest Arena Run Nr. %d :\0A:__________________________________:\0A: :\0A\0A\00"
@.str.4 = [64 x i8] c": Wins - %d Loss - %d\0A\0A:__________________________________:\0A\0A\00"
define void @view_late() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = 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))
br label %8
8: ; preds = %8, %0
%9 = phi i32 [ 0, %0 ], [ %13, %8 ]
%10 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
%13 = add nuw nsw i32 %9, 1
br i1 %12, label %14, label %8
14: ; preds = %8
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%16 = load i32, i32* %1
%17 = call i32 @print_class(i32 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %19)
%21 = call i32 @fclose(i32* %7)
ret void
}