#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 findTransformations(char *, int, int);
int getNextMove(int /*<<< orphan*/ *, char *);
int getTransformations(FILE *gameFile, int boardSize) {
  int transformations = 0;
  char nextMove[3];
  int status = getNextMove(gameFile, nextMove);
  if (status == -99) {
    return status;
  }
  while (transformations < 55) {
    transformations = findTransformations(nextMove, boardSize, transformations);
    status = getNextMove(gameFile, nextMove);
    if (status != 0) {
      return status;
    }
  }
  return transformations;
}


x86 assembly (clang, -O0):
<getTransformations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
call   1030 <getNextMove@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffff9d,-0x20(%rbp)
jne    115b <getTransformations+0x3b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ac <getTransformations+0x8c>
jmp    1160 <getTransformations+0x40>
cmpl   $0x37,-0x18(%rbp)
jge    11a6 <getTransformations+0x86>
lea    -0x1b(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <findTransformations@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
call   1030 <getNextMove@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11a1 <getTransformations+0x81>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ac <getTransformations+0x8c>
jmp    1160 <getTransformations+0x40>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTransformations>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x5(%rsp),%rsi
call   1030 <getNextMove@plt>
mov    $0xffffff9d,%ebp
cmp    $0xffffff9d,%eax
je     1175 <getTransformations+0x55>
xor    %ebp,%ebp
lea    0x5(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
cmp    $0x36,%ebp
jg     1175 <getTransformations+0x55>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <findTransformations@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <getNextMove@plt>
test   %eax,%eax
je     1150 <getTransformations+0x30>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getTransformations(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x i8]
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
%9 = load i32*, i32** %4
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%11 = call i32 @getNextMove(i32* %9, i8* %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp eq i32 %12, -99
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %8
store i32 %15, i32* %3
br label %35
16: ; preds = %2
br label %17
17: ; preds = %32, %16
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 55
br i1 %19, label %20, label %33
20: ; preds = %17
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call i32 @findTransformations(i8* %21, i32 %22, i32 %23)
store i32 %24, i32* %6
%25 = load i32*, i32** %4
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%27 = call i32 @getNextMove(i32* %25, i8* %26)
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %20
%31 = load i32, i32* %8
store i32 %31, i32* %3
br label %35
32: ; preds = %20
br label %17
33: ; preds = %17
%34 = load i32, i32* %6
store i32 %34, i32* %3
br label %35
35: ; preds = %33, %30, %14
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @getTransformations(i32* %0, i32 %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = call i32 @getNextMove(i32* %0, i8* %4)
%6 = icmp eq i32 %5, -99
br i1 %6, label %14, label %7
7: ; preds = %2, %10
%8 = phi i32 [ %11, %10 ], [ 0, %2 ]
%9 = icmp slt i32 %8, 55
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32 @findTransformations(i8* %4, i32 %1, i32 %8)
%12 = call i32 @getNextMove(i32* %0, i8* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %10, %2
%15 = phi i32 [ -99, %2 ], [ %8, %7 ], [ %12, %10 ]
ret i32 %15
}