#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 /*<<< orphan*/ m;

/* Variables and functions */
int /*<<< orphan*/ draw(int *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int liberties(int *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int unmarshall(char *);
int main() {
  char l[6];
  int m[9 * 9];
  int p = 0;
  int round = 1;
  memset(m, 0, sizeof(m));
  m[0] = 1;
  m[1] = 1;
  m[9] = 2;
  m[10] = 2;
  printf("%i\n", liberties(m, 0));
  draw(m);
  fgets(l, 6, stdin);
  if (strcmp(l, "Start") == 0) {
    printf("E5\n");
    fflush(stdout);
    m[44] = 1;
    round++;
    fgets(l, 5, stdin);
  }
  while (strcmp(l, "Quit") != 0) {
    p = unmarshall((char *)&l);
    m[p] = 2;
    round++;
    fgets(l, 5, stdin);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x154(%rbp)
movl   $0x1,-0x158(%rbp)
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1050 <memset@plt>
movl   $0x1,-0x150(%rbp)
movl   $0x1,-0x14c(%rbp)
movl   $0x2,-0x12c(%rbp)
movl   $0x2,-0x128(%rbp)
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
call   1090 <liberties@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x150(%rbp),%rdi
call   1030 <draw@plt>
lea    -0xa(%rbp),%rdi
mov    0x2dd2(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%esi
call   1060 <fgets@plt>
lea    -0xa(%rbp),%rdi
lea    0xdd7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1288 <main+0x108>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0x1,-0xa0(%rbp)
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
lea    -0xa(%rbp),%rdi
mov    0x2d6c(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1060 <fgets@plt>
jmp    128d <main+0x10d>
lea    -0xa(%rbp),%rdi
lea    0xd76(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     12f3 <main+0x173>
lea    -0xa(%rbp),%rdi
call   10a0 <unmarshall@plt>
mov    %eax,-0x154(%rbp)
movslq -0x154(%rbp),%rax
movl   $0x2,-0x150(%rbp,%rax,4)
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
lea    -0xa(%rbp),%rdi
mov    0x2d06(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1060 <fgets@plt>
jmp    128d <main+0x10d>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x160,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1060 <memset@plt>
movabs $0x100000001,%rax
mov    %rax,0x10(%rsp)
movabs $0x200000002,%rax
mov    %rax,0x34(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <liberties@plt>
lea    0xe21(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <draw@plt>
mov    0x2df1(%rip),%r15
mov    (%r15),%edx
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1070 <fgets@plt>
lea    0xdf1(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1257 <main+0xc7>
lea    0xde8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
movl   $0x1,0xc0(%rsp)
mov    (%r15),%edx
lea    0xa(%rsp),%rdi
mov    $0x5,%esi
call   1070 <fgets@plt>
lea    0xdac(%rip),%rsi
lea    0xa(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12b2 <main+0x122>
lea    0xa(%rsp),%rbx
lea    0xd91(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10b0 <unmarshall@plt>
cltq
movl   $0x2,0x10(%rsp,%rax,4)
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1280 <main+0xf0>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"Start\00"
@.str.2 = [4 x i8] c"E5\0A\00"
@stdout = global i32 0
@.str.3 = [5 x i8] c"Quit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [81 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 1, i32* %5
%6 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 0
%7 = call i32 @memset(i32* %6, i32 0, i32 324)
%8 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 0
store i32 1, i32* %8
%9 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 1
store i32 1, i32* %9
%10 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 9
store i32 2, i32* %10
%11 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 10
store i32 2, i32* %11
%12 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 0
%13 = call i32 @liberties(i32* %12, i32 0)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 0
%16 = call i32 @draw(i32* %15)
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 6, i32 %18)
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* @stdout
%26 = call i32 @fflush(i32 %25)
%27 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 44
store i32 1, i32* %27
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %30, i32 5, i32 %31)
br label %33
33: ; preds = %23, %0
br label %34
34: ; preds = %38, %33
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %49
38: ; preds = %34
%39 = bitcast [6 x i8]* %2 to i8*
%40 = call i32 @unmarshall(i8* %39)
store i32 %40, i32* %4
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 %42
store i32 2, i32* %43
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%47 = load i32, i32* @stdin
%48 = call i32 @fgets(i8* %46, i32 5, i32 %47)
br label %34
49: ; preds = %34
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"Start\00"
@stdout = global i32 0
@.str.3 = [5 x i8] c"Quit\00"
@str = [3 x i8] c"E5\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [81 x i32]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = bitcast [81 x i32]* %2 to i8*
%5 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 0
%6 = call i32 @memset(i32* %5, i32 0, i32 324)
store i32 1, i32* %5
%7 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 1
store i32 1, i32* %7
%8 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 9
store i32 2, i32* %8
%9 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 10
store i32 2, i32* %9
%10 = call i32 @liberties(i32* %5, i32 0)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @draw(i32* %5)
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %3, i32 6, i32 %13)
%15 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%19 = load i32, i32* @stdout
%20 = call i32 @fflush(i32 %19)
%21 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 44
store i32 1, i32* %21
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %3, i32 5, i32 %22)
br label %24
24: ; preds = %17, %0
%25 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %24, %27
%28 = call i32 @unmarshall(i8* %3)
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [81 x i32], [81 x i32]* %2, i64 0, i64 %29
store i32 2, i32* %30
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %3, i32 5, i32 %31)
%33 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %27
35: ; preds = %27, %24
ret i32 0
}