#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int get_file_lines(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
void print_game_information(int gameCounter) {
  FILE *playLog;
  int playNumber;
  char dateExtended[32];
  char playerName1[30];
  char playerName2[30];
  int dimension;
  int moveX;
  char moveY;
  int lineCounter = 0;
  int headLinesNumber = 6;
  char logName[255] = "logs/";
  sprintf(logName, "logs/TripletsLog-%d.txt", gameCounter);
  lineCounter = get_file_lines(logName);
  lineCounter -= headLinesNumber;
  lineCounter++;
  playLog = fopen(logName, "rt");
  if (playLog == NULL) {
    printf("\nERR: Unable to read Log!");
  } else {
    gameCounter = 0;
    dimension = 0;
    fscanf(playLog, "--Triplets Log--\n");
    fscanf(playLog, "Game #%d\n", &gameCounter);
    fscanf(playLog, "Matrix Dimension: %dx%d\n", &dimension, &dimension);
    fscanf(playLog, "Started on: %s\n", dateExtended);
    fscanf(playLog, "Player %s ; Play %d ; Move [%d][%c]\n", playerName1,
           &playNumber, &moveX, &moveY);
    fscanf(playLog, "Player %s ; Play %d ; Move [%d][%c]\n", playerName2,
           &playNumber, &moveX, &moveY);
    printf("#%d Game - Players: %s vs. %s | Date: %s\n", gameCounter,
           playerName1, playerName2, dateExtended);
  }
  fclose(playLog);
}


