#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*/ display(char **);
int /*<<< orphan*/ exit(int);
int find_move(char **, char, int);
int /*<<< orphan*/ help();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
scalar_t__ win(char **);
int main() {
  char mat[3][4] = {
      {'_', '_', '_', '\0'}, {'_', '_', '_', '\0'}, {'_', '_', '_', '\0'}};
  int ch, i, r, c;
  char player, bot;
  help();
  printf("Choose: X or O(alphabet O) \n1.X\n2.O\n");
  scanf("%d", &ch);
  if (ch == 1) {
    player = 'X';
    bot = 'O';
  } else if (ch == 2) {
    bot = 'X';
    player = 'O';
  } else {
    printf("Invalid Choice....");
    exit(1);
  }
  for (i = 1; i <= 5; ++i) {
    printf("Player Move: \n");
    scanf("%d %d", &r, &c);
    r -= 1;
    c -= 1;
    if (!(r >= 0 && r < 3 && c >= 0 && c < 3 && mat[r][c] == '_')) {
      printf("Either Invalid Move Or Block Already Filled (Input Format must "
             "be RowIndex ColIndex)  \n\n\n");
      i -= 1;
      continue;
    }
    mat[r][c] = player;
    if (win(mat)) {
      display(mat);
      printf("Player won");
      exit(0);
    }
    int bot_move = find_move(mat, bot, 1);
    if (bot_move != -1) {
      int x = bot_move;
      mat[x / 10][x % 10] = bot;
      if (win(mat)) {
        printf("Bot Move %d %d\n", x / 10 + 1, x % 10 + 1);
        display(mat);
        printf("\n\nBot Won");
        exit(0);
      } else
        mat[x / 10][x % 10] = '_';
    }
    int x = find_move(mat, player, 0);
    if (x == -1) {
      break;
    }
    printf("Bot Move: %d %d\n", x / 10 + 1, x % 10 + 1);
    mat[x / 10][x % 10] = bot;
    display(mat);
    if (win(mat)) {
      printf("Bot won\n");
      exit(0);
    }
  }
  printf("\n\n....DRAW......\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe78(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <help@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11d1 <main+0x61>
movb   $0x58,-0x21(%rbp)
movb   $0x4f,-0x22(%rbp)
jmp    1205 <main+0x95>
cmpl   $0x2,-0x14(%rbp)
jne    11e8 <main+0x78>
movb   $0x58,-0x22(%rbp)
movb   $0x4f,-0x21(%rbp)
jmp    1200 <main+0x90>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1205 <main+0x95>
movl   $0x1,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jg     14bf <main+0x34f>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe28(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1294 <main+0x124>
cmpl   $0x3,-0x1c(%rbp)
jge    1294 <main+0x124>
cmpl   $0x0,-0x20(%rbp)
jl     1294 <main+0x124>
cmpl   $0x3,-0x20(%rbp)
jge    1294 <main+0x124>
movslq -0x1c(%rbp),%rcx
lea    -0x10(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
je     12b0 <main+0x140>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14b1 <main+0x341>
mov    -0x21(%rbp),%dl
movslq -0x1c(%rbp),%rcx
lea    -0x10(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
lea    -0x10(%rbp),%rdi
call   1050 <win@plt>
cmp    $0x0,%rax
je     12fa <main+0x18a>
lea    -0x10(%rbp),%rdi
call   1030 <display@plt>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%edx
movsbl -0x22(%rbp),%esi
call   1070 <find_move@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
je     13f1 <main+0x281>
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x31(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x10(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%rax
mov    %edx,%ecx
mov    -0x31(%rbp),%dl
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
lea    -0x10(%rbp),%rdi
call   1050 <win@plt>
cmp    $0x0,%rax
je     13b9 <main+0x249>
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <display@plt>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x10(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%rax
movslq %edx,%rcx
movb   $0x5f,(%rax,%rcx,1)
jmp    13f1 <main+0x281>
lea    -0x10(%rbp),%rdi
xor    %edx,%edx
movsbl -0x21(%rbp),%esi
call   1070 <find_move@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    1412 <main+0x2a2>
jmp    14bf <main+0x34f>
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x22(%rbp),%al
mov    %al,-0x49(%rbp)
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x10(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x58(%rbp),%rax
mov    %edx,%ecx
mov    -0x49(%rbp),%dl
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
lea    -0x10(%rbp),%rdi
call   1030 <display@plt>
lea    -0x10(%rbp),%rdi
call   1050 <win@plt>
cmp    $0x0,%rax
je     14ac <main+0x33c>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    14b1 <main+0x341>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    120c <main+0x9c>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0xe74(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xe61(%rip),%rax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
call   1090 <help@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe64(%rip),%rdi
lea    0x24(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x24(%rsp),%eax
cmp    $0x1,%eax
je     11e6 <main+0x66>
cmp    $0x2,%eax
jne    1435 <main+0x2b5>
mov    $0x4f,%r14b
movb   $0x58,0x2(%rsp)
jmp    11ee <main+0x6e>
mov    $0x58,%r14b
movb   $0x4f,0x2(%rsp)
mov    $0x1,%r15d
lea    0xe95(%rip),%r13
lea    0xe1d(%rip),%rbx
lea    0x4(%rsp),%rbp
movzbl 0x2(%rsp),%eax
mov    %eax,0x20(%rsp)
movzbl %r14b,%eax
mov    %eax,0x1c(%rsp)
mov    %r14b,0x3(%rsp)
jmp    1241 <main+0xc1>
nop
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
add    $0xffffffff,%r15d
lea    0x1(%r15),%eax
cmp    $0x5,%r15d
mov    %eax,%r15d
jge    13cc <main+0x24c>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
mov    0x18(%rsp),%edx
lea    -0x1(%rdx),%ecx
mov    %ecx,0x18(%rsp)
cmp    $0x2,%eax
ja     1220 <main+0xa0>
test   %edx,%edx
jle    1220 <main+0xa0>
cmp    $0x3,%edx
jg     1220 <main+0xa0>
mov    %eax,%edx
mov    %ecx,%eax
lea    (%rsp,%rdx,4),%rcx
add    $0x8,%rcx
cmpb   $0x5f,(%rax,%rcx,1)
jne    1220 <main+0xa0>
add    %rax,%rcx
mov    %r14b,(%rcx)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <win@plt>
test   %rax,%rax
jne    13e9 <main+0x269>
mov    %rbx,%rdi
mov    0x20(%rsp),%esi
mov    $0x1,%edx
call   1080 <find_move@plt>
cmp    $0xffffffff,%eax
je     1327 <main+0x1a7>
mov    %eax,%ebp
cltq
imul   $0x66666667,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x22,%r14
add    %eax,%r14d
movslq %r14d,%rax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebp
movslq %ebp,%r13
movzbl 0x2(%rsp),%ecx
lea    (%rsp,%rax,4),%r12
add    $0x8,%r12
mov    %cl,0x0(%r13,%r12,1)
mov    %rbx,%rdi
call   1060 <win@plt>
test   %rax,%rax
jne    13fc <main+0x27c>
add    %r13,%r12
movb   $0x5f,(%r12)
movzbl 0x3(%rsp),%r14d
lea    0xd6e(%rip),%r13
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    0x1c(%rsp),%esi
xor    %edx,%edx
call   1080 <find_move@plt>
cmp    $0xffffffff,%eax
je     13cc <main+0x24c>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rbp
mov    %rbp,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbp
lea    (%rcx,%rbp,1),%esi
add    $0x1,%esi
add    %ecx,%ebp
lea    0x0(%rbp,%rbp,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebx
sub    %ecx,%ebx
neg    %ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
lea    0xcd5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq %ebp,%rax
lea    0x4(%rsp),%rbp
movslq %ebx,%rcx
lea    0xc91(%rip),%rbx
lea    0x8(%rsp,%rax,4),%rax
movzbl 0x2(%rsp),%edx
mov    %dl,(%rcx,%rax,1)
lea    0x8(%rsp),%r12
mov    %r12,%rdi
call   1040 <display@plt>
mov    %r12,%rdi
call   1060 <win@plt>
test   %rax,%rax
je     1230 <main+0xb0>
lea    0xd37(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xcac(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8(%rsp),%rdi
call   1040 <display@plt>
lea    0xc2b(%rip),%rdi
jmp    1427 <main+0x2a7>
add    $0x1,%r14d
add    $0x1,%ebp
lea    0xc26(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rdi
call   1040 <display@plt>
lea    0xc19(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xbd0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@__const.main.mat = [3 x [4 x i8]] [[4 x i8] c"___\00", [4 x i8] c"___\00", [4 x i8] c"___\00"]
@.str = [37 x i8] c"Choose: X or O(alphabet O) \0A1.X\0A2.O\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Invalid Choice....\00"
@.str.3 = [15 x i8] c"Player Move: \0A\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [90 x i8] c"Either Invalid Move Or Block Already Filled (Input Format must be RowIndex ColIndex) \0A\0A\0A\00"
@.str.6 = [11 x i8] c"Player won\00"
@.str.7 = [16 x i8] c"Bot Move %d %d\0A\00"
@.str.8 = [10 x i8] c"\0A\0ABot Won\00"
@.str.9 = [17 x i8] c"Bot Move: %d %d\0A\00"
@.str.10 = [9 x i8] c"Bot won\0A\00"
@.str.11 = [18 x i8] c"\0A\0A....DRAW......\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x i8]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = bitcast [3 x [4 x i8]]* %2 to i8*
%13 = call i32 (...) @help()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %0
store i8 88, i8* %7
store i8 79, i8* %8
br label %27
19: ; preds = %0
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %23
22: ; preds = %19
store i8 88, i8* %8
store i8 79, i8* %7
br label %26
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %22
br label %27
27: ; preds = %26, %18
store i32 1, i32* %4
br label %28
28: ; preds = %162, %27
%29 = load i32, i32* %4
%30 = icmp sle i32 %29, 5
br i1 %30, label %31, label %165
31: ; preds = %28
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %5, i32* %6)
%34 = load i32, i32* %5
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %5
%36 = load i32, i32* %6
%37 = sub nsw i32 %36, 1
store i32 %37, i32* %6
%38 = load i32, i32* %5
%39 = icmp sge i32 %38, 0
br i1 %39, label %40, label %59
40: ; preds = %31
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 3
br i1 %42, label %43, label %59
43: ; preds = %40
%44 = load i32, i32* %6
%45 = icmp sge i32 %44, 0
br i1 %45, label %46, label %59
46: ; preds = %43
%47 = load i32, i32* %6
%48 = icmp slt i32 %47, 3
br i1 %48, label %49, label %59
49: ; preds = %46
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 %51
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x i8], [4 x i8]* %52, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 95
br i1 %58, label %63, label %59
59: ; preds = %49, %46, %43, %40, %31
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.5, i64 0, i64 0))
%61 = load i32, i32* %4
%62 = sub nsw i32 %61, 1
store i32 %62, i32* %4
br label %162
63: ; preds = %49
%64 = load i8, i8* %7
%65 = load i32, i32* %5
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 %66
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [4 x i8], [4 x i8]* %67, i64 0, i64 %69
store i8 %64, i8* %70
%71 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%72 = bitcast [4 x i8]* %71 to i8**
%73 = call i64 @win(i8** %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %63
%76 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%77 = bitcast [4 x i8]* %76 to i8**
%78 = call i32 @display(i8** %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%80 = call i32 @exit(i32 0)
unreachable
81: ; preds = %63
%82 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%83 = bitcast [4 x i8]* %82 to i8**
%84 = load i8, i8* %8
%85 = call i32 @find_move(i8** %83, i8 signext %84, i32 1)
store i32 %85, i32* %9
%86 = load i32, i32* %9
%87 = icmp ne i32 %86, -1
br i1 %87, label %88, label %126
88: ; preds = %81
%89 = load i32, i32* %9
store i32 %89, i32* %10
%90 = load i8, i8* %8
%91 = load i32, i32* %10
%92 = sdiv i32 %91, 10
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 %93
%95 = load i32, i32* %10
%96 = srem i32 %95, 10
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [4 x i8], [4 x i8]* %94, i64 0, i64 %97
store i8 %90, i8* %98
%99 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%100 = bitcast [4 x i8]* %99 to i8**
%101 = call i64 @win(i8** %100)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %116
103: ; preds = %88
%104 = load i32, i32* %10
%105 = sdiv i32 %104, 10
%106 = add nsw i32 %105, 1
%107 = load i32, i32* %10
%108 = srem i32 %107, 10
%109 = add nsw i32 %108, 1
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %106, i32 %109)
%111 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%112 = bitcast [4 x i8]* %111 to i8**
%113 = call i32 @display(i8** %112)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%115 = call i32 @exit(i32 0)
unreachable
116: ; preds = %88
%117 = load i32, i32* %10
%118 = sdiv i32 %117, 10
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 %119
%121 = load i32, i32* %10
%122 = srem i32 %121, 10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [4 x i8], [4 x i8]* %120, i64 0, i64 %123
store i8 95, i8* %124
br label %125
125: ; preds = %116
br label %126
126: ; preds = %125, %81
%127 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%128 = bitcast [4 x i8]* %127 to i8**
%129 = load i8, i8* %7
%130 = call i32 @find_move(i8** %128, i8 signext %129, i32 0)
store i32 %130, i32* %11
%131 = load i32, i32* %11
%132 = icmp eq i32 %131, -1
br i1 %132, label %133, label %134
133: ; preds = %126
br label %165
134: ; preds = %126
%135 = load i32, i32* %11
%136 = sdiv i32 %135, 10
%137 = add nsw i32 %136, 1
%138 = load i32, i32* %11
%139 = srem i32 %138, 10
%140 = add nsw i32 %139, 1
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %137, i32 %140)
%142 = load i8, i8* %8
%143 = load i32, i32* %11
%144 = sdiv i32 %143, 10
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 %145
%147 = load i32, i32* %11
%148 = srem i32 %147, 10
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [4 x i8], [4 x i8]* %146, i64 0, i64 %149
store i8 %142, i8* %150
%151 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%152 = bitcast [4 x i8]* %151 to i8**
%153 = call i32 @display(i8** %152)
%154 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %2, i64 0, i64 0
%155 = bitcast [4 x i8]* %154 to i8**
%156 = call i64 @win(i8** %155)
%157 = icmp ne i64 %156, 0
br i1 %157, label %158, label %161
158: ; preds = %134
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%160 = call i32 @exit(i32 0)
unreachable
161: ; preds = %134
br label %162
162: ; preds = %161, %59
%163 = load i32, i32* %4
%164 = add nsw i32 %163, 1
store i32 %164, i32* %4
br label %28
165: ; preds = %133, %28
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.mat = [3 x [4 x i8]] [[4 x i8] c"___\00", [4 x i8] c"___\00", [4 x i8] c"___\00"]
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Invalid Choice....\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.6 = [11 x i8] c"Player won\00"
@.str.7 = [16 x i8] c"Bot Move %d %d\0A\00"
@.str.8 = [10 x i8] c"\0A\0ABot Won\00"
@.str.9 = [17 x i8] c"Bot Move: %d %d\0A\00"
@str = [36 x i8] c"Choose: X or O(alphabet O) \0A1.X\0A2.O\00"
@str.12 = [17 x i8] c"\0A\0A....DRAW......\00"
@str.13 = [14 x i8] c"Player Move: \00"
@str.14 = [89 x i8] c"Either Invalid Move Or Block Already Filled (Input Format must be RowIndex ColIndex) \0A\0A\00"
@str.15 = [8 x i8] c"Bot won\00"
define i32 @main() {
%1 = alloca [3 x [4 x i8]]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %1, i64 0, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (...) @help()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
switch i32 %12, label %14 [
i32 1, label %17
i32 2, label %13
]
13: ; preds = %0
br label %17
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0, %13
%18 = phi i8 [ 88, %13 ], [ 79, %0 ]
%19 = phi i8 [ 79, %13 ], [ 88, %0 ]
%20 = bitcast [3 x [4 x i8]]* %1 to i8**
br label %21
21: ; preds = %17, %87
%22 = phi i32 [ 1, %17 ], [ %89, %87 ]
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.13, i64 0, i64 0))
%24 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %4)
%25 = load i32, i32* %3
%26 = add i32 %25, -1
store i32 %26, i32* %3
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
%29 = icmp ult i32 %26, 3
%30 = icmp sgt i32 %27, 0
%31 = select i1 %29, i1 %30, i1 false
%32 = icmp slt i32 %27, 4
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %34, label %40
34: ; preds = %21
%35 = zext i32 %26 to i64
%36 = zext i32 %28 to i64
%37 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %1, i64 0, i64 %35, i64 %36
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 95
br i1 %39, label %43, label %40
40: ; preds = %34, %21
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @str.14, i64 0, i64 0))
%42 = add nsw i32 %22, -1
br label %87
43: ; preds = %34
store i8 %19, i8* %37
%44 = call i64 @win(i8** %20)
%45 = icmp eq i64 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %43
%47 = call i32 @display(i8** %20)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%49 = call i32 @exit(i32 0)
unreachable
50: ; preds = %43
%51 = call i32 @find_move(i8** %20, i8 signext %18, i32 1)
%52 = icmp eq i32 %51, -1
br i1 %52, label %69, label %53
53: ; preds = %50
%54 = sdiv i32 %51, 10
%55 = sext i32 %54 to i64
%56 = srem i32 %51, 10
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %1, i64 0, i64 %55, i64 %57
store i8 %18, i8* %58
%59 = call i64 @win(i8** %20)
%60 = icmp eq i64 %59, 0
br i1 %60, label %68, label %61
61: ; preds = %53
%62 = add nsw i32 %54, 1
%63 = add nsw i32 %56, 1
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %62, i32 %63)
%65 = call i32 @display(i8** %20)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%67 = call i32 @exit(i32 0)
unreachable
68: ; preds = %53
store i8 95, i8* %58
br label %69
69: ; preds = %68, %50
%70 = call i32 @find_move(i8** %20, i8 signext %19, i32 0)
%71 = icmp eq i32 %70, -1
br i1 %71, label %91, label %72
72: ; preds = %69
%73 = sdiv i32 %70, 10
%74 = add nsw i32 %73, 1
%75 = srem i32 %70, 10
%76 = add nsw i32 %75, 1
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %74, i32 %76)
%78 = sext i32 %73 to i64
%79 = sext i32 %75 to i64
%80 = getelementptr inbounds [3 x [4 x i8]], [3 x [4 x i8]]* %1, i64 0, i64 %78, i64 %79
store i8 %18, i8* %80
%81 = call i32 @display(i8** %20)
%82 = call i64 @win(i8** %20)
%83 = icmp eq i64 %82, 0
br i1 %83, label %87, label %84
84: ; preds = %72
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
%86 = call i32 @exit(i32 0)
unreachable
87: ; preds = %72, %40
%88 = phi i32 [ %42, %40 ], [ %22, %72 ]
%89 = add nsw i32 %88, 1
%90 = icmp slt i32 %88, 5
br i1 %90, label %21, label %91
91: ; preds = %69, %87
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
ret i32 0
}