#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];
  sprintf(logName, "data/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
mov    -0x4(%rbp),%edx
lea    0xe6d(%rip),%rsi
call   1080 <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    0xe42(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1202 <print_game_information+0xa2>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12da <print_game_information+0x17a>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe1c(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe1c(%rip),%rsi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe10(%rip),%rsi
lea    -0x84(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe03(%rip),%rsi
lea    -0x14(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x89(%rbp),%r9
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xddb(%rip),%rsi
lea    -0x14(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x89(%rbp),%r9
mov    $0x0,%al
call   1060 <fscanf@plt>
mov    -0x4(%rbp),%esi
lea    -0x60(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x40(%rbp),%r8
lea    0xdd1(%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)
lea    0xe82(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <get_file_lines@plt>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1287 <print_game_information+0x127>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xe72(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe73(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe67(%rip),%rsi
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe67(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe61(%rip),%r15
lea    0x20(%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    0x60(%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    0xe33(%rip),%rdi
lea    0x20(%rsp),%rdx
mov    %r12,%rcx
lea    0x40(%rsp),%r8
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1295 <print_game_information+0x135>
lea    0xd92(%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 = [29 x i8] c"data/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 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%15 = load i32, i32* %2
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%18 = call i32 @get_file_lines(i8* %17)
store i32 %18, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %11
%21 = sub nsw i32 %20, %19
store i32 %21, i32* %11
%22 = load i32, i32* %11
%23 = add nsw i32 %22, 1
store i32 %23, i32* %11
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %3
%26 = load i32*, i32** %3
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %51
30: ; preds = %1
store i32 0, i32* %2
store i32 0, i32* %8
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @fscanf(i32* %31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32*, i32** %3
%34 = call i32 (i32*, i8*, ...) @fscanf(i32* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%35 = load i32*, i32** %3
%36 = call i32 (i32*, i8*, ...) @fscanf(i32* %35, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32* %8, i32* %8)
%37 = load i32*, i32** %3
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %37, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = load i32*, i32** %3
%41 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %41, i32* %4, i32* %9, i8* %10)
%43 = load i32*, i32** %3
%44 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%45 = call i32 (i32*, i8*, ...) @fscanf(i32* %43, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %44, i32* %4, i32* %9, i8* %10)
%46 = load i32, i32* %2
%47 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%48 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%49 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i32 %46, i8* %47, i8* %48, i8* %49)
br label %51
51: ; preds = %30, %28
%52 = load i32*, i32** %3
%53 = call i32 @fclose(i32* %52)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"data/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
%18 = call i32 @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
%19 = call i32 @get_file_lines(i8* %17)
%20 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %33
24: ; preds = %1
store i32 0, i32* %2
store i32 0, i32* %7
%25 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %7)
%28 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %13, i32* %3, i32* %8, i8* %9)
%30 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %14, i32* %3, i32* %8, i8* %9)
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i32 %31, i8* %13, i8* %14, i8* %12)
br label %33
33: ; preds = %24, %22
%34 = call i32 @fclose(i32* %20)
ret void
}