#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 */
typedef int int32_t;

/* Variables and functions */
scalar_t__ getCell(int, int, int);
int getchar();
int pow(int, int);
int /*<<< orphan*/ putchar(int);
int32_t play(int32_t player, int32_t tab) {
  putchar('T');
  putchar('o');
  putchar('u');
  putchar('r');
  putchar(' ');
  putchar('d');
  putchar('u');
  putchar(' ');
  putchar('j');
  putchar('o');
  putchar('u');
  putchar('e');
  putchar('u');
  putchar('r');
  putchar(' ');
  if (player == 1)
    putchar('1');
  else
    putchar('2');
  putchar(10);
  putchar('L');
  putchar('i');
  putchar('g');
  putchar('n');
  putchar('e');
  putchar(':');
  putchar(10);
  int32_t cellRow = getchar();
  int32_t unused = getchar();
  putchar('C');
  putchar('o');
  putchar('l');
  putchar('o');
  putchar('n');
  putchar('n');
  putchar('e');
  putchar(':');
  putchar(10);
  int32_t cellCol = getchar();
  unused = getchar();
  while (getCell(tab, cellRow, cellCol) != 0) {
    putchar('C');
    putchar('o');
    putchar('u');
    putchar('p');
    putchar('s');
    putchar(' ');
    putchar('i');
    putchar('n');
    putchar('v');
    putchar('a');
    putchar('l');
    putchar('i');
    putchar('d');
    putchar(':');
    putchar(10);
    putchar('L');
    putchar('i');
    putchar('g');
    putchar('n');
    putchar('e');
    putchar(':');
    putchar(10);
    cellRow = getchar();
    unused = getchar();
    putchar('C');
    putchar('o');
    putchar('l');
    putchar('o');
    putchar('n');
    putchar('n');
    putchar('e');
    putchar(':');
    putchar(10);
    cellCol = getchar();
    unused = getchar();
  }
  int32_t index = cellRow * 3 + cellCol;
  tab += pow(3, index) * player;
}


