#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*/ create_next_move();
int get_captured_now(int **);
int get_nr_of_liberties(int);
int get_size_of_worm(int);
int get_worm_nr(int, int);
int /*<<< orphan*/ push_move();
int remove_stones(int);
int /*<<< orphan*/ scan_board_1();
int /*<<< orphan*/ set_move_captured_stones(int **);
int /*<<< orphan*/ set_move_ko(int, int);
int /*<<< orphan*/ set_move_pass(int);
int /*<<< orphan*/ set_move_vertex(int, int, int);
int /*<<< orphan*/ set_vertex(int, int, int);
void make_move(int color, int i, int j) {
  int nr_of_removed_stones;
  int group_nr;
  int nr_of_liberties;
  int group_size;
  int captured_now[21 * 21][2];
  if (i == -1 && j == -1) {
    create_next_move();
    set_move_pass(color);
    push_move();
    return;
  }
  set_vertex(color, i, j);
  scan_board_1();
  nr_of_removed_stones = remove_stones(color * -1);
  if (nr_of_removed_stones > 0) {
    scan_board_1();
  }
  nr_of_removed_stones = get_captured_now(captured_now);
  create_next_move();
  set_move_vertex(color, i, j);
  set_move_captured_stones(captured_now);
  group_nr = get_worm_nr(i, j);
  nr_of_liberties = get_nr_of_liberties(group_nr);
  group_size = get_size_of_worm(group_nr);
  if (nr_of_removed_stones == 1 && group_size == 1 && nr_of_liberties == 1) {
    set_move_ko(captured_now[0][0], captured_now[0][1]);
  }
  push_move();
  return;
}


x86 assembly (clang, -O0):
<make_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0xdf0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1213 <make_move+0x43>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1213 <make_move+0x43>
mov    $0x0,%al
call   1050 <create_next_move@plt>
mov    -0x4(%rbp),%edi
call   1080 <set_move_pass@plt>
mov    $0x0,%al
call   10b0 <push_move@plt>
jmp    12cf <make_move+0xff>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1090 <set_vertex@plt>
mov    $0x0,%al
call   1060 <scan_board_1@plt>
imul   $0xffffffff,-0x4(%rbp),%edi
call   1040 <remove_stones@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1245 <make_move+0x75>
mov    $0x0,%al
call   1060 <scan_board_1@plt>
lea    -0xdf0(%rbp),%rdi
call   10c0 <get_captured_now@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <create_next_move@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   10d0 <set_move_vertex@plt>
lea    -0xdf0(%rbp),%rdi
call   10e0 <set_move_captured_stones@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <get_worm_nr@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <get_nr_of_liberties@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   10a0 <get_size_of_worm@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    12c8 <make_move+0xf8>
cmpl   $0x1,-0x1c(%rbp)
jne    12c8 <make_move+0xf8>
cmpl   $0x1,-0x18(%rbp)
jne    12c8 <make_move+0xf8>
mov    -0xdf0(%rbp),%edi
mov    -0xdec(%rbp),%esi
call   10f0 <set_move_ko@plt>
mov    $0x0,%al
call   10b0 <push_move@plt>
add    $0xdf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_move>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xdd0,%rsp
mov    %edi,%r14d
mov    %edx,%eax
and    %esi,%eax
cmp    $0xffffffff,%eax
je     128e <make_move+0xbe>
mov    %edx,%ebx
mov    %esi,%ebp
mov    %r14d,%edi
call   1090 <set_vertex@plt>
xor    %eax,%eax
call   1060 <scan_board_1@plt>
mov    %r14d,%edi
neg    %edi
call   1040 <remove_stones@plt>
test   %eax,%eax
jle    1217 <make_move+0x47>
xor    %eax,%eax
call   1060 <scan_board_1@plt>
mov    %rsp,%r12
mov    %r12,%rdi
call   10c0 <get_captured_now@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <create_next_move@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   10d0 <set_move_vertex@plt>
mov    %r12,%rdi
call   10e0 <set_move_captured_stones@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <get_worm_nr@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1070 <get_nr_of_liberties@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   10a0 <get_size_of_worm@plt>
cmp    $0x1,%r15d
jne    1277 <make_move+0xa7>
cmp    $0x1,%eax
jne    1277 <make_move+0xa7>
cmp    $0x1,%ebx
jne    1277 <make_move+0xa7>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
call   10f0 <set_move_ko@plt>
xor    %eax,%eax
call   10b0 <push_move@plt>
add    $0xdd0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1050 <create_next_move@plt>
mov    %r14d,%edi
call   1080 <set_move_pass@plt>
xor    %eax,%eax
add    $0xdd0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <push_move@plt>

