#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getMoveFromLine2(char *, char *, int);
int /*<<< orphan*/ printLineWithTransformedMove(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ transformMove(char *, int, int, char *);
int transformAndPrintGame(FILE *gameFile, int boardSize, int transformations) {
  rewind(gameFile);
  char line[1000];
  char move[3];
  while (fgets(line, 1000, gameFile) != NULL) {
    if (!getMoveFromLine2(line, move, boardSize)) {
      char transformedMove[3];
      transformMove(move, boardSize, transformations, transformedMove);
      printLineWithTransformedMove(line, transformedMove);
    } else {
      printf("%s", line);
    }
  }
}


x86 assembly (clang, -O0):
<transformAndPrintGame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x3e8,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1205 <transformAndPrintGame+0xa5>
lea    -0x400(%rbp),%rdi
lea    -0x403(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1080 <getMoveFromLine2@plt>
cmp    $0x0,%eax
jne    11ed <transformAndPrintGame+0x8d>
lea    -0x403(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x406(%rbp),%rcx
call   1030 <transformMove@plt>
lea    -0x400(%rbp),%rdi
lea    -0x406(%rbp),%rsi
call   1070 <printLineWithTransformedMove@plt>
jmp    1200 <transformAndPrintGame+0xa0>
lea    -0x400(%rbp),%rsi
lea    0xe05(%rip),%rdi
call   1040 <printf@plt>
jmp    117e <transformAndPrintGame+0x1e>
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transformAndPrintGame>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
mov    %edx,0x4(%rsp)
mov    %esi,%ebp
mov    %rdi,%r15
call   1050 <rewind@plt>
lea    0x10(%rsp),%rdi
mov    $0x3e8,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11ff <transformAndPrintGame+0x9f>
lea    0x10(%rsp),%rbx
lea    0xd(%rsp),%r12
lea    0xa(%rsp),%r13
lea    0xe54(%rip),%r14
jmp    11d0 <transformAndPrintGame+0x70>
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11ff <transformAndPrintGame+0x9f>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1080 <getMoveFromLine2@plt>
test   %eax,%eax
jne    11b0 <transformAndPrintGame+0x50>
mov    %r12,%rdi
mov    %ebp,%esi
mov    0x4(%rsp),%edx
mov    %r13,%rcx
call   1030 <transformMove@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <printLineWithTransformedMove@plt>
jmp    11bb <transformAndPrintGame+0x5b>
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @transformAndPrintGame(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1000 x i8]
%9 = alloca [3 x i8]
%10 = alloca [3 x i8]
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load i32*, i32** %5
%12 = call i32 @rewind(i32* %11)
br label %13
13: ; preds = %36, %3
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%15 = load i32*, i32** %5
%16 = call i32* @fgets(i8* %14, i32 1000, i32* %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %37
18: ; preds = %13
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%21 = load i32, i32* %6
%22 = call i32 @getMoveFromLine2(i8* %19, i8* %20, i32 %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %33, label %24
24: ; preds = %18
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%29 = call i32 @transformMove(i8* %25, i32 %26, i32 %27, i8* %28)
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%32 = call i32 @printLineWithTransformedMove(i8* %30, i8* %31)
br label %36
33: ; preds = %18
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %33, %24
br label %13
37: ; preds = %13
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @transformAndPrintGame(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [1000 x i8]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = tail call i32 @rewind(i32* %0)
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%10 = call i32* @fgets(i8* %8, i32 1000, i32* %0)
%11 = icmp eq i32* %10, null
br i1 %11, label %25, label %12
12: ; preds = %3
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
br label %14
14: ; preds = %12, %22
%15 = call i32 @getMoveFromLine2(i8* %8, i8* %9, i32 %1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 @transformMove(i8* %9, i32 %1, i32 %2, i8* %13)
%19 = call i32 @printLineWithTransformedMove(i8* %8, i8* %13)
br label %22
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %22
22: ; preds = %20, %17
%23 = call i32* @fgets(i8* %8, i32 1000, i32* %0)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %14
25: ; preds = %22, %3
ret i32 undef
}