#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 atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int, int);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ remove(char *);
int /*<<< orphan*/ scanf(char *, char **);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
void recover_run() {
  FILE *file1, *file2;
  int class = 0, win = 0, lost = 0, i = 0, delete = 0, choice = 0;
  int win_c = 0, lost_c = 0, runs = 0;
  double winp = 0.00;
  char command[10];
  file1 = fopen("Stats.txt", "r");
  while (fscanf(file1, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
    if (delete == 1) {
      i++;
    }
  }
  fclose(file1);
  if (i == 0) {
    printf("\n __________________________________\n"
           ": Nothing to recover               :\n"
           ":__________________________________:\n");
  } else {
    file1 = fopen("Stats.txt", "r");
    file2 = fopen("Stats1.txt", "w");
    i = 0;
    printf("\n __________________________________\n"
           ": Select run to recover            :\n");
    printf(": -------------------------------- :\n"
           ":                                  :\n");
    while (fscanf(file1, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
      if (delete == 1) {
        printf(": %#02d ~ Wins - %4d   Loss - %4d   :\n", i + 1, win, lost);
        i++;
      }
    }
    printf(":__________________________________:\n\n");
    fclose(file1);
    file1 = fopen("Stats.txt", "r");
    scanf("%s", &command);
    i = 1;
    if (strcmp(command, "all") == 0) {
      system("cls");
      while (fscanf(file1, "%d %d %d %d", &class, &win, &lost, &delete) !=
             EOF) {
        if (delete == 1) {
          fprintf(file2, " %d %d %d %d", class, win, lost, 0);
        } else
          fprintf(file2, " %d %d %d %d", class, win, lost, delete);
      }
      fclose(file1);
      fclose(file2);
    } else {
      choice = atoi(command);
      system("cls");
      if (choice != 0) {
        while (fscanf(file1, "%d %d %d %d", &class, &win, &lost, &delete) !=
               EOF) {
          if (delete == 1) {
            if (i == choice)
              fprintf(file2, " %d %d %d %d", class, win, lost, 0);
            else {
              fprintf(file2, " %d %d %d %d", class, win, lost, delete);
            }
            i++;
          } else
            fprintf(file2, " %d %d %d %d", class, win, lost, delete);
        }
        fclose(file1);
        fclose(file2);
      }
    }
    file1 = fopen("Stats.txt", "w");
    file2 = fopen("Stats1.txt", "r");
    while (fscanf(file2, "%d %d %d %d", &class, &win, &lost, &delete) != EOF) {
      fprintf(file1, " %d %d %d %d", class, win, lost, delete);
    }
    fclose(file1);
    fclose(file2);
    if (remove("Stats1.txt") == 0)
      printf("\n __________________________________ \n"
             ": Recovered                        :\n"
             ":__________________________________:\n\n");
    else {
      printf("\n __________________________________ \n"
             ": Unable to recover                :\n"
             ":__________________________________:\n\n");
    }
  }
}


x86 assembly (clang, -O0):
<recover_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    0xe0a(%rip),%rdi
lea    0xe0d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xf41(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <fscanf@plt>
mov    0x2dbb(%rip),%rcx
cmp    (%rcx),%rax
je     124e <recover_run+0xae>
cmpl   $0x1,-0x24(%rbp)
jne    1249 <recover_run+0xa9>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1206 <recover_run+0x66>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1274 <recover_run+0xd4>
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15ec <recover_run+0x44c>
lea    0xd85(%rip),%rdi
lea    0xd88(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xdea(%rip),%rdi
lea    0xdee(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <fscanf@plt>
mov    0x2cfc(%rip),%rcx
cmp    (%rcx),%rax
je     1327 <recover_run+0x187>
cmpl   $0x1,-0x24(%rbp)
jne    1322 <recover_run+0x182>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12c5 <recover_run+0x125>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xcbb(%rip),%rdi
lea    0xcbe(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    -0x4a(%rbp),%rsi
lea    0xde6(%rip),%rdi
call   10a0 <scanf@plt>
movl   $0x1,-0x20(%rbp)
lea    -0x4a(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1428 <recover_run+0x288>
lea    0xdc0(%rip),%rdi
call   1050 <system@plt>
mov    -0x8(%rbp),%rdi
lea    0xdb5(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <fscanf@plt>
mov    0x2c2f(%rip),%rcx
cmp    (%rcx),%rax
je     1411 <recover_run+0x271>
cmpl   $0x1,-0x24(%rbp)
jne    13ee <recover_run+0x24e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xd70(%rip),%rsi
xor    %r9d,%r9d
call   1090 <fprintf@plt>
jmp    140c <recover_run+0x26c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xd4a(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1392 <recover_run+0x1f2>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
jmp    151d <recover_run+0x37d>
lea    -0x4a(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x28(%rbp)
lea    0xd12(%rip),%rdi
call   1050 <system@plt>
cmpl   $0x0,-0x28(%rbp)
je     1518 <recover_run+0x378>
jmp    144f <recover_run+0x2af>
mov    -0x8(%rbp),%rdi
lea    0xcf8(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <fscanf@plt>
mov    0x2b72(%rip),%rcx
cmp    (%rcx),%rax
je     1506 <recover_run+0x366>
cmpl   $0x1,-0x24(%rbp)
jne    14e3 <recover_run+0x343>
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    14b7 <recover_run+0x317>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xca7(%rip),%rsi
xor    %r9d,%r9d
call   1090 <fprintf@plt>
jmp    14d5 <recover_run+0x335>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xc81(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1501 <recover_run+0x361>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xc55(%rip),%rsi
call   1090 <fprintf@plt>
jmp    144f <recover_run+0x2af>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
jmp    151d <recover_run+0x37d>
lea    0xadc(%rip),%rdi
lea    0xb5c(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xb41(%rip),%rdi
lea    0xac8(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xbfc(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <fscanf@plt>
mov    0x2a76(%rip),%rcx
cmp    (%rcx),%rax
je     159e <recover_run+0x3fe>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xbbd(%rip),%rsi
call   1090 <fprintf@plt>
jmp    154b <recover_run+0x3ab>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xac5(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jne    15d9 <recover_run+0x439>
lea    0xb91(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15e7 <recover_run+0x447>
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15ec <recover_run+0x44c>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recover_run>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe1c(%rip),%rdi
lea    0xe1f(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xe52(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rax,%rdi
call   1080 <fscanf@plt>
mov    0x2dcd(%rip),%r15
cmp    (%r15),%rax
jne    1234 <recover_run+0x84>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xf9f(%rip),%rdi
jmp    1668 <recover_run+0x4b8>
xor    %r14d,%r14d
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
mov    %rsp,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
cmpl   $0x1,(%rsp)
sete   %al
add    %eax,%r14d
mov    %rbx,%rdi
lea    0xde6(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %rbp,%r9
call   1080 <fscanf@plt>
cmp    (%r15),%rax
jne    1250 <recover_run+0xa0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
test   %r14d,%r14d
je     1451 <recover_run+0x2a1>
lea    0xd6a(%rip),%rdi
lea    0xd6d(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xd60(%rip),%rdi
lea    0xd64(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,0x10(%rsp)
lea    0xd94(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd2(%rip),%rdi
call   1040 <puts@plt>
lea    0xd70(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rbx,%rdi
call   1080 <fscanf@plt>
mov    0x2ceb(%rip),%rcx
cmp    (%rcx),%rax
jne    145d <recover_run+0x2ad>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xcdf(%rip),%rdi
lea    0xce2(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xd09(%rip),%rdi
lea    0x1e(%rsp),%rbp
mov    %rbp,%rsi
call   10b0 <scanf@plt>
lea    0xcf8(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     14d0 <recover_run+0x320>
lea    0x1e(%rsp),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
lea    0xcd8(%rip),%rdi
call   1060 <system@plt>
mov    %ebp,0x18(%rsp)
test   %ebp,%ebp
je     1581 <recover_run+0x3d1>
lea    0xcc5(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rbx,%rdi
call   1080 <fscanf@plt>
mov    0x2c40(%rip),%rcx
cmp    (%rcx),%rax
je     156f <recover_run+0x3bf>
mov    $0x1,%ebp
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%r13
jmp    1419 <recover_run+0x269>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    0x10(%rsp),%rdi
lea    0xc62(%rip),%rsi
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
lea    0xc54(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
mov    %r13,%r9
call   1080 <fscanf@plt>
mov    0x2bd8(%rip),%rcx
cmp    (%rcx),%rax
je     156f <recover_run+0x3bf>
mov    (%rsp),%r9d
cmp    $0x1,%r9d
jne    13d0 <recover_run+0x220>
xor    %r9d,%r9d
cmp    0x18(%rsp),%ebp
setne  %r9b
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    0x10(%rsp),%rdi
lea    0xc04(%rip),%rsi
call   10a0 <fprintf@plt>
add    $0x1,%ebp
jmp    13ee <recover_run+0x23e>
lea    0xd76(%rip),%rdi
jmp    1668 <recover_run+0x4b8>
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbp
lea    0x4(%rsp),%r14
mov    %rsp,%r15
xor    %r12d,%r12d
jmp    14ab <recover_run+0x2fb>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
lea    0xbc2(%rip),%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1080 <fscanf@plt>
mov    0x2b46(%rip),%rcx
cmp    (%rcx),%rax
je     1306 <recover_run+0x156>
cmpl   $0x1,(%rsp)
jne    1480 <recover_run+0x2d0>
add    $0x1,%r12d
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
lea    0xb55(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1480 <recover_run+0x2d0>
lea    0xb70(%rip),%rdi
call   1060 <system@plt>
lea    0xb69(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rbx,%rdi
call   1080 <fscanf@plt>
mov    0x2ae4(%rip),%r15
cmp    (%r15),%rax
je     156f <recover_run+0x3bf>
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%rbp
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%r9d
cmp    $0x1,%r9d
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    $0x0,%eax
cmove  %eax,%r9d
mov    0x10(%rsp),%rdi
lea    0xb01(%rip),%rsi
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
lea    0xaf3(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
call   1080 <fscanf@plt>
cmp    (%r15),%rax
jne    1520 <recover_run+0x370>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
lea    0xa78(%rip),%rdi
lea    0xa88(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xa6e(%rip),%rdi
lea    0xa65(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbp
lea    0xa98(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rax,%rdi
call   1080 <fscanf@plt>
mov    0x2a13(%rip),%rcx
cmp    (%rcx),%rax
je     1637 <recover_run+0x487>
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%r14
mov    %rsp,%r15
nopl   0x0(%rax)
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    (%rsp),%r9d
mov    %rbx,%rdi
lea    0xa40(%rip),%rsi
call   10a0 <fprintf@plt>
mov    %rbp,%rdi
lea    0xa32(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1080 <fscanf@plt>
mov    0x29b6(%rip),%rcx
cmp    (%rcx),%rax
jne    15f0 <recover_run+0x440>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0x9be(%rip),%rdi
call   1030 <remove@plt>
test   %rax,%rax
lea    0xb00(%rip),%rax
lea    0xa88(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
add    $0x28,%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 = [112 x i8] c"\0A __________________________________\0A: Nothing to recover :\0A:__________________________________:\0A\00"
@.str.4 = [11 x i8] c"Stats1.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [75 x i8] c"\0A __________________________________\0A: Select run to recover :\0A\00"
@.str.7 = [75 x i8] c": -------------------------------- :\0A: :\0A\00"
@.str.8 = [39 x i8] c": %d ~ Wins - %4d Loss - %4d :\0A\00"
@.str.9 = [39 x i8] c":__________________________________:\0A\0A\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [4 x i8] c"all\00"
@.str.12 = [4 x i8] c"cls\00"
@.str.13 = [13 x i8] c" %d %d %d %d\00"
@.str.14 = [114 x i8] c"\0A __________________________________ \0A: Recovered :\0A:__________________________________:\0A\0A\00"
@.str.15 = [114 x i8] c"\0A __________________________________ \0A: Unable to recover :\0A:__________________________________:\0A\0A\00"
define void @recover_run() {
%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 double
%13 = alloca [10 x i8]
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 double 0.000000e+00, double* %12
%14 = 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* %14, i32** %1
br label %15
15: ; preds = %26, %0
%16 = load i32*, i32** %1
%17 = call i64 @fscanf(i32* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %7)
%18 = load i64, i64* @EOF
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i32, i32* %7
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %26
26: ; preds = %23, %20
br label %15
27: ; preds = %15
%28 = load i32*, i32** %1
%29 = call i32 @fclose(i32* %28)
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str.3, i64 0, i64 0))
br label %171
34: ; preds = %27
%35 = 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* %35, i32** %1
%36 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %36, i32** %2
store i32 0, i32* %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.6, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %55, %34
%40 = load i32*, i32** %1
%41 = call i64 @fscanf(i32* %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %7)
%42 = load i64, i64* @EOF
%43 = icmp ne i64 %41, %42
br i1 %43, label %44, label %56
44: ; preds = %39
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %55
55: ; preds = %47, %44
br label %39
56: ; preds = %39
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%58 = load i32*, i32** %1
%59 = call i32 @fclose(i32* %58)
%60 = 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* %60, i32** %1
%61 = bitcast [10 x i8]* %13 to i8**
%62 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8** %61)
store i32 1, i32* %6
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %95
66: ; preds = %56
%67 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
br label %68
68: ; preds = %89, %66
%69 = load i32*, i32** %1
%70 = call i64 @fscanf(i32* %69, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %7)
%71 = load i64, i64* @EOF
%72 = icmp ne i64 %70, %71
br i1 %72, label %73, label %90
73: ; preds = %68
%74 = load i32, i32* %7
%75 = icmp eq i32 %74, 1
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i32*, i32** %2
%78 = load i32, i32* %3
%79 = load i32, i32* %4
%80 = load i32, i32* %5
%81 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %78, i32 %79, i32 %80, i32 0)
br label %89
82: ; preds = %73
%83 = load i32*, i32** %2
%84 = load i32, i32* %3
%85 = load i32, i32* %4
%86 = load i32, i32* %5
%87 = load i32, i32* %7
%88 = call i32 @fprintf(i32* %83, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %84, i32 %85, i32 %86, i32 %87)
br label %89
89: ; preds = %82, %76
br label %68
90: ; preds = %68
%91 = load i32*, i32** %1
%92 = call i32 @fclose(i32* %91)
%93 = load i32*, i32** %2
%94 = call i32 @fclose(i32* %93)
br label %144
95: ; preds = %56
%96 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%97 = call i32 @atoi(i8* %96)
store i32 %97, i32* %8
%98 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%99 = load i32, i32* %8
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %143
101: ; preds = %95
br label %102
102: ; preds = %137, %101
%103 = load i32*, i32** %1
%104 = call i64 @fscanf(i32* %103, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %7)
%105 = load i64, i64* @EOF
%106 = icmp ne i64 %104, %105
br i1 %106, label %107, label %138
107: ; preds = %102
%108 = load i32, i32* %7
%109 = icmp eq i32 %108, 1
br i1 %109, label %110, label %130
110: ; preds = %107
%111 = load i32, i32* %6
%112 = load i32, i32* %8
%113 = icmp eq i32 %111, %112
br i1 %113, label %114, label %120
114: ; preds = %110
%115 = load i32*, i32** %2
%116 = load i32, i32* %3
%117 = load i32, i32* %4
%118 = load i32, i32* %5
%119 = call i32 @fprintf(i32* %115, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %116, i32 %117, i32 %118, i32 0)
br label %127
120: ; preds = %110
%121 = load i32*, i32** %2
%122 = load i32, i32* %3
%123 = load i32, i32* %4
%124 = load i32, i32* %5
%125 = load i32, i32* %7
%126 = call i32 @fprintf(i32* %121, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %122, i32 %123, i32 %124, i32 %125)
br label %127
127: ; preds = %120, %114
%128 = load i32, i32* %6
%129 = add nsw i32 %128, 1
store i32 %129, i32* %6
br label %137
130: ; preds = %107
%131 = load i32*, i32** %2
%132 = load i32, i32* %3
%133 = load i32, i32* %4
%134 = load i32, i32* %5
%135 = load i32, i32* %7
%136 = call i32 @fprintf(i32* %131, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %132, i32 %133, i32 %134, i32 %135)
br label %137
137: ; preds = %130, %127
br label %102
138: ; preds = %102
%139 = load i32*, i32** %1
%140 = call i32 @fclose(i32* %139)
%141 = load i32*, i32** %2
%142 = call i32 @fclose(i32* %141)
br label %143
143: ; preds = %138, %95
br label %144
144: ; preds = %143, %90
%145 = 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.5, i64 0, i64 0))
store i32* %145, i32** %1
%146 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %146, i32** %2
br label %147
147: ; preds = %152, %144
%148 = load i32*, i32** %2
%149 = call i64 @fscanf(i32* %148, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %7)
%150 = load i64, i64* @EOF
%151 = icmp ne i64 %149, %150
br i1 %151, label %152, label %159
152: ; preds = %147
%153 = load i32*, i32** %1
%154 = load i32, i32* %3
%155 = load i32, i32* %4
%156 = load i32, i32* %5
%157 = load i32, i32* %7
%158 = call i32 @fprintf(i32* %153, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %154, i32 %155, i32 %156, i32 %157)
br label %147
159: ; preds = %147
%160 = load i32*, i32** %1
%161 = call i32 @fclose(i32* %160)
%162 = load i32*, i32** %2
%163 = call i32 @fclose(i32* %162)
%164 = call i64 @remove(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%165 = icmp eq i64 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %159
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.14, i64 0, i64 0))
br label %170
168: ; preds = %159
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.15, i64 0, i64 0))
br label %170
170: ; preds = %168, %166
br label %171
171: ; preds = %170, %32
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.4 = [11 x i8] c"Stats1.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.8 = [39 x i8] c": %d ~ Wins - %4d Loss - %4d :\0A\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [4 x i8] c"all\00"
@.str.12 = [4 x i8] c"cls\00"
@.str.13 = [13 x i8] c" %d %d %d %d\00"
@str = [74 x i8] c"\0A __________________________________\0A: Select run to recover :\00"
@str.16 = [74 x i8] c": -------------------------------- :\0A: :\00"
@str.17 = [38 x i8] c":__________________________________:\0A\00"
@str.18 = [113 x i8] c"\0A __________________________________ \0A: Unable to recover :\0A:__________________________________:\0A\00"
@str.19 = [113 x i8] c"\0A __________________________________ \0A: Recovered :\0A:__________________________________:\0A\00"
@str.20 = [111 x i8] c"\0A __________________________________\0A: Nothing to recover :\0A:__________________________________:\00"
define void @recover_run() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%7 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%11 = 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))
%12 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, 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 %15, label %17
15: ; preds = %0
%16 = call i32 @fclose(i32* %11)
br label %129
17: ; preds = %0, %17
%18 = phi i32 [ %22, %17 ], [ 0, %0 ]
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %18, %21
%23 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %17
26: ; preds = %17
%27 = icmp eq i32 %22, 0
%28 = call i32 @fclose(i32* %11)
br i1 %27, label %129, label %29
29: ; preds = %26
%30 = 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))
%31 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.16, i64 0, i64 0))
%34 = call i64 @fscanf(i32* %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%35 = load i64, i64* @EOF
%36 = icmp eq i64 %34, %35
br i1 %36, label %51, label %37
37: ; preds = %29, %46
%38 = phi i32 [ %47, %46 ], [ 0, %29 ]
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = add nsw i32 %38, 1
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %42, i32 %43, i32 %44)
br label %46
46: ; preds = %41, %37
%47 = phi i32 [ %42, %41 ], [ %38, %37 ]
%48 = call i64 @fscanf(i32* %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%49 = load i64, i64* @EOF
%50 = icmp eq i64 %48, %49
br i1 %50, label %51, label %37
51: ; preds = %46, %29
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.17, i64 0, i64 0))
%53 = call i32 @fclose(i32* %30)
%54 = 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))
%55 = bitcast [10 x i8]* %5 to i8**
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8** %55)
%57 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %75
59: ; preds = %51
%60 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%61 = call i64 @fscanf(i32* %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%62 = load i64, i64* @EOF
%63 = icmp eq i64 %61, %62
br i1 %63, label %105, label %64
64: ; preds = %59, %64
%65 = load i32, i32* %4
%66 = icmp eq i32 %65, 1
%67 = load i32, i32* %1
%68 = load i32, i32* %2
%69 = load i32, i32* %3
%70 = select i1 %66, i32 0, i32 %65
%71 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %67, i32 %68, i32 %69, i32 %70)
%72 = call i64 @fscanf(i32* %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%73 = load i64, i64* @EOF
%74 = icmp eq i64 %72, %73
br i1 %74, label %105, label %64
75: ; preds = %51
%76 = call i32 @atoi(i8* %10)
%77 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%78 = icmp eq i32 %76, 0
br i1 %78, label %108, label %79
79: ; preds = %75
%80 = call i64 @fscanf(i32* %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%81 = load i64, i64* @EOF
%82 = icmp eq i64 %80, %81
br i1 %82, label %105, label %83
83: ; preds = %79, %100
%84 = phi i32 [ %101, %100 ], [ 1, %79 ]
%85 = load i32, i32* %4
%86 = icmp eq i32 %85, 1
br i1 %86, label %87, label %95
87: ; preds = %83
%88 = icmp ne i32 %84, %76
%89 = load i32, i32* %1
%90 = load i32, i32* %2
%91 = load i32, i32* %3
%92 = zext i1 %88 to i32
%93 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %89, i32 %90, i32 %91, i32 %92)
%94 = add nsw i32 %84, 1
br label %100
95: ; preds = %83
%96 = load i32, i32* %1
%97 = load i32, i32* %2
%98 = load i32, i32* %3
%99 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %96, i32 %97, i32 %98, i32 %85)
br label %100
100: ; preds = %95, %87
%101 = phi i32 [ %94, %87 ], [ %84, %95 ]
%102 = call i64 @fscanf(i32* %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%103 = load i64, i64* @EOF
%104 = icmp eq i64 %102, %103
br i1 %104, label %105, label %83
105: ; preds = %100, %64, %79, %59
%106 = call i32 @fclose(i32* %54)
%107 = call i32 @fclose(i32* %31)
br label %108
108: ; preds = %105, %75
%109 = 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.5, i64 0, i64 0))
%110 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%111 = call i64 @fscanf(i32* %110, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%112 = load i64, i64* @EOF
%113 = icmp eq i64 %111, %112
br i1 %113, label %123, label %114
114: ; preds = %108, %114
%115 = load i32, i32* %1
%116 = load i32, i32* %2
%117 = load i32, i32* %3
%118 = load i32, i32* %4
%119 = call i32 @fprintf(i32* %109, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %115, i32 %116, i32 %117, i32 %118)
%120 = call i64 @fscanf(i32* %110, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%121 = load i64, i64* @EOF
%122 = icmp eq i64 %120, %121
br i1 %122, label %123, label %114
123: ; preds = %114, %108
%124 = call i32 @fclose(i32* %109)
%125 = call i32 @fclose(i32* %110)
%126 = call i64 @remove(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%127 = icmp eq i64 %126, 0
%128 = select i1 %127, i8* getelementptr inbounds ([113 x i8], [113 x i8]* @str.19, i64 0, i64 0), i8* getelementptr inbounds ([113 x i8], [113 x i8]* @str.18, i64 0, i64 0)
br label %129
129: ; preds = %123, %26, %15
%130 = phi i8* [ getelementptr inbounds ([111 x i8], [111 x i8]* @str.20, i64 0, i64 0), %15 ], [ getelementptr inbounds ([111 x i8], [111 x i8]* @str.20, i64 0, i64 0), %26 ], [ %128, %123 ]
%131 = call i32 @puts(i8* dereferenceable(1) %130)
ret void
}