LLVM IR (-O0):
define void @make_move(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [441 x [2 x i32]]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %22
14: ; preds = %3
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = call i32 (...) @create_next_move()
%19 = load i32, i32* %4
%20 = call i32 @set_move_pass(i32 %19)
%21 = call i32 (...) @push_move()
br label %72
22: ; preds = %14, %3
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = call i32 @set_vertex(i32 %23, i32 %24, i32 %25)
%27 = call i32 (...) @scan_board_1()
%28 = load i32, i32* %4
%29 = mul nsw i32 %28, -1
%30 = call i32 @remove_stones(i32 %29)
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %22
%34 = call i32 (...) @scan_board_1()
br label %35
35: ; preds = %33, %22
%36 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %11, i64 0, i64 0
%37 = bitcast [2 x i32]* %36 to i32**
%38 = call i32 @get_captured_now(i32** %37)
store i32 %38, i32* %7
%39 = call i32 (...) @create_next_move()
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = call i32 @set_move_vertex(i32 %40, i32 %41, i32 %42)
%44 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %11, i64 0, i64 0
%45 = bitcast [2 x i32]* %44 to i32**
%46 = call i32 @set_move_captured_stones(i32** %45)
%47 = load i32, i32* %5
%48 = load i32, i32* %6
%49 = call i32 @get_worm_nr(i32 %47, i32 %48)
store i32 %49, i32* %8
%50 = load i32, i32* %8
%51 = call i32 @get_nr_of_liberties(i32 %50)
store i32 %51, i32* %9
%52 = load i32, i32* %8
%53 = call i32 @get_size_of_worm(i32 %52)
store i32 %53, i32* %10
%54 = load i32, i32* %7
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %70
56: ; preds = %35
%57 = load i32, i32* %10
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %70
59: ; preds = %56
%60 = load i32, i32* %9
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %70
62: ; preds = %59
%63 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %11, i64 0, i64 0
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %63, i64 0, i64 0
%65 = load i32, i32* %64
%66 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %11, i64 0, i64 0
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %66, i64 0, i64 1
%68 = load i32, i32* %67
%69 = call i32 @set_move_ko(i32 %65, i32 %68)
br label %70
70: ; preds = %62, %59, %56, %35
%71 = call i32 (...) @push_move()
br label %72
72: ; preds = %70, %17
ret void
}

LLVM IR (-O2):
define void @make_move(i32 %0, i32 %1, i32 %2) {
%4 = alloca [441 x [2 x i32]]
%5 = bitcast [441 x [2 x i32]]* %4 to i8*
%6 = and i32 %2, %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 (...) @create_next_move()
%10 = tail call i32 @set_move_pass(i32 %0)
%11 = tail call i32 (...) @push_move()
br label %42
12: ; preds = %3
%13 = tail call i32 @set_vertex(i32 %0, i32 %1, i32 %2)
%14 = tail call i32 (...) @scan_board_1()
%15 = sub nsw i32 0, %0
%16 = tail call i32 @remove_stones(i32 %15)
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 (...) @scan_board_1()
br label %20
20: ; preds = %18, %12
%21 = bitcast [441 x [2 x i32]]* %4 to i32**
%22 = call i32 @get_captured_now(i32** %21)
%23 = call i32 (...) @create_next_move()
%24 = call i32 @set_move_vertex(i32 %0, i32 %1, i32 %2)
%25 = call i32 @set_move_captured_stones(i32** %21)
%26 = call i32 @get_worm_nr(i32 %1, i32 %2)
%27 = call i32 @get_nr_of_liberties(i32 %26)
%28 = call i32 @get_size_of_worm(i32 %26)
%29 = icmp eq i32 %22, 1
%30 = icmp eq i32 %28, 1
%31 = select i1 %29, i1 %30, i1 false
%32 = icmp eq i32 %27, 1
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %34, label %40
34: ; preds = %20
%35 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %4, i64 0, i64 0, i64 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds [441 x [2 x i32]], [441 x [2 x i32]]* %4, i64 0, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @set_move_ko(i32 %36, i32 %38)
br label %40
40: ; preds = %34, %20
%41 = call i32 (...) @push_move()
br label %42
42: ; preds = %40, %8
ret void
}