#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 */

/* Variables and functions */
int /*<<< orphan*/ genBoard(char **);
int /*<<< orphan*/ placePiece(char **, char);
int /*<<< orphan*/ printBoard(char **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rotateSquare(char **);
main() {
  char gameBoard[4][9];
  genBoard(gameBoard);
  int playing = 1;
  printBoard(gameBoard);
  while (playing) {
    printf("White's Turn\n\n");
    placePiece(gameBoard, 'W');
    printBoard(gameBoard);
    if (playing) {
      printf("White's Turn\n\n");
      rotateSquare(gameBoard);
      printBoard(gameBoard);
      if (playing) {
        printf("Black's Turn\n\n");
        placePiece(gameBoard, 'B');
        printBoard(gameBoard);
        if (playing) {
          printf("Black's Turn\n\n");
          rotateSquare(gameBoard);
          printBoard(gameBoard);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1070 <genBoard@plt>
movl   $0x1,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
cmpl   $0x0,-0x34(%rbp)
je     1231 <main+0xe1>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x57,%esi
call   1060 <placePiece@plt>
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
cmpl   $0x0,-0x34(%rbp)
je     122c <main+0xdc>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <rotateSquare@plt>
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
cmpl   $0x0,-0x34(%rbp)
je     1227 <main+0xd7>
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x42,%esi
call   1060 <placePiece@plt>
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
cmpl   $0x0,-0x34(%rbp)
je     1222 <main+0xd2>
lea    0xe04(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <rotateSquare@plt>
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
jmp    1227 <main+0xd7>
jmp    122c <main+0xdc>
jmp    1178 <main+0x28>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <genBoard@plt>
mov    %rbx,%rdi
call   1030 <printBoard@plt>
lea    0xe8d(%rip),%r14
lea    0xe94(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x57,%esi
call   1060 <placePiece@plt>
mov    %rbx,%rdi
call   1030 <printBoard@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <rotateSquare@plt>
mov    %rbx,%rdi
call   1030 <printBoard@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x42,%esi
call   1060 <placePiece@plt>
mov    %rbx,%rdi
call   1030 <printBoard@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <rotateSquare@plt>
mov    %rbx,%rdi
call   1030 <printBoard@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@.str = [15 x i8] c"White's Turn\0A\0A\00"
@.str.1 = [15 x i8] c"Black's Turn\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [9 x i8]]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%5 = bitcast [9 x i8]* %4 to i8**
%6 = call i32 @genBoard(i8** %5)
store i32 1, i32* %3
%7 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%8 = bitcast [9 x i8]* %7 to i8**
%9 = call i32 @printBoard(i8** %8)
br label %10
10: ; preds = %53, %0
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %54
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%16 = bitcast [9 x i8]* %15 to i8**
%17 = call i32 @placePiece(i8** %16, i8 signext 87)
%18 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%19 = bitcast [9 x i8]* %18 to i8**
%20 = call i32 @printBoard(i8** %19)
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %53
23: ; preds = %13
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%26 = bitcast [9 x i8]* %25 to i8**
%27 = call i32 @rotateSquare(i8** %26)
%28 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%29 = bitcast [9 x i8]* %28 to i8**
%30 = call i32 @printBoard(i8** %29)
%31 = load i32, i32* %3
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %52
33: ; preds = %23
%34 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%35 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%36 = bitcast [9 x i8]* %35 to i8**
%37 = call i32 @placePiece(i8** %36, i8 signext 66)
%38 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%39 = bitcast [9 x i8]* %38 to i8**
%40 = call i32 @printBoard(i8** %39)
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %51
43: ; preds = %33
%44 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%45 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%46 = bitcast [9 x i8]* %45 to i8**
%47 = call i32 @rotateSquare(i8** %46)
%48 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %2, i64 0, i64 0
%49 = bitcast [9 x i8]* %48 to i8**
%50 = call i32 @printBoard(i8** %49)
br label %51
51: ; preds = %43, %33
br label %52
52: ; preds = %51, %23
br label %53
53: ; preds = %52, %13
br label %10
54: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@str.2 = [14 x i8] c"White's Turn\0A\00"
@str.4 = [14 x i8] c"Black's Turn\0A\00"
define i32 @main() {
%1 = alloca [4 x [9 x i8]]
%2 = getelementptr inbounds [4 x [9 x i8]], [4 x [9 x i8]]* %1, i64 0, i64 0, i64 0
%3 = bitcast [4 x [9 x i8]]* %1 to i8**
%4 = call i32 @genBoard(i8** %3)
%5 = call i32 @printBoard(i8** %3)
br label %6
6: ; preds = %6, %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
%8 = call i32 @placePiece(i8** %3, i8 signext 87)
%9 = call i32 @printBoard(i8** %3)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
%11 = call i32 @rotateSquare(i8** %3)
%12 = call i32 @printBoard(i8** %3)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
%14 = call i32 @placePiece(i8** %3, i8 signext 66)
%15 = call i32 @printBoard(i8** %3)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
%17 = call i32 @rotateSquare(i8** %3)
%18 = call i32 @printBoard(i8** %3)
br label %6
}