#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void moje_statystyki() {
  FILE *zw;
  char a, b, c;
  printf("Nr gry|\twygrane/ilosc ruchow|\tdata\n");
  printf("\t\t\t\t\tZgadywanie\n");
  zw = fopen("statystyka1.txt", "r");
  if (zw == NULL)
    printf("Nie zagrales/as jeszcze zadnej gry\n");
  while (a != EOF) {
    a = fgetc(zw);
    printf("%c", a);
  }
  fclose(zw);
  printf("\t\t\t\t\tP-K-N\n");
  zw = fopen("statystyka2.txt", "r");
  if (zw == NULL)
    printf("Nie zagrales/as jeszcze zadnej gry\n");
  while (b != EOF) {
    b = fgetc(zw);
    printf("%c", b);
  }
  fclose(zw);
  printf("\t\t\t\t\tMnozenie\n");
  zw = fopen("statystyka3.txt", "r");
  if (zw == NULL)
    printf("Nie zagrales/as jeszcze zadnej gry\n");
  while (c != EOF) {
    c = fgetc(zw);
    printf("%c", c);
  }
  fclose(zw);
}


x86 assembly (clang, -O0):
<moje_statystyki>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1194 <moje_statystyki+0x54>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <moje_statystyki+0x59>
movsbl -0x9(%rbp),%eax
mov    0x2e44(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d2 <moje_statystyki+0x92>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <moje_statystyki+0x59>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1219 <moje_statystyki+0xd9>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121e <moje_statystyki+0xde>
movsbl -0xa(%rbp),%eax
mov    0x2dbf(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1257 <moje_statystyki+0x117>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121e <moje_statystyki+0xde>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
lea    0xdc9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    129e <moje_statystyki+0x15e>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a3 <moje_statystyki+0x163>
movsbl -0xb(%rbp),%eax
mov    0x2d3a(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12dc <moje_statystyki+0x19c>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0xb(%rbp)
movsbl -0xb(%rbp),%esi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a3 <moje_statystyki+0x163>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moje_statystyki>:
push   %rbp
push   %r14
push   %rbx
lea    0xed7(%rip),%rdi
call   1040 <puts@plt>
lea    0xeee(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8d(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1193 <moje_statystyki+0x43>
lea    0xef0(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e4e(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    (%r14),%bpl
jne    11a0 <moje_statystyki+0x50>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe40(%rip),%rdi
lea    0xe37(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1200 <moje_statystyki+0xb0>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    (%r14),%bpl
jne    1200 <moje_statystyki+0xb0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf0(%rip),%rdi
lea    0xdd7(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1260 <moje_statystyki+0x110>
lea    0xe31(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    (%r14),%bpl
jne    1260 <moje_statystyki+0x110>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fclose@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Nr gry|\09wygrane/ilosc ruchow|\09data\0A\00"
@.str.1 = [17 x i8] c"\09\09\09\09\09Zgadywanie\0A\00"
@.str.2 = [16 x i8] c"statystyka1.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [36 x i8] c"Nie zagrales/as jeszcze zadnej gry\0A\00"
@EOF = global i8 0
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [12 x i8] c"\09\09\09\09\09P-K-N\0A\00"
@.str.7 = [16 x i8] c"statystyka2.txt\00"
@.str.8 = [15 x i8] c"\09\09\09\09\09Mnozenie\0A\00"
@.str.9 = [16 x i8] c"statystyka3.txt\00"
define void @moje_statystyki() {
%1 = alloca i32*
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %7, i32** %1
%8 = load i32*, i32** %1
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
br label %13
13: ; preds = %19, %12
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = load i8, i8* @EOF
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %15, %17
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = load i32*, i32** %1
%21 = call signext i8 @fgetc(i32* %20)
store i8 %21, i8* %2
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %13
25: ; preds = %13
%26 = load i32*, i32** %1
%27 = call i32 @fclose(i32* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %29, i32** %1
%30 = load i32*, i32** %1
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %25
br label %35
35: ; preds = %41, %34
%36 = load i8, i8* %3
%37 = sext i8 %36 to i32
%38 = load i8, i8* @EOF
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %37, %39
br i1 %40, label %41, label %47
41: ; preds = %35
%42 = load i32*, i32** %1
%43 = call signext i8 @fgetc(i32* %42)
store i8 %43, i8* %3
%44 = load i8, i8* %3
%45 = sext i8 %44 to i32
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %45)
br label %35
47: ; preds = %35
%48 = load i32*, i32** %1
%49 = call i32 @fclose(i32* %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%51 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %51, i32** %1
%52 = load i32*, i32** %1
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54, %47
br label %57
57: ; preds = %63, %56
%58 = load i8, i8* %4
%59 = sext i8 %58 to i32
%60 = load i8, i8* @EOF
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %59, %61
br i1 %62, label %63, label %69
63: ; preds = %57
%64 = load i32*, i32** %1
%65 = call signext i8 @fgetc(i32* %64)
store i8 %65, i8* %4
%66 = load i8, i8* %4
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %67)
br label %57
69: ; preds = %57
%70 = load i32*, i32** %1
%71 = call i32 @fclose(i32* %70)
ret void
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"statystyka1.txt\00"
@.str.3 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.7 = [16 x i8] c"statystyka2.txt\00"
@.str.9 = [16 x i8] c"statystyka3.txt\00"
@str = [35 x i8] c"Nr gry|\09wygrane/ilosc ruchow|\09data\00"
@str.10 = [16 x i8] c"\09\09\09\09\09Zgadywanie\00"
@str.11 = [11 x i8] c"\09\09\09\09\09P-K-N\00"
@str.12 = [14 x i8] c"\09\09\09\09\09Mnozenie\00"
@str.15 = [35 x i8] c"Nie zagrales/as jeszcze zadnej gry\00"
define void @moje_statystyki() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.10, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.15, i64 0, i64 0))
br label %7
7: ; preds = %0, %5
br label %8
8: ; preds = %7, %8
%9 = tail call signext i8 @fgetc(i32* %3)
%10 = sext i8 %9 to i32
%11 = tail call i32 @putchar(i32 %10)
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %9, %12
br i1 %13, label %14, label %8
14: ; preds = %8
%15 = tail call i32 @fclose(i32* %3)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.11, i64 0, i64 0))
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.15, i64 0, i64 0))
br label %21
21: ; preds = %14, %19
br label %22
22: ; preds = %21, %22
%23 = tail call signext i8 @fgetc(i32* %17)
%24 = sext i8 %23 to i32
%25 = tail call i32 @putchar(i32 %24)
%26 = load i8, i8* @EOF
%27 = icmp eq i8 %23, %26
br i1 %27, label %28, label %22
28: ; preds = %22
%29 = tail call i32 @fclose(i32* %17)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.12, i64 0, i64 0))
%31 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.15, i64 0, i64 0))
br label %35
35: ; preds = %28, %33
br label %36
36: ; preds = %35, %36
%37 = tail call signext i8 @fgetc(i32* %31)
%38 = sext i8 %37 to i32
%39 = tail call i32 @putchar(i32 %38)
%40 = load i8, i8* @EOF
%41 = icmp eq i8 %37, %40
br i1 %41, label %42, label %36
42: ; preds = %36
%43 = tail call i32 @fclose(i32* %31)
ret void
}