x86 assembly (clang, -O0):
<print_game_information>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x90(%rbp)
movl   $0x6,-0x94(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1060 <memset@plt>
movb   $0x6c,-0x1a0(%rbp)
movb   $0x6f,-0x19f(%rbp)
movb   $0x67,-0x19e(%rbp)
movb   $0x73,-0x19d(%rbp)
movb   $0x2f,-0x19c(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe27(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x1a0(%rbp),%rdi
call   1030 <get_file_lines@plt>
mov    %eax,-0x90(%rbp)
mov    -0x94(%rbp),%ecx
mov    -0x90(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1248 <print_game_information+0xd8>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1320 <print_game_information+0x1b0>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xdc5(%rip),%rsi
lea    -0x84(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xdb8(%rip),%rsi
lea    -0x14(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x89(%rbp),%r9
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xd90(%rip),%rsi
lea    -0x14(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x89(%rbp),%r9
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x4(%rbp),%esi
lea    -0x60(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x40(%rbp),%r8
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_game_information>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
mov    %edi,%edx
mov    %edi,0xc(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movups %xmm0,0x10f(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x73676f6c,0x20(%rsp)
73
movb   $0x2f,0x24(%rsp)
lea    0xe04(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <get_file_lines@plt>
lea    0xe00(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1311 <print_game_information+0x1b1>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xdf2(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xdf3(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xde7(%rip),%rsi
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xde7(%rip),%rsi
lea    0x140(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xdde(%rip),%r15
lea    0x120(%rsp),%rdx
lea    0x1c(%rsp),%r13
lea    0x18(%rsp),%rbp
lea    0x13(%rsp),%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0x160(%rsp),%r12
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0xc(%rsp),%esi
lea    0xdaa(%rip),%rdi
lea    0x120(%rsp),%rdx
mov    %r12,%rcx
lea    0x140(%rsp),%r8
xor    %eax,%eax
call   1050 <printf@plt>
jmp    131f <print_game_information+0x1bf>
lea    0xd03(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"logs/TripletsLog-%d.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [26 x i8] c"\0AERR: Unable to read Log!\00"
@.str.3 = [18 x i8] c"--Triplets Log--\0A\00"
@.str.4 = [10 x i8] c"Game #%d\0A\00"
@.str.5 = [25 x i8] c"Matrix Dimension: %dx%d\0A\00"
@.str.6 = [16 x i8] c"Started on: %s\0A\00"
@.str.7 = [37 x i8] c"Player %s ; Play %d ; Move [%d][%c]\0A\00"
@.str.8 = [42 x i8] c"#%d Game - Players: %s vs. %s | Date: %s\0A\00"
define void @print_game_information(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = alloca [30 x i8]
%7 = alloca [30 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca [255 x i8]
store i32 %0, i32* %2
store i32 0, i32* %11
store i32 6, i32* %12
%14 = bitcast [255 x i8]* %13 to i8*
%15 = bitcast i8* %14 to [255 x i8]*
%16 = getelementptr inbounds [255 x i8], [255 x i8]* %15, i32 0, i32 0
store i8 108, i8* %16
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %15, i32 0, i32 1
store i8 111, i8* %17
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %15, i32 0, i32 2
store i8 103, i8* %18
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %15, i32 0, i32 3
store i8 115, i8* %19
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %15, i32 0, i32 4
store i8 47, i8* %20
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%22 = load i32, i32* %2
%23 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%25 = call i32 @get_file_lines(i8* %24)
store i32 %25, i32* %11
%26 = load i32, i32* %12
%27 = load i32, i32* %11
%28 = sub nsw i32 %27, %26
store i32 %28, i32* %11
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %3
%33 = load i32*, i32** %3
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %1
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %58
37: ; preds = %1
store i32 0, i32* %2
store i32 0, i32* %8
%38 = load i32*, i32** %3
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32*, i32** %3
%41 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%42 = load i32*, i32** %3
%43 = call i32 (i32*, i8*, ...) @fscanf(i32* %42, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32* %8, i32* %8)
%44 = load i32*, i32** %3
%45 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%46 = call i32 (i32*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %45)
%47 = load i32*, i32** %3
%48 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%49 = call i32 (i32*, i8*, ...) @fscanf(i32* %47, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %48, i32* %4, i32* %9, i8* %10)
%50 = load i32*, i32** %3
%51 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%52 = call i32 (i32*, i8*, ...) @fscanf(i32* %50, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %51, i32* %4, i32* %9, i8* %10)
%53 = load i32, i32* %2
%54 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%55 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i32 %53, i8* %54, i8* %55, i8* %56)
br label %58
58: ; preds = %37, %35
%59 = load i32*, i32** %3
%60 = call i32 @fclose(i32* %59)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"logs/TripletsLog-%d.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [26 x i8] c"\0AERR: Unable to read Log!\00"
@.str.3 = [18 x i8] c"--Triplets Log--\0A\00"
@.str.4 = [10 x i8] c"Game #%d\0A\00"
@.str.5 = [25 x i8] c"Matrix Dimension: %dx%d\0A\00"
@.str.6 = [16 x i8] c"Started on: %s\0A\00"
@.str.7 = [37 x i8] c"Player %s ; Play %d ; Move [%d][%c]\0A\00"
@.str.8 = [42 x i8] c"#%d Game - Players: %s vs. %s | Date: %s\0A\00"
define void @print_game_information(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = alloca [30 x i8]
%6 = alloca [30 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca [255 x i8]
store i32 %0, i32* %2
%11 = bitcast i32* %3 to i8*
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
store i8 108, i8* %17
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 1
store i8 111, i8* %18
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 2
store i8 103, i8* %19
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 3
store i8 115, i8* %20
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 4
store i8 47, i8* %21
%22 = call i32 @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
%23 = call i32 @get_file_lines(i8* %17)
%24 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %1
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %37
28: ; preds = %1
store i32 0, i32* %2
store i32 0, i32* %7
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%31 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %7)
%32 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%33 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %13, i32* %3, i32* %8, i8* %9)
%34 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %14, i32* %3, i32* %8, i8* %9)
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i32 %35, i8* %13, i8* %14, i8* %12)
br label %37
37: ; preds = %28, %26
%38 = call i32 @fclose(i32* %24)
ret void
}