#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*/ displaymap(int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(int **, int, int, int, int, int, int *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y, i, dx, dy;
  int c = 1;
  int q[] = {2, 0, 2};
  int g = 0;
  char d[] = "X-0";
  int a[8][8] = {{0, 0, 0, 0, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 0, 0, 0},
                 {0, 0, 0, 0, 0, 0, 0, 0},  {0, 0, 0, 1, -1, 0, 0, 0},
                 {0, 0, 0, -1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0},
                 {0, 0, 0, 0, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 0, 0, 0}};
  for (i = 0; i < 60; i++) {
    displaymap(a);
    printf("turn: %d (O:%d, X:%d)\n", i, q[-c + 1], q[c + 1]);
    printf("\n");
    printf("%c x y >", d[c + 1]);
    scanf("%d"
          "%d",
          &x, &y);
    if (x < 0 || y < 0 || 7 < x || 7 < y) {
      printf("Can't put it here\n");
      i--;
      continue;
    }
    if (a[x][y] != 0) {
      printf("Can't put it here\n");
      i--;
      continue;
    }
    g = 0;
    for (dy = -1; dy < 2; dy++) {
      for (dx = -1; dx < 2; dx++)
        reverse(a, c, x + dx, y + dy, dx, dy, &g);
    }
    if (g == 0) {
      printf("Can't put it here\n");
      i--;
      continue;
    }
    a[x][y] = c;
    q[c + 1] = q[c + 1] + g + 1;
    q[-c + 1] = q[-c + 1] - g;
    if (q[c + 1] == 0 || q[-c + 1] == 0) {
      displaymap(a);
      break;
    }
    printf("\n");
    c = -c;
  }
  if (q[c + 1] < q[-c + 1])
    printf("WIN : X\n");
  else if (q[-c + 1] < q[c + 1])
    printf("WIN : O\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    0xe90(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe8e(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0xe82(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movl   $0x1,-0xc4(%rbp)
movl   $0xffffffff,-0xc0(%rbp)
ff ff ff
movl   $0xffffffff,-0xa4(%rbp)
ff ff ff
movl   $0x1,-0xa0(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3c,-0x10(%rbp)
jge    1426 <main+0x2d6>
lea    -0x130(%rbp),%rdi
call   1060 <displaymap@plt>
mov    -0x10(%rbp),%esi
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%edx
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%ecx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x30(%rbp,%rax,1),%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     127d <main+0x12d>
cmpl   $0x0,-0xc(%rbp)
jl     127d <main+0x12d>
mov    $0x7,%eax
cmp    -0x8(%rbp),%eax
jl     127d <main+0x12d>
mov    $0x7,%eax
cmp    -0xc(%rbp),%eax
jge    1299 <main+0x149>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1418 <main+0x2c8>
movslq -0x8(%rbp),%rcx
lea    -0x130(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     12d5 <main+0x185>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1418 <main+0x2c8>
movl   $0x0,-0x2c(%rbp)
movl   $0xffffffff,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    134a <main+0x1fa>
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1337 <main+0x1e7>
lea    -0x130(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%edx
add    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    -0x2c(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <reverse@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12f4 <main+0x1a4>
jmp    133c <main+0x1ec>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12e3 <main+0x193>
cmpl   $0x0,-0x2c(%rbp)
jne    1370 <main+0x220>
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1418 <main+0x2c8>
mov    -0x1c(%rbp),%edx
movslq -0x8(%rbp),%rcx
lea    -0x130(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%ecx
add    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x28(%rbp,%rax,4)
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%ecx
sub    -0x2c(%rbp),%ecx
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x28(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0x0,-0x28(%rbp,%rax,4)
je     13f1 <main+0x2a1>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0x0,-0x28(%rbp,%rax,4)
jne    1402 <main+0x2b2>
lea    -0x130(%rbp),%rdi
call   1060 <displaymap@plt>
jmp    1426 <main+0x2d6>
lea    0xc1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11cf <main+0x7f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%eax
xor    %ecx,%ecx
sub    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x28(%rbp,%rcx,4),%eax
jge    145a <main+0x30a>
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    148e <main+0x33e>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x28(%rbp,%rcx,4),%eax
jge    1489 <main+0x339>
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    148e <main+0x33e>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    0xe91(%rip),%eax
mov    %eax,0x20(%rsp)
mov    0xe7e(%rip),%rax
mov    %rax,0x18(%rsp)
movl   $0x0,0x14(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x1,0x9c(%rsp)
movl   $0xffffffff,0xa0(%rsp)
ff ff ff ff
movl   $0xffffffff,0xbc(%rsp)
ff ff ff ff
movl   $0x1,0xc0(%rsp)
mov    $0x1,%ebx
lea    0x30(%rsp),%r14
xor    %r12d,%r12d
jmp    1262 <main+0x102>
xchg   %ax,%ax
lea    0xdfe(%rip),%rdi
call   1050 <puts@plt>
add    $0xffffffff,%r12d
lea    0x1(%r12),%eax
cmp    $0x3b,%r12d
mov    %eax,%r12d
jge    14c1 <main+0x361>
mov    %r14,%rdi
call   1070 <displaymap@plt>
mov    $0x1,%r15d
sub    %ebx,%r15d
mov    0x18(%rsp,%r15,4),%edx
lea    0x1(%rbx),%r13d
mov    0x18(%rsp,%r13,4),%ebp
lea    0xd88(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd67(%rip),%rax
movsbl 0x0(%r13,%rax,1),%esi
lea    0xd75(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd70(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1080 <scanf@plt>
mov    0x10(%rsp),%edx
cmp    $0x7,%edx
jg     1240 <main+0xe0>
test   %edx,%edx
js     1240 <main+0xe0>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
js     1240 <main+0xe0>
cmp    $0x8,%ecx
jge    1240 <main+0xe0>
mov    %rdx,%rax
shl    $0x5,%rax
add    %rsp,%rax
add    $0x30,%rax
cmpl   $0x0,(%rax,%rcx,4)
jne    1240 <main+0xe0>
mov    %rbp,0x28(%rsp)
movl   $0x0,0x14(%rsp)
add    $0xffffffff,%edx
add    $0xffffffff,%ecx
mov    %r14,%rbp
lea    0x14(%rsp),%r14
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0xffffffff,%r8d
mov    $0xffffffff,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
add    $0xffffffff,%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
add    $0x1,%edx
mov    0xc(%rsp),%ecx
add    $0xffffffff,%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0x1,%r8d
mov    $0xffffffff,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
add    $0xffffffff,%edx
mov    0xc(%rsp),%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
add    $0x1,%edx
mov    0xc(%rsp),%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0x1,%r8d
xor    %r9d,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
add    $0xffffffff,%edx
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0xffffffff,%r8d
mov    $0x1,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %r8d,%r8d
mov    $0x1,%r9d
call   1030 <reverse@plt>
mov    0x10(%rsp),%edx
add    $0x1,%edx
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %r14,(%rsp)
mov    %rbp,%r14
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1030 <reverse@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
je     1240 <main+0xe0>
movslq 0x10(%rsp),%rcx
movslq 0xc(%rsp),%rdx
shl    $0x5,%rcx
add    %rsp,%rcx
add    $0x30,%rcx
mov    %ebx,(%rcx,%rdx,4)
mov    0x28(%rsp),%rcx
add    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x18(%rsp,%r13,4)
mov    0x18(%rsp,%r15,4),%ecx
sub    %eax,%ecx
mov    %ecx,0x18(%rsp,%r15,4)
cmpl   $0x0,0x18(%rsp,%r13,4)
je     150d <main+0x3ad>
test   %ecx,%ecx
je     150d <main+0x3ad>
neg    %ebx
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1250 <main+0xf0>
mov    $0x1,%r15d
sub    %ebx,%r15d
add    $0x1,%ebx
mov    %ebx,%r13d
mov    %r13d,%eax
mov    %r15d,%ecx
mov    0x18(%rsp,%rax,4),%eax
mov    0x18(%rsp,%rcx,4),%ecx
cmp    %ecx,%eax
jge    14eb <main+0x38b>
lea    0xb54(%rip),%rdi
jmp    14f4 <main+0x394>
jle    14f9 <main+0x399>
lea    0xb41(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x30(%rsp),%rdi
call   1070 <displaymap@plt>
jmp    14d0 <main+0x370>

LLVM IR (-O0):
@__const.main.q = [3 x i32] [i32 2, i32 0, i32 2]
@__const.main.d = [4 x i8] c"X-0\00"
@.str = [23 x i8] c"turn: %d (O:%d, X:%d)\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [9 x i8] c"%c x y >\00"
@.str.3 = [5 x i8] c"%d%d\00"
@.str.4 = [19 x i8] c"Can't put it here\0A\00"
@.str.5 = [9 x i8] c"WIN : X\0A\00"
@.str.6 = [9 x i8] c"WIN : O\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i32]
%9 = alloca i32
%10 = alloca [4 x i8]
%11 = alloca [8 x [8 x i32]]
store i32 0, i32* %1
store i32 1, i32* %7
%12 = bitcast [3 x i32]* %8 to i8*
store i32 0, i32* %9
%13 = bitcast [4 x i8]* %10 to i8*
%14 = bitcast [8 x [8 x i32]]* %11 to i8*
%15 = bitcast i8* %14 to [8 x [8 x i32]]*
%16 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %15, i32 0, i32 3
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %16, i32 0, i32 3
store i32 1, i32* %17
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %16, i32 0, i32 4
store i32 -1, i32* %18
%19 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %15, i32 0, i32 4
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %19, i32 0, i32 3
store i32 -1, i32* %20
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %19, i32 0, i32 4
store i32 1, i32* %21
store i32 0, i32* %4
br label %22
22: ; preds = %169, %0
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 60
br i1 %24, label %25, label %172
25: ; preds = %22
%26 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %11, i64 0, i64 0
%27 = bitcast [8 x i32]* %26 to i32**
%28 = call i32 @displaymap(i32** %27)
%29 = load i32, i32* %4
%30 = load i32, i32* %7
%31 = sub nsw i32 0, %30
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %35, i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3)
%51 = load i32, i32* %2
%52 = icmp slt i32 %51, 0
br i1 %52, label %62, label %53
53: ; preds = %25
%54 = load i32, i32* %3
%55 = icmp slt i32 %54, 0
br i1 %55, label %62, label %56
56: ; preds = %53
%57 = load i32, i32* %2
%58 = icmp slt i32 7, %57
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = load i32, i32* %3
%61 = icmp slt i32 7, %60
br i1 %61, label %62, label %66
62: ; preds = %59, %56, %53, %25
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%64 = load i32, i32* %4
%65 = add nsw i32 %64, -1
store i32 %65, i32* %4
br label %169
66: ; preds = %59
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %11, i64 0, i64 %68
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [8 x i32], [8 x i32]* %69, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %66
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%77 = load i32, i32* %4
%78 = add nsw i32 %77, -1
store i32 %78, i32* %4
br label %169
79: ; preds = %66
store i32 0, i32* %9
store i32 -1, i32* %6
br label %80
80: ; preds = %104, %79
%81 = load i32, i32* %6
%82 = icmp slt i32 %81, 2
br i1 %82, label %83, label %107
83: ; preds = %80
store i32 -1, i32* %5
br label %84
84: ; preds = %100, %83
%85 = load i32, i32* %5
%86 = icmp slt i32 %85, 2
br i1 %86, label %87, label %103
87: ; preds = %84
%88 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %11, i64 0, i64 0
%89 = bitcast [8 x i32]* %88 to i32**
%90 = load i32, i32* %7
%91 = load i32, i32* %2
%92 = load i32, i32* %5
%93 = add nsw i32 %91, %92
%94 = load i32, i32* %3
%95 = load i32, i32* %6
%96 = add nsw i32 %94, %95
%97 = load i32, i32* %5
%98 = load i32, i32* %6
%99 = call i32 @reverse(i32** %89, i32 %90, i32 %93, i32 %96, i32 %97, i32 %98, i32* %9)
br label %100
100: ; preds = %87
%101 = load i32, i32* %5
%102 = add nsw i32 %101, 1
store i32 %102, i32* %5
br label %84
103: ; preds = %84
br label %104
104: ; preds = %103
%105 = load i32, i32* %6
%106 = add nsw i32 %105, 1
store i32 %106, i32* %6
br label %80
107: ; preds = %80
%108 = load i32, i32* %9
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %107
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%112 = load i32, i32* %4
%113 = add nsw i32 %112, -1
store i32 %113, i32* %4
br label %169
114: ; preds = %107
%115 = load i32, i32* %7
%116 = load i32, i32* %2
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %11, i64 0, i64 %117
%119 = load i32, i32* %3
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [8 x i32], [8 x i32]* %118, i64 0, i64 %120
store i32 %115, i32* %121
%122 = load i32, i32* %7
%123 = add nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = load i32, i32* %9
%128 = add nsw i32 %126, %127
%129 = add nsw i32 %128, 1
%130 = load i32, i32* %7
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %132
store i32 %129, i32* %133
%134 = load i32, i32* %7
%135 = sub nsw i32 0, %134
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %137
%139 = load i32, i32* %138
%140 = load i32, i32* %9
%141 = sub nsw i32 %139, %140
%142 = load i32, i32* %7
%143 = sub nsw i32 0, %142
%144 = add nsw i32 %143, 1
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %145
store i32 %141, i32* %146
%147 = load i32, i32* %7
%148 = add nsw i32 %147, 1
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %149
%151 = load i32, i32* %150
%152 = icmp eq i32 %151, 0
br i1 %152, label %161, label %153
153: ; preds = %114
%154 = load i32, i32* %7
%155 = sub nsw i32 0, %154
%156 = add nsw i32 %155, 1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %157
%159 = load i32, i32* %158
%160 = icmp eq i32 %159, 0
br i1 %160, label %161, label %165
161: ; preds = %153, %114
%162 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %11, i64 0, i64 0
%163 = bitcast [8 x i32]* %162 to i32**
%164 = call i32 @displaymap(i32** %163)
br label %172
165: ; preds = %153
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%167 = load i32, i32* %7
%168 = sub nsw i32 0, %167
store i32 %168, i32* %7
br label %169
169: ; preds = %165, %110, %75, %62
%170 = load i32, i32* %4
%171 = add nsw i32 %170, 1
store i32 %171, i32* %4
br label %22
172: ; preds = %161, %22
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 1
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %175
%177 = load i32, i32* %176
%178 = load i32, i32* %7
%179 = sub nsw i32 0, %178
%180 = add nsw i32 %179, 1
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %181
%183 = load i32, i32* %182
%184 = icmp slt i32 %177, %183
br i1 %184, label %185, label %187
185: ; preds = %172
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %203
187: ; preds = %172
%188 = load i32, i32* %7
%189 = sub nsw i32 0, %188
%190 = add nsw i32 %189, 1
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %191
%193 = load i32, i32* %192
%194 = load i32, i32* %7
%195 = add nsw i32 %194, 1
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 %196
%198 = load i32, i32* %197
%199 = icmp slt i32 %193, %198
br i1 %199, label %200, label %202
200: ; preds = %187
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %202
202: ; preds = %200, %187
br label %203
203: ; preds = %202, %185
ret i32 0
}

LLVM IR (-O2):
@__const.main.q = [3 x i32] [i32 2, i32 0, i32 2]
@__const.main.d = [4 x i8] c"X-0\00"
@.str = [23 x i8] c"turn: %d (O:%d, X:%d)\0A\00"
@.str.2 = [9 x i8] c"%c x y >\00"
@.str.3 = [5 x i8] c"%d%d\00"
@str = [8 x i8] c"WIN : O\00"
@str.7 = [8 x i8] c"WIN : X\00"
@str.10 = [18 x i8] c"Can't put it here\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = alloca [8 x [8 x i32]]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast [3 x i32]* %3 to i8*
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = bitcast [8 x [8 x i32]]* %5 to i8*
%11 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 3, i64 3
store i32 1, i32* %11
%12 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 3, i64 4
store i32 -1, i32* %12
%13 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 4, i64 3
store i32 -1, i32* %13
%14 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 4, i64 4
store i32 1, i32* %14
%15 = bitcast [8 x [8 x i32]]* %5 to i32**
br label %16
16: ; preds = %0, %118
%17 = phi i32 [ 1, %0 ], [ %120, %118 ]
%18 = phi i32 [ 0, %0 ], [ %121, %118 ]
%19 = call i32 @displaymap(i32** %15)
%20 = sub nsw i32 0, %17
%21 = sub i32 1, %17
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %17, 1
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %24, i32 %28)
%30 = call i32 @putchar(i32 10)
%31 = getelementptr inbounds [4 x i8], [4 x i8]* @__const.main.d, i64 0, i64 %26
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%36 = load i32, i32* %1
%37 = icmp slt i32 %36, 0
%38 = load i32, i32* %2
%39 = icmp slt i32 %38, 0
%40 = select i1 %37, i1 true, i1 %39
%41 = icmp sgt i32 %36, 7
%42 = or i1 %41, %40
%43 = icmp sgt i32 %38, 7
%44 = select i1 %42, i1 true, i1 %43
br i1 %44, label %45, label %48
45: ; preds = %16
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%47 = add nsw i32 %18, -1
br label %118
48: ; preds = %16
%49 = zext i32 %36 to i64
%50 = zext i32 %38 to i64
%51 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 %49, i64 %50
%52 = load i32, i32* %51
%53 = icmp eq i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %48
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%56 = add nsw i32 %18, -1
br label %118
57: ; preds = %48
store i32 0, i32* %4
%58 = add nsw i32 %36, -1
%59 = add nsw i32 %38, -1
%60 = call i32 @reverse(i32** %15, i32 %17, i32 %58, i32 %59, i32 -1, i32 -1, i32* %4)
%61 = load i32, i32* %1
%62 = load i32, i32* %2
%63 = add nsw i32 %62, -1
%64 = call i32 @reverse(i32** %15, i32 %17, i32 %61, i32 %63, i32 0, i32 -1, i32* %4)
%65 = load i32, i32* %1
%66 = add nsw i32 %65, 1
%67 = load i32, i32* %2
%68 = add nsw i32 %67, -1
%69 = call i32 @reverse(i32** %15, i32 %17, i32 %66, i32 %68, i32 1, i32 -1, i32* %4)
%70 = load i32, i32* %1
%71 = add nsw i32 %70, -1
%72 = load i32, i32* %2
%73 = call i32 @reverse(i32** %15, i32 %17, i32 %71, i32 %72, i32 -1, i32 0, i32* %4)
%74 = load i32, i32* %1
%75 = load i32, i32* %2
%76 = call i32 @reverse(i32** %15, i32 %17, i32 %74, i32 %75, i32 0, i32 0, i32* %4)
%77 = load i32, i32* %1
%78 = add nsw i32 %77, 1
%79 = load i32, i32* %2
%80 = call i32 @reverse(i32** %15, i32 %17, i32 %78, i32 %79, i32 1, i32 0, i32* %4)
%81 = load i32, i32* %1
%82 = add nsw i32 %81, -1
%83 = load i32, i32* %2
%84 = add nsw i32 %83, 1
%85 = call i32 @reverse(i32** %15, i32 %17, i32 %82, i32 %84, i32 -1, i32 1, i32* %4)
%86 = load i32, i32* %1
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
%89 = call i32 @reverse(i32** %15, i32 %17, i32 %86, i32 %88, i32 0, i32 1, i32* %4)
%90 = load i32, i32* %1
%91 = add nsw i32 %90, 1
%92 = load i32, i32* %2
%93 = add nsw i32 %92, 1
%94 = call i32 @reverse(i32** %15, i32 %17, i32 %91, i32 %93, i32 1, i32 1, i32* %4)
%95 = load i32, i32* %4
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %57
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%99 = add nsw i32 %18, -1
br label %118
100: ; preds = %57
%101 = load i32, i32* %1
%102 = sext i32 %101 to i64
%103 = load i32, i32* %2
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %5, i64 0, i64 %102, i64 %104
store i32 %17, i32* %105
%106 = add i32 %28, 1
%107 = add i32 %106, %95
store i32 %107, i32* %27
%108 = load i32, i32* %23
%109 = sub nsw i32 %108, %95
store i32 %109, i32* %23
%110 = load i32, i32* %27
%111 = icmp eq i32 %110, 0
%112 = icmp eq i32 %109, 0
%113 = select i1 %111, i1 true, i1 %112
br i1 %113, label %114, label %116
114: ; preds = %100
%115 = call i32 @displaymap(i32** %15)
br label %126
116: ; preds = %100
%117 = call i32 @putchar(i32 10)
br label %118
118: ; preds = %116, %97, %54, %45
%119 = phi i32 [ %47, %45 ], [ %56, %54 ], [ %99, %97 ], [ %18, %116 ]
%120 = phi i32 [ %17, %45 ], [ %17, %54 ], [ %17, %97 ], [ %20, %116 ]
%121 = add nsw i32 %119, 1
%122 = icmp slt i32 %119, 59
br i1 %122, label %16, label %123
123: ; preds = %118
%124 = add nsw i32 %120, 1
%125 = sub i32 1, %120
br label %126
126: ; preds = %123, %114
%127 = phi i32 [ %125, %123 ], [ %21, %114 ]
%128 = phi i32 [ %124, %123 ], [ %25, %114 ]
%129 = zext i32 %128 to i64
%130 = zext i32 %127 to i64
%131 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %129
%132 = load i32, i32* %131
%133 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %130
%134 = load i32, i32* %133
%135 = icmp slt i32 %132, %134
br i1 %135, label %138, label %136
136: ; preds = %126
%137 = icmp slt i32 %134, %132
br i1 %137, label %138, label %141
138: ; preds = %136, %126
%139 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0), %126 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), %136 ]
%140 = call i32 @puts(i8* dereferenceable(1) %139)
br label %141
141: ; preds = %138, %136
ret i32 0
}