#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 */
#define KEY_DOWN 131
#define KEY_LEFT 130
#define KEY_RIGHT 129
#define KEY_UP 128
int checkWin(int *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ erase();
int getch();
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ initBoard(int *);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvprintw(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int updateBoardData(int *, int, int, int);
int playGame() {
  int boardData[9];
  int playerNum = 1;
  int inputChar;
  int x = 2, y = 1;
  int didWin = 0;
  int canWeMove = 0;
  int nMoves = 0;
  initBoard(boardData);
  mvprintw(8, 0, "It is Player 1's turn to place an (X)");
  move(y, x);
  refresh();
  while (inputChar != 'q') {
    if (nMoves == 9) {
      mvprintw(10, 0, "Tie game");
      inputChar = getch();
      erase();
      return 3;
    }
    inputChar = getch();
    if (inputChar != ' ') {
      switch (inputChar) {
      case KEY_UP:
        if (y == 3 || y == 5) {
          move(y -= 2, x);
        }
        break;
      case KEY_DOWN:
        if (y == 1 || y == 3) {
          move(y += 2, x);
        }
        break;
      case KEY_LEFT:
        if (x == 10 || x == 6) {
          move(y, x -= 4);
        }
        break;
      case KEY_RIGHT:
        if (x == 2 || x == 6) {
          move(y, x += 4);
        }
        break;
      }
    } else if (playerNum == 1 && inputChar == ' ') {
      getyx(stdscr, y, x);
      canWeMove = updateBoardData(boardData, x, y, 1);
      if (canWeMove == 5) {
        mvaddch(y, x, 'X');
        didWin = checkWin(boardData);
        if (didWin) {
          mvprintw(10, 0, "Player 1 wins");
          inputChar = getch();
          erase();
          return 1;
        }
        nMoves += 1;
        playerNum = 2;
        mvprintw(8, 0, "It is Player 2's turn to place an (O)");
        move(y, x);
      }
    } else if (playerNum == 2 && inputChar == ' ') {
      getyx(stdscr, y, x);
      canWeMove = updateBoardData(boardData, x, y, 0);
      if (canWeMove == 5) {
        mvaddch(y, x, 'O');
        didWin = checkWin(boardData);
        if (didWin) {
          mvprintw(10, 0, "Player 2 wins");
          inputChar = getch();
          erase();
          return 1;
        }
        nMoves += 1;
        playerNum = 1;
        mvprintw(8, 0, "It is Player 1's turn to place an (X)");
        move(y, x);
      }
    }
    refresh();
  }
  return 0;
  endwin();
}


x86 assembly (clang, -O0):
<playGame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x1,-0x34(%rbp)
movl   $0x2,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
lea    -0x30(%rbp),%rdi
call   1070 <initBoard@plt>
mov    $0x8,%edi
xor    %esi,%esi
lea    0xe27(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   10c0 <move@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
cmpl   $0x71,-0x38(%rbp)
je     14e5 <playGame+0x345>
cmpl   $0x9,-0x4c(%rbp)
jne    1244 <playGame+0xa4>
mov    $0xa,%edi
xor    %esi,%esi
lea    0xe14(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <erase@plt>
movl   $0x3,-0x4(%rbp)
jmp    14ec <playGame+0x34c>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x20,-0x38(%rbp)
je     132e <playGame+0x18e>
mov    -0x38(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x3,%eax
ja     1329 <playGame+0x189>
mov    -0x58(%rbp),%rax
lea    0xd88(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x3,-0x40(%rbp)
je     1295 <playGame+0xf5>
cmpl   $0x5,-0x40(%rbp)
jne    12a6 <playGame+0x106>
mov    -0x40(%rbp),%edi
sub    $0x2,%edi
mov    %edi,-0x40(%rbp)
mov    -0x3c(%rbp),%esi
call   10c0 <move@plt>
jmp    1329 <playGame+0x189>
cmpl   $0x1,-0x40(%rbp)
je     12bf <playGame+0x11f>
cmpl   $0x3,-0x40(%rbp)
jne    12d0 <playGame+0x130>
mov    -0x40(%rbp),%edi
add    $0x2,%edi
mov    %edi,-0x40(%rbp)
mov    -0x3c(%rbp),%esi
call   10c0 <move@plt>
jmp    1329 <playGame+0x189>
cmpl   $0xa,-0x3c(%rbp)
je     12e9 <playGame+0x149>
cmpl   $0x6,-0x3c(%rbp)
jne    12fa <playGame+0x15a>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
sub    $0x4,%esi
mov    %esi,-0x3c(%rbp)
call   10c0 <move@plt>
jmp    1329 <playGame+0x189>
cmpl   $0x2,-0x3c(%rbp)
je     1313 <playGame+0x173>
cmpl   $0x6,-0x3c(%rbp)
jne    1324 <playGame+0x184>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
add    $0x4,%esi
mov    %esi,-0x3c(%rbp)
call   10c0 <move@plt>
jmp    1329 <playGame+0x189>
jmp    14d9 <playGame+0x339>
cmpl   $0x1,-0x34(%rbp)
jne    1400 <playGame+0x260>
cmpl   $0x20,-0x38(%rbp)
jne    1400 <playGame+0x260>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
call   1030 <getyx@plt>
lea    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    $0x1,%ecx
call   1060 <updateBoardData@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x5,-0x48(%rbp)
jne    13fb <playGame+0x25b>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    $0x58,%edx
call   10a0 <mvaddch@plt>
lea    -0x30(%rbp),%rdi
call   1050 <checkWin@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     13cd <playGame+0x22d>
mov    $0xa,%edi
xor    %esi,%esi
lea    0xc94(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <erase@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ec <playGame+0x34c>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movl   $0x2,-0x34(%rbp)
mov    $0x8,%edi
xor    %esi,%esi
lea    0xc62(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   10c0 <move@plt>
jmp    14d4 <playGame+0x334>
cmpl   $0x2,-0x34(%rbp)
jne    14cf <playGame+0x32f>
cmpl   $0x20,-0x38(%rbp)
jne    14cf <playGame+0x32f>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
call   1030 <getyx@plt>
lea    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
xor    %ecx,%ecx
call   1060 <updateBoardData@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x5,-0x48(%rbp)
jne    14ca <playGame+0x32a>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    $0x4f,%edx
call   10a0 <mvaddch@plt>
lea    -0x30(%rbp),%rdi
call   1050 <checkWin@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     149c <playGame+0x2fc>
mov    $0xa,%edi
xor    %esi,%esi
lea    0xbf9(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    $0x0,%al
call   1090 <getch@plt>
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <erase@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ec <playGame+0x34c>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movl   $0x1,-0x34(%rbp)
mov    $0x8,%edi
xor    %esi,%esi
lea    0xb56(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   10c0 <move@plt>
jmp    14cf <playGame+0x32f>
jmp    14d4 <playGame+0x334>
jmp    14d9 <playGame+0x339>
mov    $0x0,%al
call   1080 <refresh@plt>
jmp    1200 <playGame+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<playGame>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1070 <initBoard@plt>
lea    0xe53(%rip),%rdx
mov    $0x8,%edi
xor    %esi,%esi
call   10b0 <mvprintw@plt>
mov    $0x1,%ebp
mov    $0x2,%ebx
mov    $0x1,%edi
mov    $0x2,%esi
call   10c0 <move@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
xor    %r12d,%r12d
mov    $0x1,%r15d
jmp    1214 <playGame+0x74>
add    $0xfffffffe,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
call   10c0 <move@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1080 <refresh@plt>
cmp    $0x71,%r13d
je     13c5 <playGame+0x225>
cmp    $0x9,%r12d
je     139e <playGame+0x1fe>
xor    %eax,%eax
call   1090 <getch@plt>
mov    %eax,%r13d
lea    -0x80(%r13),%eax
cmp    $0x3,%eax
ja     1250 <playGame+0xb0>
lea    0xdc8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmp    $0x5,%ebp
je     11f4 <playGame+0x54>
cmp    $0x3,%ebp
je     11f4 <playGame+0x54>
jmp    1200 <playGame+0x60>
nopl   (%rax)
cmp    $0x20,%r13d
jne    1200 <playGame+0x60>
cmp    $0x2,%r15d
mov    %rsp,%r14
je     1329 <playGame+0x189>
mov    %r15d,%eax
cmp    $0x1,%r15d
jne    1200 <playGame+0x60>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <getyx@plt>
mov    $0x1,%r15d
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1060 <updateBoardData@plt>
cmp    $0x5,%eax
jne    1200 <playGame+0x60>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x58,%edx
call   10a0 <mvaddch@plt>
mov    %r14,%rdi
call   1050 <checkWin@plt>
test   %eax,%eax
jne    13d7 <playGame+0x237>
add    $0x1,%r12d
mov    $0x8,%edi
xor    %esi,%esi
lea    0xd7f(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   10c0 <move@plt>
mov    $0x2,%r15d
jmp    1200 <playGame+0x60>
mov    %ebx,%eax
and    $0xfffffffb,%eax
cmp    $0x2,%eax
jne    1200 <playGame+0x60>
add    $0x4,%ebx
jmp    11f7 <playGame+0x57>
cmp    $0xa,%ebx
je     130b <playGame+0x16b>
cmp    $0x6,%ebx
jne    1200 <playGame+0x60>
add    $0xfffffffc,%ebx
jmp    11f7 <playGame+0x57>
mov    %ebp,%eax
and    $0xfffffffd,%eax
cmp    $0x1,%eax
jne    1200 <playGame+0x60>
add    $0x2,%ebp
jmp    11f7 <playGame+0x57>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <getyx@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1060 <updateBoardData@plt>
cmp    $0x5,%eax
jne    1393 <playGame+0x1f3>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x4f,%edx
call   10a0 <mvaddch@plt>
mov    %r14,%rdi
call   1050 <checkWin@plt>
test   %eax,%eax
jne    13e6 <playGame+0x246>
add    $0x1,%r12d
mov    $0x8,%edi
xor    %esi,%esi
lea    0xc96(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   10c0 <move@plt>
mov    $0x1,%r15d
jmp    1200 <playGame+0x60>
mov    $0x2,%r15d
jmp    1200 <playGame+0x60>
mov    $0x3,%r14d
lea    0xc8b(%rip),%rdx
mov    $0xa,%edi
xor    %esi,%esi
call   10b0 <mvprintw@plt>
xor    %eax,%eax
call   1090 <getch@plt>
xor    %eax,%eax
call   1040 <erase@plt>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r14d
lea    0xc5b(%rip),%rdx
jmp    13ab <playGame+0x20b>
mov    $0x1,%r14d
lea    0xc80(%rip),%rdx
jmp    13ab <playGame+0x20b>

LLVM IR (-O0):
@.str = [38 x i8] c"It is Player 1's turn to place an (X)\00"
@.str.1 = [9 x i8] c"Tie game\00"
@stdscr = global i32 0
@.str.2 = [14 x i8] c"Player 1 wins\00"
@.str.3 = [38 x i8] c"It is Player 2's turn to place an (O)\00"
@.str.4 = [14 x i8] c"Player 2 wins\00"
define i32 @playGame() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 1, i32* %3
store i32 2, i32* %5
store i32 1, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%11 = call i32 @initBoard(i32* %10)
%12 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = call i32 @move(i32 %13, i32 %14)
%16 = call i32 (...) @refresh()
br label %17
17: ; preds = %158, %0
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 113
br i1 %19, label %20, label %160
20: ; preds = %17
%21 = load i32, i32* %9
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = call i32 @mvprintw(i32 10, i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 (...) @getch()
store i32 %25, i32* %4
%26 = call i32 (...) @erase()
store i32 3, i32* %1
br label %161
27: ; preds = %20
%28 = call i32 (...) @getch()
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 32
br i1 %30, label %31, label %82
31: ; preds = %27
%32 = load i32, i32* %4
switch i32 %32, label %81 [
i32 128, label %33
i32 131, label %45
i32 130, label %57
i32 129, label %69
]
33: ; preds = %31
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 3
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 5
br i1 %38, label %39, label %44
39: ; preds = %36, %33
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 2
store i32 %41, i32* %6
%42 = load i32, i32* %5
%43 = call i32 @move(i32 %41, i32 %42)
br label %44
44: ; preds = %39, %36
br label %81
45: ; preds = %31
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 1
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 3
br i1 %50, label %51, label %56
51: ; preds = %48, %45
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 2
store i32 %53, i32* %6
%54 = load i32, i32* %5
%55 = call i32 @move(i32 %53, i32 %54)
br label %56
56: ; preds = %51, %48
br label %81
57: ; preds = %31
%58 = load i32, i32* %5
%59 = icmp eq i32 %58, 10
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i32, i32* %5
%62 = icmp eq i32 %61, 6
br i1 %62, label %63, label %68
63: ; preds = %60, %57
%64 = load i32, i32* %6
%65 = load i32, i32* %5
%66 = sub nsw i32 %65, 4
store i32 %66, i32* %5
%67 = call i32 @move(i32 %64, i32 %66)
br label %68
68: ; preds = %63, %60
br label %81
69: ; preds = %31
%70 = load i32, i32* %5
%71 = icmp eq i32 %70, 2
br i1 %71, label %75, label %72
72: ; preds = %69
%73 = load i32, i32* %5
%74 = icmp eq i32 %73, 6
br i1 %74, label %75, label %80
75: ; preds = %72, %69
%76 = load i32, i32* %6
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 4
store i32 %78, i32* %5
%79 = call i32 @move(i32 %76, i32 %78)
br label %80
80: ; preds = %75, %72
br label %81
81: ; preds = %31, %80, %68, %56, %44
br label %158
82: ; preds = %27
%83 = load i32, i32* %3
%84 = icmp eq i32 %83, 1
br i1 %84, label %85, label %119
85: ; preds = %82
%86 = load i32, i32* %4
%87 = icmp eq i32 %86, 32
br i1 %87, label %88, label %119
88: ; preds = %85
%89 = load i32, i32* @stdscr
%90 = load i32, i32* %6
%91 = load i32, i32* %5
%92 = call i32 @getyx(i32 %89, i32 %90, i32 %91)
%93 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%94 = load i32, i32* %5
%95 = load i32, i32* %6
%96 = call i32 @updateBoardData(i32* %93, i32 %94, i32 %95, i32 1)
store i32 %96, i32* %8
%97 = load i32, i32* %8
%98 = icmp eq i32 %97, 5
br i1 %98, label %99, label %118
99: ; preds = %88
%100 = load i32, i32* %6
%101 = load i32, i32* %5
%102 = call i32 @mvaddch(i32 %100, i32 %101, i8 signext 88)
%103 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%104 = call i32 @checkWin(i32* %103)
store i32 %104, i32* %7
%105 = load i32, i32* %7
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %99
%108 = call i32 @mvprintw(i32 10, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%109 = call i32 (...) @getch()
store i32 %109, i32* %4
%110 = call i32 (...) @erase()
store i32 1, i32* %1
br label %161
111: ; preds = %99
%112 = load i32, i32* %9
%113 = add nsw i32 %112, 1
store i32 %113, i32* %9
store i32 2, i32* %3
%114 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%115 = load i32, i32* %6
%116 = load i32, i32* %5
%117 = call i32 @move(i32 %115, i32 %116)
br label %118
118: ; preds = %111, %88
br label %157
119: ; preds = %85, %82
%120 = load i32, i32* %3
%121 = icmp eq i32 %120, 2
br i1 %121, label %122, label %156
122: ; preds = %119
%123 = load i32, i32* %4
%124 = icmp eq i32 %123, 32
br i1 %124, label %125, label %156
125: ; preds = %122
%126 = load i32, i32* @stdscr
%127 = load i32, i32* %6
%128 = load i32, i32* %5
%129 = call i32 @getyx(i32 %126, i32 %127, i32 %128)
%130 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%131 = load i32, i32* %5
%132 = load i32, i32* %6
%133 = call i32 @updateBoardData(i32* %130, i32 %131, i32 %132, i32 0)
store i32 %133, i32* %8
%134 = load i32, i32* %8
%135 = icmp eq i32 %134, 5
br i1 %135, label %136, label %155
136: ; preds = %125
%137 = load i32, i32* %6
%138 = load i32, i32* %5
%139 = call i32 @mvaddch(i32 %137, i32 %138, i8 signext 79)
%140 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%141 = call i32 @checkWin(i32* %140)
store i32 %141, i32* %7
%142 = load i32, i32* %7
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %148
144: ; preds = %136
%145 = call i32 @mvprintw(i32 10, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%146 = call i32 (...) @getch()
store i32 %146, i32* %4
%147 = call i32 (...) @erase()
store i32 1, i32* %1
br label %161
148: ; preds = %136
%149 = load i32, i32* %9
%150 = add nsw i32 %149, 1
store i32 %150, i32* %9
store i32 1, i32* %3
%151 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%152 = load i32, i32* %6
%153 = load i32, i32* %5
%154 = call i32 @move(i32 %152, i32 %153)
br label %155
155: ; preds = %148, %125
br label %156
156: ; preds = %155, %122, %119
br label %157
157: ; preds = %156, %118
br label %158
158: ; preds = %157, %81
%159 = call i32 (...) @refresh()
br label %17
160: ; preds = %17
store i32 0, i32* %1
br label %161
161: ; preds = %160, %144, %107, %23
%162 = load i32, i32* %1
ret i32 %162
}

LLVM IR (-O2):
@.str = [38 x i8] c"It is Player 1's turn to place an (X)\00"
@.str.1 = [9 x i8] c"Tie game\00"
@stdscr = global i32 0
@.str.2 = [14 x i8] c"Player 1 wins\00"
@.str.3 = [38 x i8] c"It is Player 2's turn to place an (O)\00"
@.str.4 = [14 x i8] c"Player 2 wins\00"
define i32 @playGame() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @initBoard(i32* %3)
%5 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @move(i32 1, i32 2)
%7 = call i32 (...) @refresh()
br label %8
8: ; preds = %0, %63
%9 = phi i32 [ %67, %63 ], [ 0, %0 ]
%10 = phi i32 [ %66, %63 ], [ 1, %0 ]
%11 = phi i32 [ %65, %63 ], [ 2, %0 ]
%12 = phi i32 [ %64, %63 ], [ 1, %0 ]
%13 = icmp eq i32 %9, 9
br i1 %13, label %70, label %14
14: ; preds = %8
%15 = call i32 (...) @getch()
switch i32 %15, label %63 [
i32 32, label %36
i32 128, label %16
i32 131, label %20
i32 130, label %26
i32 129, label %30
]
16: ; preds = %14
switch i32 %10, label %63 [
i32 5, label %17
i32 3, label %17
]
17: ; preds = %16, %16
%18 = add nsw i32 %10, -2
%19 = call i32 @move(i32 %18, i32 %11)
br label %63
20: ; preds = %14
%21 = and i32 %10, -3
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %63
23: ; preds = %20
%24 = add nuw nsw i32 %10, 2
%25 = call i32 @move(i32 %24, i32 %11)
br label %63
26: ; preds = %14
switch i32 %11, label %63 [
i32 10, label %27
i32 6, label %27
]
27: ; preds = %26, %26
%28 = add nsw i32 %11, -4
%29 = call i32 @move(i32 %10, i32 %28)
br label %63
30: ; preds = %14
%31 = and i32 %11, -5
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %63
33: ; preds = %30
%34 = add nuw nsw i32 %11, 4
%35 = call i32 @move(i32 %10, i32 %34)
br label %63
36: ; preds = %14
switch i32 %12, label %63 [
i32 1, label %37
i32 2, label %50
]
37: ; preds = %36
%38 = load i32, i32* @stdscr
%39 = call i32 @getyx(i32 %38, i32 %10, i32 %11)
%40 = call i32 @updateBoardData(i32* %3, i32 %11, i32 %10, i32 1)
%41 = icmp eq i32 %40, 5
br i1 %41, label %42, label %63
42: ; preds = %37
%43 = call i32 @mvaddch(i32 %10, i32 %11, i8 signext 88)
%44 = call i32 @checkWin(i32* %3)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %70
46: ; preds = %42
%47 = add nsw i32 %9, 1
%48 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @move(i32 %10, i32 %11)
br label %63
50: ; preds = %36
%51 = load i32, i32* @stdscr
%52 = call i32 @getyx(i32 %51, i32 %10, i32 %11)
%53 = call i32 @updateBoardData(i32* %3, i32 %11, i32 %10, i32 0)
%54 = icmp eq i32 %53, 5
br i1 %54, label %55, label %63
55: ; preds = %50
%56 = call i32 @mvaddch(i32 %10, i32 %11, i8 signext 79)
%57 = call i32 @checkWin(i32* %3)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %70
59: ; preds = %55
%60 = add nsw i32 %9, 1
%61 = call i32 @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @move(i32 %10, i32 %11)
br label %63
63: ; preds = %36, %26, %16, %14, %46, %37, %50, %59, %17, %20, %23, %27, %30, %33
%64 = phi i32 [ %12, %33 ], [ %12, %30 ], [ %12, %27 ], [ %12, %26 ], [ %12, %23 ], [ %12, %20 ], [ %12, %17 ], [ %12, %16 ], [ 2, %46 ], [ 1, %37 ], [ 1, %59 ], [ 2, %50 ], [ %12, %14 ], [ %12, %36 ]
%65 = phi i32 [ %34, %33 ], [ %11, %30 ], [ %28, %27 ], [ %11, %26 ], [ %11, %23 ], [ %11, %20 ], [ %11, %17 ], [ %11, %16 ], [ %11, %46 ], [ %11, %37 ], [ %11, %59 ], [ %11, %50 ], [ %11, %14 ], [ %11, %36 ]
%66 = phi i32 [ %10, %33 ], [ %10, %30 ], [ %10, %27 ], [ %10, %26 ], [ %24, %23 ], [ %10, %20 ], [ %18, %17 ], [ %10, %16 ], [ %10, %46 ], [ %10, %37 ], [ %10, %59 ], [ %10, %50 ], [ %10, %14 ], [ %10, %36 ]
%67 = phi i32 [ %9, %33 ], [ %9, %30 ], [ %9, %27 ], [ %9, %26 ], [ %9, %23 ], [ %9, %20 ], [ %9, %17 ], [ %9, %16 ], [ %47, %46 ], [ %9, %37 ], [ %60, %59 ], [ %9, %50 ], [ %9, %14 ], [ %9, %36 ]
%68 = call i32 (...) @refresh()
%69 = icmp eq i32 %15, 113
br i1 %69, label %76, label %8
70: ; preds = %55, %42, %8
%71 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %42 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %55 ]
%72 = phi i32 [ 3, %8 ], [ 1, %42 ], [ 1, %55 ]
%73 = call i32 @mvprintw(i32 10, i32 0, i8* %71)
%74 = call i32 (...) @getch()
%75 = call i32 (...) @erase()
br label %76
76: ; preds = %63, %70
%77 = phi i32 [ %72, %70 ], [ 0, %63 ]
ret i32 %77
}