x86 assembly (clang, -O0):
<play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x54,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x6a,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11fd <play+0xbd>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1207 <play+0xc7>
mov    $0x32,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    $0x43,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <getCell@plt>
cmp    $0x0,%rax
je     1454 <play+0x314>
mov    $0x43,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x70,%edi
call   1030 <putchar@plt>
mov    $0x73,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x76,%edi
call   1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    $0x43,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
jmp    12d9 <play+0x199>
imul   $0x3,-0x10(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x3,%edi
call   1050 <pow@plt>
imul   -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<play>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x54,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x6a,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
cmp    $0x1,%ebx
sete   %al
mov    $0x32,%edi
sub    %eax,%edi
xchg   %ax,%ax
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x67,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x43,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r14d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
call   1060 <getCell@plt>
test   %rax,%rax
je     1360 <play+0x220>
mov    $0x43,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x75,%edi
call   1030 <putchar@plt>
mov    $0x70,%edi
call   1030 <putchar@plt>
mov    $0x73,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    $0x76,%edi
call   1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x69,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
jmp    11f0 <play+0xb0>
lea    (%rbx,%rbx,2),%esi
add    %ebp,%esi
mov    $0x3,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <pow@plt>

LLVM IR (-O0):
define i32 @play(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%10 = call i32 @putchar(i32 84)
%11 = call i32 @putchar(i32 111)
%12 = call i32 @putchar(i32 117)
%13 = call i32 @putchar(i32 114)
%14 = call i32 @putchar(i32 32)
%15 = call i32 @putchar(i32 100)
%16 = call i32 @putchar(i32 117)
%17 = call i32 @putchar(i32 32)
%18 = call i32 @putchar(i32 106)
%19 = call i32 @putchar(i32 111)
%20 = call i32 @putchar(i32 117)
%21 = call i32 @putchar(i32 101)
%22 = call i32 @putchar(i32 117)
%23 = call i32 @putchar(i32 114)
%24 = call i32 @putchar(i32 32)
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %29
27: ; preds = %2
%28 = call i32 @putchar(i32 49)
br label %31
29: ; preds = %2
%30 = call i32 @putchar(i32 50)
br label %31
31: ; preds = %29, %27
%32 = call i32 @putchar(i32 10)
%33 = call i32 @putchar(i32 76)
%34 = call i32 @putchar(i32 105)
%35 = call i32 @putchar(i32 103)
%36 = call i32 @putchar(i32 110)
%37 = call i32 @putchar(i32 101)
%38 = call i32 @putchar(i32 58)
%39 = call i32 @putchar(i32 10)
%40 = call i32 (...) @getchar()
store i32 %40, i32* %6
%41 = call i32 (...) @getchar()
store i32 %41, i32* %7
%42 = call i32 @putchar(i32 67)
%43 = call i32 @putchar(i32 111)
%44 = call i32 @putchar(i32 108)
%45 = call i32 @putchar(i32 111)
%46 = call i32 @putchar(i32 110)
%47 = call i32 @putchar(i32 110)
%48 = call i32 @putchar(i32 101)
%49 = call i32 @putchar(i32 58)
%50 = call i32 @putchar(i32 10)
%51 = call i32 (...) @getchar()
store i32 %51, i32* %8
%52 = call i32 (...) @getchar()
store i32 %52, i32* %7
br label %53
53: ; preds = %59, %31
%54 = load i32, i32* %5
%55 = load i32, i32* %6
%56 = load i32, i32* %8
%57 = call i64 @getCell(i32 %54, i32 %55, i32 %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %95
59: ; preds = %53
%60 = call i32 @putchar(i32 67)
%61 = call i32 @putchar(i32 111)
%62 = call i32 @putchar(i32 117)
%63 = call i32 @putchar(i32 112)
%64 = call i32 @putchar(i32 115)
%65 = call i32 @putchar(i32 32)
%66 = call i32 @putchar(i32 105)
%67 = call i32 @putchar(i32 110)
%68 = call i32 @putchar(i32 118)
%69 = call i32 @putchar(i32 97)
%70 = call i32 @putchar(i32 108)
%71 = call i32 @putchar(i32 105)
%72 = call i32 @putchar(i32 100)
%73 = call i32 @putchar(i32 58)
%74 = call i32 @putchar(i32 10)
%75 = call i32 @putchar(i32 76)
%76 = call i32 @putchar(i32 105)
%77 = call i32 @putchar(i32 103)
%78 = call i32 @putchar(i32 110)
%79 = call i32 @putchar(i32 101)
%80 = call i32 @putchar(i32 58)
%81 = call i32 @putchar(i32 10)
%82 = call i32 (...) @getchar()
store i32 %82, i32* %6
%83 = call i32 (...) @getchar()
store i32 %83, i32* %7
%84 = call i32 @putchar(i32 67)
%85 = call i32 @putchar(i32 111)
%86 = call i32 @putchar(i32 108)
%87 = call i32 @putchar(i32 111)
%88 = call i32 @putchar(i32 110)
%89 = call i32 @putchar(i32 110)
%90 = call i32 @putchar(i32 101)
%91 = call i32 @putchar(i32 58)
%92 = call i32 @putchar(i32 10)
%93 = call i32 (...) @getchar()
store i32 %93, i32* %8
%94 = call i32 (...) @getchar()
store i32 %94, i32* %7
br label %53
95: ; preds = %53
%96 = load i32, i32* %6
%97 = mul nsw i32 %96, 3
%98 = load i32, i32* %8
%99 = add nsw i32 %97, %98
store i32 %99, i32* %9
%100 = load i32, i32* %9
%101 = call i32 @pow(i32 3, i32 %100)
%102 = load i32, i32* %4
%103 = mul nsw i32 %101, %102
%104 = load i32, i32* %5
%105 = add nsw i32 %104, %103
store i32 %105, i32* %5
%106 = load i32, i32* %3
ret i32 %106
}

LLVM IR (-O2):
define i32 @play(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i32 84)
%4 = tail call i32 @putchar(i32 111)
%5 = tail call i32 @putchar(i32 117)
%6 = tail call i32 @putchar(i32 114)
%7 = tail call i32 @putchar(i32 32)
%8 = tail call i32 @putchar(i32 100)
%9 = tail call i32 @putchar(i32 117)
%10 = tail call i32 @putchar(i32 32)
%11 = tail call i32 @putchar(i32 106)
%12 = tail call i32 @putchar(i32 111)
%13 = tail call i32 @putchar(i32 117)
%14 = tail call i32 @putchar(i32 101)
%15 = tail call i32 @putchar(i32 117)
%16 = tail call i32 @putchar(i32 114)
%17 = tail call i32 @putchar(i32 32)
%18 = icmp eq i32 %0, 1
%19 = select i1 %18, i32 49, i32 50
%20 = tail call i32 @putchar(i32 %19)
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 @putchar(i32 76)
%23 = tail call i32 @putchar(i32 105)
%24 = tail call i32 @putchar(i32 103)
%25 = tail call i32 @putchar(i32 110)
%26 = tail call i32 @putchar(i32 101)
%27 = tail call i32 @putchar(i32 58)
%28 = tail call i32 @putchar(i32 10)
%29 = tail call i32 (...) @getchar()
%30 = tail call i32 (...) @getchar()
%31 = tail call i32 @putchar(i32 67)
%32 = tail call i32 @putchar(i32 111)
%33 = tail call i32 @putchar(i32 108)
%34 = tail call i32 @putchar(i32 111)
%35 = tail call i32 @putchar(i32 110)
%36 = tail call i32 @putchar(i32 110)
%37 = tail call i32 @putchar(i32 101)
%38 = tail call i32 @putchar(i32 58)
%39 = tail call i32 @putchar(i32 10)
%40 = tail call i32 (...) @getchar()
%41 = tail call i32 (...) @getchar()
%42 = tail call i64 @getCell(i32 %1, i32 %29, i32 %40)
%43 = icmp eq i64 %42, 0
br i1 %43, label %82, label %44
44: ; preds = %2, %44
%45 = tail call i32 @putchar(i32 67)
%46 = tail call i32 @putchar(i32 111)
%47 = tail call i32 @putchar(i32 117)
%48 = tail call i32 @putchar(i32 112)
%49 = tail call i32 @putchar(i32 115)
%50 = tail call i32 @putchar(i32 32)
%51 = tail call i32 @putchar(i32 105)
%52 = tail call i32 @putchar(i32 110)
%53 = tail call i32 @putchar(i32 118)
%54 = tail call i32 @putchar(i32 97)
%55 = tail call i32 @putchar(i32 108)
%56 = tail call i32 @putchar(i32 105)
%57 = tail call i32 @putchar(i32 100)
%58 = tail call i32 @putchar(i32 58)
%59 = tail call i32 @putchar(i32 10)
%60 = tail call i32 @putchar(i32 76)
%61 = tail call i32 @putchar(i32 105)
%62 = tail call i32 @putchar(i32 103)
%63 = tail call i32 @putchar(i32 110)
%64 = tail call i32 @putchar(i32 101)
%65 = tail call i32 @putchar(i32 58)
%66 = tail call i32 @putchar(i32 10)
%67 = tail call i32 (...) @getchar()
%68 = tail call i32 (...) @getchar()
%69 = tail call i32 @putchar(i32 67)
%70 = tail call i32 @putchar(i32 111)
%71 = tail call i32 @putchar(i32 108)
%72 = tail call i32 @putchar(i32 111)
%73 = tail call i32 @putchar(i32 110)
%74 = tail call i32 @putchar(i32 110)
%75 = tail call i32 @putchar(i32 101)
%76 = tail call i32 @putchar(i32 58)
%77 = tail call i32 @putchar(i32 10)
%78 = tail call i32 (...) @getchar()
%79 = tail call i32 (...) @getchar()
%80 = tail call i64 @getCell(i32 %1, i32 %67, i32 %78)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %44
82: ; preds = %44, %2
%83 = phi i32 [ %29, %2 ], [ %67, %44 ]
%84 = phi i32 [ %40, %2 ], [ %78, %44 ]
%85 = mul nsw i32 %83, 3
%86 = add nsw i32 %85, %84
%87 = tail call i32 @pow(i32 3, i32 %86)
ret i32 undef
}