int main() {
  srand((time(0)));
  int i, j;
  char again[2], winner, **board, agin = 'y';
  board = (char **)malloc(sizeof(char *) * 3);
  for (i = 0; i < 3; i++)
    board[i] = (char *)malloc(sizeof(char) * 3);
  do {
    board = initboard(board);
    char first = 'y';
    printf("Play first? ");
    scanf("%c", &first);
    displayboard(board);
    if (first == 'y') {
      do {
        board = human_move(board, 'x');
        displayboard(board);
        winner = checkwin(board, 'x');
        if (winner != 'x' && winner != ' ') {
          if (computer_move(board, 'o', 'x'))
            winner = checkwin(board, 'o');
          else
            printf("\nComputer passed\n");
          displayboard(board);
        }
      } while (winner == '-');
    } else {
      do {
        if (computer_move(board, 'o', 'x'))
          winner = checkwin(board, 'o');
        else
          printf("\nComputer passed\n");
        displayboard(board);
        if (winner != 'o' && winner != ' ') {
          board = human_move(board, 'x');
          winner = checkwin(board, 'x');
          displayboard(board);
        }
      } while (winner == '-');
    }
    if (winner != ' ')
      printf("THE WINNER IS %c!\n", winner);
    else
      printf("IT'S A TIE.\n");
    printf("\nPlay again (y)?: ");
    scanf("%s", again);
    getchar();
  } while (again[0] == 'y');
  for (i = 0; i < 3; i++)
    free(board[i]);
  free(board);
  printf("\nThank you for playing.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1090 <time@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1070 <srand@plt>
movb   $0x79,-0x19(%rbp)
mov    $0x18,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    122b <main+0x6b>
mov    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11fa <main+0x3a>
jmp    1230 <main+0x70>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10d0 <initboard@plt>
cltq
mov    %rax,-0x18(%rbp)
movb   $0x79,-0x1a(%rbp)
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdb3(%rip),%rdi
lea    -0x1a(%rbp),%rsi
mov    $0x0,%al
call   10c0 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <displayboard@plt>
movsbl -0x1a(%rbp),%eax
cmp    $0x79,%eax
jne    1336 <main+0x176>
jmp    1282 <main+0xc2>
mov    -0x18(%rbp),%rdi
mov    $0x78,%esi
mov    $0x0,%al
call   10b0 <human_move@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <displayboard@plt>
mov    -0x18(%rbp),%rdi
mov    $0x78,%esi
mov    $0x0,%al
call   1040 <checkwin@plt>
mov    %al,-0xf(%rbp)
movsbl -0xf(%rbp),%eax
cmp    $0x78,%eax
je     131f <main+0x15f>
movsbl -0xf(%rbp),%eax
cmp    $0x20,%eax
je     131f <main+0x15f>
mov    -0x18(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x78,%edx
mov    $0x0,%al
call   1060 <computer_move@plt>
cmp    $0x0,%eax
je     1306 <main+0x146>
mov    -0x18(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x0,%al
call   1040 <checkwin@plt>
mov    %al,-0xf(%rbp)
jmp    1314 <main+0x154>
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <displayboard@plt>
jmp    1324 <main+0x164>
movsbl -0xf(%rbp),%eax
cmp    $0x2d,%eax
je     1282 <main+0xc2>
jmp    13ef <main+0x22f>
jmp    133b <main+0x17b>
mov    -0x18(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x78,%edx
mov    $0x0,%al
call   1060 <computer_move@plt>
cmp    $0x0,%eax
je     1371 <main+0x1b1>
mov    -0x18(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x0,%al
call   1040 <checkwin@plt>
mov    %al,-0xf(%rbp)
jmp    137f <main+0x1bf>
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <displayboard@plt>
movsbl -0xf(%rbp),%eax
cmp    $0x6f,%eax
je     13d8 <main+0x218>
movsbl -0xf(%rbp),%eax
cmp    $0x20,%eax
je     13d8 <main+0x218>
mov    -0x18(%rbp),%rdi
mov    $0x78,%esi
mov    $0x0,%al
call   10b0 <human_move@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x78,%esi
mov    $0x0,%al
call   1040 <checkwin@plt>
mov    %al,-0xf(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <displayboard@plt>
jmp    13dd <main+0x21d>
movsbl -0xf(%rbp),%eax
cmp    $0x2d,%eax
je     133b <main+0x17b>
jmp    13ef <main+0x22f>
movsbl -0xf(%rbp),%eax
cmp    $0x20,%eax
je     1413 <main+0x253>
movsbl -0xf(%rbp),%esi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1421 <main+0x261>
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   10c0 <scanf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
movsbl -0xe(%rbp),%eax
cmp    $0x79,%eax
je     1230 <main+0x70>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1485 <main+0x2c5>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    145c <main+0x29c>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   10a0 <time@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1080 <srand@plt>
mov    $0x18,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    $0x3,%edi
call   10b0 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x3,%edi
call   10b0 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x3,%edi
call   10b0 <malloc@plt>
mov    %rax,0x10(%rbx)
lea    0xe34(%rip),%r13
lea    0xdf2(%rip),%rbp
lea    0xdfe(%rip),%r14
lea    0x6(%rsp),%r15
jmp    1275 <main+0xa5>
nop
lea    0xdf2(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10d0 <scanf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
cmpb   $0x79,0x6(%rsp)
jne    1421 <main+0x251>
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <initboard@plt>
movslq %eax,%rbx
movb   $0x79,0x5(%rsp)
lea    0xd72(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd71(%rip),%rdi
lea    0x5(%rsp),%rsi
xor    %eax,%eax
call   10d0 <scanf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
cmpb   $0x79,0x5(%rsp)
je     12fe <main+0x12e>
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    $0x78,%edx
xor    %eax,%eax
call   1070 <computer_move@plt>
test   %eax,%eax
jne    1370 <main+0x1a0>
mov    %r13,%rdi
call   1040 <puts@plt>
jmp    1382 <main+0x1b2>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
cmp    $0x2d,%r12b
jne    1400 <main+0x230>
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   10c0 <human_move@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   1050 <checkwin@plt>
mov    %eax,%r12d
shl    $0x18,%eax
cmp    $0x20000000,%eax
je     12f4 <main+0x124>
cmp    $0x78000000,%eax
je     12f4 <main+0x124>
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    $0x78,%edx
xor    %eax,%eax
call   1070 <computer_move@plt>
test   %eax,%eax
je     12e2 <main+0x112>
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1050 <checkwin@plt>
mov    %eax,%r12d
jmp    12ea <main+0x11a>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1050 <checkwin@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
cmp    $0x20,%r12b
je     13c6 <main+0x1f6>
cmp    $0x6f,%r12b
je     13c6 <main+0x1f6>
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   10c0 <human_move@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   1050 <checkwin@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
cmp    $0x2d,%r12b
jne    1400 <main+0x230>
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    $0x78,%edx
xor    %eax,%eax
call   1070 <computer_move@plt>
test   %eax,%eax
jne    1370 <main+0x1a0>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <displayboard@plt>
jmp    1398 <main+0x1c8>
nopl   0x0(%rax,%rax,1)
cmp    $0x20,%r12b
je     1240 <main+0x70>
movsbl %r12b,%esi
lea    0xbfb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    124c <main+0x7c>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
call   1030 <free@plt>
mov    0x10(%rbx),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xbfb(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Play first? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [18 x i8] c"\0AComputer passed\0A\00"
@.str.3 = [19 x i8] c"THE WINNER IS %c!\0A\00"
@.str.4 = [13 x i8] c"IT'S A TIE.\0A\00"
@.str.5 = [19 x i8] c"\0APlay again (y)?: \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [26 x i8] c"\0AThank you for playing.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x i8]
%5 = alloca i8
%6 = alloca i8**
%7 = alloca i8
%8 = alloca i8
store i32 0, i32* %1
%9 = call i32 (i32, ...) bitcast (i32 (...)* @time to i32 (i32, ...)*)(i32 0)
%10 = call i32 (i32, ...) bitcast (i32 (...)* @srand to i32 (i32, ...)*)(i32 %9)
store i8 121, i8* %7
%11 = call i8* @malloc(i64 24)
%12 = bitcast i8* %11 to i8**
store i8** %12, i8*** %6
store i32 0, i32* %2
br label %13
13: ; preds = %22, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = call i8* @malloc(i64 3)
%18 = load i8**, i8*** %6
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
store i8* %17, i8** %21
br label %22
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %13
25: ; preds = %13
br label %26
26: ; preds = %127, %25
%27 = load i8**, i8*** %6
%28 = call i32 (i8**, ...) bitcast (i32 (...)* @initboard to i32 (i8**, ...)*)(i8** %27)
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i8**
store i8** %30, i8*** %6
store i8 121, i8* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%33 = load i8**, i8*** %6
%34 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %33)
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 121
br i1 %37, label %38, label %75
38: ; preds = %26
br label %39
39: ; preds = %70, %38
%40 = load i8**, i8*** %6
%41 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @human_move to i32 (i8**, i32, ...)*)(i8** %40, i32 120)
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i8**
store i8** %43, i8*** %6
%44 = load i8**, i8*** %6
%45 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %44)
%46 = load i8**, i8*** %6
%47 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %46, i32 120)
%48 = trunc i32 %47 to i8
store i8 %48, i8* %5
%49 = load i8, i8* %5
%50 = sext i8 %49 to i32
%51 = icmp ne i32 %50, 120
br i1 %51, label %52, label %69
52: ; preds = %39
%53 = load i8, i8* %5
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 32
br i1 %55, label %56, label %69
56: ; preds = %52
%57 = load i8**, i8*** %6
%58 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @computer_move to i32 (i8**, i32, i32, ...)*)(i8** %57, i32 111, i32 120)
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i8**, i8*** %6
%62 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %61, i32 111)
%63 = trunc i32 %62 to i8
store i8 %63, i8* %5
br label %66
64: ; preds = %56
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64, %60
%67 = load i8**, i8*** %6
%68 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %67)
br label %69
69: ; preds = %66, %52, %39
br label %70
70: ; preds = %69
%71 = load i8, i8* %5
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 45
br i1 %73, label %39, label %74
74: ; preds = %70
br label %112
75: ; preds = %26
br label %76
76: ; preds = %107, %75
%77 = load i8**, i8*** %6
%78 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @computer_move to i32 (i8**, i32, i32, ...)*)(i8** %77, i32 111, i32 120)
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %84
80: ; preds = %76
%81 = load i8**, i8*** %6
%82 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %81, i32 111)
%83 = trunc i32 %82 to i8
store i8 %83, i8* %5
br label %86
84: ; preds = %76
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %86
86: ; preds = %84, %80
%87 = load i8**, i8*** %6
%88 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %87)
%89 = load i8, i8* %5
%90 = sext i8 %89 to i32
%91 = icmp ne i32 %90, 111
br i1 %91, label %92, label %106
92: ; preds = %86
%93 = load i8, i8* %5
%94 = sext i8 %93 to i32
%95 = icmp ne i32 %94, 32
br i1 %95, label %96, label %106
96: ; preds = %92
%97 = load i8**, i8*** %6
%98 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @human_move to i32 (i8**, i32, ...)*)(i8** %97, i32 120)
%99 = sext i32 %98 to i64
%100 = inttoptr i64 %99 to i8**
store i8** %100, i8*** %6
%101 = load i8**, i8*** %6
%102 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %101, i32 120)
%103 = trunc i32 %102 to i8
store i8 %103, i8* %5
%104 = load i8**, i8*** %6
%105 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %104)
br label %106
106: ; preds = %96, %92, %86
br label %107
107: ; preds = %106
%108 = load i8, i8* %5
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 45
br i1 %110, label %76, label %111
111: ; preds = %107
br label %112
112: ; preds = %111, %74
%113 = load i8, i8* %5
%114 = sext i8 %113 to i32
%115 = icmp ne i32 %114, 32
br i1 %115, label %116, label %120
116: ; preds = %112
%117 = load i8, i8* %5
%118 = sext i8 %117 to i32
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %118)
br label %122
120: ; preds = %112
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %122
122: ; preds = %120, %116
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%124 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%125 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %124)
%126 = call i32 (...) @getchar()
br label %127
127: ; preds = %122
%128 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 121
br i1 %131, label %26, label %132
132: ; preds = %127
store i32 0, i32* %2
br label %133
133: ; preds = %142, %132
%134 = load i32, i32* %2
%135 = icmp slt i32 %134, 3
br i1 %135, label %136, label %145
136: ; preds = %133
%137 = load i8**, i8*** %6
%138 = load i32, i32* %2
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8*, i8** %137, i64 %139
%141 = load i8*, i8** %140
br label %142
142: ; preds = %136
%143 = load i32, i32* %2
%144 = add nsw i32 %143, 1
store i32 %144, i32* %2
br label %133
145: ; preds = %133
%146 = load i8**, i8*** %6
%147 = bitcast i8** %146 to i8*
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Play first? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.3 = [19 x i8] c"THE WINNER IS %c!\0A\00"
@.str.5 = [19 x i8] c"\0APlay again (y)?: \00"
@.str.6 = [3 x i8] c"%s\00"
@str.8 = [12 x i8] c"IT'S A TIE.\00"
@str.9 = [25 x i8] c"\0AThank you for playing.\0A\00"
@str.10 = [17 x i8] c"\0AComputer passed\00"
define i32 @main() {
%1 = alloca [2 x i8]
%2 = alloca i8
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @time to i32 (i32, ...)*)(i32 0)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @srand to i32 (i32, ...)*)(i32 %3)
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%6 = tail call dereferenceable_or_null(24) i8* @malloc(i64 24)
%7 = bitcast i8* %6 to i8**
%8 = tail call dereferenceable_or_null(3) i8* @malloc(i64 3)
store i8* %8, i8** %7
%9 = tail call dereferenceable_or_null(3) i8* @malloc(i64 3)
%10 = getelementptr inbounds i8*, i8** %7, i64 1
store i8* %9, i8** %10
%11 = tail call dereferenceable_or_null(3) i8* @malloc(i64 3)
%12 = getelementptr inbounds i8*, i8** %7, i64 2
store i8* %11, i8** %12
br label %13
13: ; preds = %0, %102
%14 = phi i8 [ %94, %102 ], [ undef, %0 ]
%15 = phi i8** [ %95, %102 ], [ %7, %0 ]
%16 = call i32 (i8**, ...) bitcast (i32 (...)* @initboard to i32 (i8**, ...)*)(i8** %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8**
store i8 121, i8* %2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%21 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %18)
%22 = load i8, i8* %2
%23 = icmp eq i8 %22, 121
br i1 %23, label %46, label %24
24: ; preds = %13
%25 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @computer_move to i32 (i8**, i32, i32, ...)*)(i8** %18, i32 111, i32 120)
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %18, i32 111)
%29 = trunc i32 %28 to i8
br label %32
30: ; preds = %24
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = phi i8 [ %29, %27 ], [ %14, %30 ]
%34 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %18)
switch i8 %33, label %35 [
i8 111, label %42
i8 32, label %42
]
35: ; preds = %32
%36 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @human_move to i32 (i8**, i32, ...)*)(i8** %18, i32 120)
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i8**
%39 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %38, i32 120)
%40 = trunc i32 %39 to i8
%41 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %38)
br label %42
42: ; preds = %35, %32, %32
%43 = phi i8 [ %40, %35 ], [ %33, %32 ], [ %33, %32 ]
%44 = phi i8** [ %38, %35 ], [ %18, %32 ], [ %18, %32 ]
%45 = icmp eq i8 %43, 45
br i1 %45, label %69, label %93
46: ; preds = %13, %66
%47 = phi i8** [ %50, %66 ], [ %18, %13 ]
%48 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @human_move to i32 (i8**, i32, ...)*)(i8** %47, i32 120)
%49 = sext i32 %48 to i64
%50 = inttoptr i64 %49 to i8**
%51 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %50)
%52 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %50, i32 120)
%53 = trunc i32 %52 to i8
%54 = shl i32 %52, 24
switch i32 %54, label %55 [
i32 2013265920, label %66
i32 536870912, label %66
]
55: ; preds = %46
%56 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @computer_move to i32 (i8**, i32, i32, ...)*)(i8** %50, i32 111, i32 120)
%57 = icmp eq i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %50, i32 111)
%60 = trunc i32 %59 to i8
br label %63
61: ; preds = %55
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
%64 = phi i8 [ %60, %58 ], [ %53, %61 ]
%65 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %50)
br label %66
66: ; preds = %46, %46, %63
%67 = phi i8 [ %64, %63 ], [ %53, %46 ], [ %53, %46 ]
%68 = icmp eq i8 %67, 45
br i1 %68, label %46, label %91
69: ; preds = %42, %87
%70 = phi i8** [ %89, %87 ], [ %44, %42 ]
%71 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @computer_move to i32 (i8**, i32, i32, ...)*)(i8** %70, i32 111, i32 120)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
%75 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %70)
br label %80
76: ; preds = %69
%77 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %70, i32 111)
%78 = trunc i32 %77 to i8
%79 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %70)
switch i8 %78, label %80 [
i8 111, label %87
i8 32, label %87
]
80: ; preds = %73, %76
%81 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @human_move to i32 (i8**, i32, ...)*)(i8** %70, i32 120)
%82 = sext i32 %81 to i64
%83 = inttoptr i64 %82 to i8**
%84 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @checkwin to i32 (i8**, i32, ...)*)(i8** %83, i32 120)
%85 = trunc i32 %84 to i8
%86 = call i32 (i8**, ...) bitcast (i32 (...)* @displayboard to i32 (i8**, ...)*)(i8** %83)
br label %87
87: ; preds = %76, %76, %80
%88 = phi i8 [ %85, %80 ], [ %78, %76 ], [ %78, %76 ]
%89 = phi i8** [ %83, %80 ], [ %70, %76 ], [ %70, %76 ]
%90 = icmp eq i8 %88, 45
br i1 %90, label %69, label %93
91: ; preds = %66
%92 = inttoptr i64 %49 to i8**
br label %93
93: ; preds = %87, %91, %42
%94 = phi i8 [ %43, %42 ], [ %67, %91 ], [ %88, %87 ]
%95 = phi i8** [ %44, %42 ], [ %92, %91 ], [ %89, %87 ]
%96 = icmp eq i8 %94, 32
br i1 %96, label %100, label %97
97: ; preds = %93
%98 = sext i8 %94 to i32
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %98)
br label %102
100: ; preds = %93
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
br label %102
102: ; preds = %100, %97
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%104 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %5)
%105 = call i32 (...) @getchar()
%106 = load i8, i8* %5
%107 = icmp eq i8 %106, 121
br i1 %107, label %13, label %108
108: ; preds = %102
%109 = load i8*, i8** %95
%110 = getelementptr inbounds i8*, i8** %95, i64 1
%111 = load i8*, i8** %110
%112 = getelementptr inbounds i8*, i8** %95, i64 2
%113 = load i8*, i8** %112
%114 = bitcast i8** %95 to i8*
%115 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}