// File: /workspace/github_cpp_makefile_star2_O2/kobanium[P]Ray/src/board/GoBoard.cpp
// Function: InitializeConst()
void
InitializeConst( void )
{
  int i;

  komi[0] = default_komi;
  komi[S_BLACK] = default_komi + 1.0;
  komi[S_WHITE] = default_komi - 1.0;

  i = 0;
  for (int y = board_start; y <= board_end; y++) {
    for (int x = board_start; x <= board_end; x++) {
      onboard_pos[i++] = POS(x, y);
      board_x[POS(x, y)] = x;
      board_y[POS(x, y)] = y;
    }
  }

  for (int y = board_start; y <= board_end; y++) {
    for (int x = board_start; x <= (board_start + pure_board_size / 2); x++) {
      border_dis_x[POS(x, y)] = x - (OB_SIZE - 1);
      border_dis_x[POS(board_end + OB_SIZE - x, y)] = x - (OB_SIZE - 1);
      border_dis_y[POS(y, x)] = x - (OB_SIZE - 1);
      border_dis_y[POS(y, board_end + OB_SIZE - x)] = x - (OB_SIZE - 1);
    }
  }

  for (int y = 0; y < pure_board_size; y++) {
    for (int x = 0; x < pure_board_size; x++) {
      move_dis[x][y] = x + y + ((x > y) ? x : y);
      if (move_dis[x][y] >= MOVE_DISTANCE_MAX) move_dis[x][y] = MOVE_DISTANCE_MAX - 1;
    }
  }

  std::fill_n(board_pos_id, BOARD_MAX, 0);
  i = 1;
  for (int y = board_start; y <= (board_start + pure_board_size / 2); y++) {
    for (int x = board_start; x <= y; x++) {
      board_pos_id[POS(x, y)] = i;
      board_pos_id[POS(board_end + OB_SIZE - x, y)] = i;
      board_pos_id[POS(y, x)] = i;
      board_pos_id[POS(y, board_end + OB_SIZE - x)] = i;
      board_pos_id[POS(x, board_end + OB_SIZE - y)] = i;
      board_pos_id[POS(board_end + OB_SIZE - x, board_end + OB_SIZE - y)] = i;
      board_pos_id[POS(board_end + OB_SIZE - y, x)] = i;
      board_pos_id[POS(board_end + OB_SIZE - y, board_end + OB_SIZE - x)] = i;
      i++;
    }
  }

  first_move_candidates = 0;
  for (int y = board_start; y <= (board_start + board_end) / 2; y++) {
    for (int x = board_end + board_start - y; x <= board_end; x++) {
      first_move_candidate[first_move_candidates++] = POS(x, y);
    }
  }

  cross[0] = - board_size - 1;
  cross[1] = - board_size + 1;
  cross[2] = board_size - 1;
  cross[3] = board_size + 1;

  corner[0] = POS(board_start, board_start);
  corner[1] = POS(board_start, board_end);
  corner[2] = POS(board_end, board_start);
  corner[3] = POS(board_end, board_end);

  corner_neighbor[0][0] =  EAST(POS(board_start, board_start));
  corner_neighbor[0][1] = SOUTH(POS(board_start, board_start));
  corner_neighbor[1][0] = NORTH(POS(board_start, board_end));
  corner_neighbor[1][1] =  EAST(POS(board_start, board_end));
  corner_neighbor[2][0] =  WEST(POS(board_end, board_start));
  corner_neighbor[2][1] = SOUTH(POS(board_end, board_start));
  corner_neighbor[3][0] = NORTH(POS(board_end, board_end));
  corner_neighbor[3][1] =  WEST(POS(board_end, board_end));

  InitializeNeighbor();
  InitializeEye();
  InitializeTerritory();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movsd 0x2612c(%rip), %xmm0    # 0x618c8
movsd %xmm0, 0x1aabc76c(%rip) # 0x1aaf7f10
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd 0xc5b0(%rip), %xmm0     # 0x47d60
movupd %xmm0, 0x1aabc760(%rip) # 0x1aaf7f18
movl 0x26102(%rip), %edx     # 0x618c0
movslq 0x260ff(%rip), %r13     # 0x618c4
movslq 0x260f0(%rip), %rdi     # 0x618bc
movslq %edx, %r15
leaq 0x1(%rdi), %rbp
imulq %r15, %rbp
leaq (,%rbp,4), %rax
leaq (,%rdi,4), %rcx
movq %rcx, 0x10(%rsp)
leal 0x1(%rdi), %ecx
movq %rdx, 0x38(%rsp)
imull %edx, %ecx
xorl %edx, %edx
leaq 0x1ab10ef0(%rip), %r8   # 0x1ab4c6f0
leaq 0x1aabd479(%rip), %r9   # 0x1aaf8c80
leaq 0x1aabe1a2(%rip), %r14  # 0x1aaf99b0
movq %r15, 0x18(%rsp)
cmpq %r13, %r15
jg 0x3b862
movslq %edx, %rdx
leaq (,%rdx,4), %rsi
movl %ecx, %r10d
xorl %r11d, %r11d
movq 0x18(%rsp), %rbx
cmpq %r13, %rbx
jg 0x3b856
incq %rdx
leaq (%rsi,%r11), %r12
movl %r10d, (%r8,%r12)
leaq (%rax,%r11), %r12
movl %ebx, (%r9,%r12)
movl %r15d, (%r14,%r12)
incq %rbx
addq $0x4, %r11
incl %r10d
jmp 0x3b82e
incq %r15
addq 0x10(%rsp), %rax
addl %edi, %ecx
jmp 0x3b813
movl 0x2604c(%rip), %ecx     # 0x618b4
pushq $0x2
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movq 0x38(%rsp), %rdx
addl %edx, %eax
leal 0x5(%r13), %esi
cltq
movq %rax, 0x50(%rsp)
leal -0x4(%rdx), %eax
movl %eax, 0x30(%rsp)
movl %esi, 0xc(%rsp)
subl %edx, %esi
movl %edi, %eax
movl %esi, 0x28(%rsp)
imull %esi, %eax
movl %eax, 0x20(%rsp)
leaq 0x1ab0ee3d(%rip), %r14  # 0x1ab4a6e0
leaq (%r14,%rbp,4), %r8
leaq 0x1ab0fb62(%rip), %r12  # 0x1ab4b410
movq %rbp, 0x40(%rsp)
leaq (%r12,%rbp,4), %rbx
movq 0x18(%rsp), %r11
movq %r13, 0x48(%rsp)
cmpq %r13, %r11
jg 0x3b934
movq %r11, %r13
imulq %rdi, %r13
movq %rbx, %rbp
movq %r8, %r15
movl 0x20(%rsp), %eax
movl %eax, %edx
movl 0x28(%rsp), %eax
movl %eax, %r10d
movl 0x30(%rsp), %eax
movq 0x18(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
jg 0x3b921
movl %eax, (%r15)
movslq %r10d, %r10
leaq (%r10,%r13), %r9
movl %eax, (%r14,%r9,4)
movl %eax, (%rbp)
movslq %edx, %rdx
leaq (%r11,%rdx), %r9
movl %eax, (%r12,%r9,4)
incq %rsi
incl %eax
decl %r10d
subl %edi, %edx
addq $0x4, %r15
addq 0x10(%rsp), %rbp
jmp 0x3b8e9
incq %r11
addq 0x10(%rsp), %r8
addq $0x4, %rbx
movq 0x48(%rsp), %r13
jmp 0x3b8c1
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %r8d
cmovgl %ecx, %r8d
leaq 0x1ab107f7(%rip), %r9   # 0x1ab4c140
pushq $0xf
popq %rbp
cmpq %r8, %rdx
je 0x3b987
movq %r9, %rax
xorl %esi, %esi
cmpl %esi, %edx
movl %esi, %r10d
cmoval %edx, %r10d
cmpq %rsi, %rcx
je 0x3b97e
addl %edx, %r10d
addl %esi, %r10d
cmpl $0xf, %r10d
cmovael %ebp, %r10d
movl %r10d, (%rax)
incq %rsi
addq $0x4c, %rax
jmp 0x3b956
incq %rdx
addq $0x4, %r9
jmp 0x3b94c
xorl %eax, %eax
leaq 0x1aabc5c0(%rip), %rsi  # 0x1aaf7f50
movq 0x40(%rsp), %rcx
cmpq $0xd24, %rax            # imm = 0xD24
je 0x3b9a7
andl $0x0, (%rax,%rsi)
addq $0x4, %rax
jmp 0x3b995
movslq 0xc(%rsp), %rax
leaq (%rsi,%rcx,4), %r8
movq %rax, %rcx
movq 0x18(%rsp), %r9
subq %r9, %rcx
imulq %rdi, %rcx
leaq (%rcx,%rax), %rbx
subq %r9, %rbx
movq 0x10(%rsp), %r14
negq %r14
leaq (,%r9,4), %rdx
leaq (%rdx,%rcx,4), %r10
addq %rsi, %r10
leaq -0x1(%rdi), %rcx
imulq %r9, %rcx
shlq $0x2, %rax
leaq (%rax,%rcx,4), %rax
addq %rsi, %rax
pushq $0x1
popq %rcx
movq %rax, 0x30(%rsp)
movq %r10, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %r8, %r15
movq %r8, %rdx
cmpq 0x50(%rsp), %r9
jg 0x3bad9
movq %rdi, %rbp
movl %ecx, 0xc(%rsp)
movl %ecx, %r8d
xorl %r11d, %r11d
movq %rax, 0x60(%rsp)
movq %rax, %rcx
movq %r10, 0x58(%rsp)
movq %rsi, 0x40(%rsp)
movq %rsi, %rax
movq 0x20(%rsp), %rsi
xorl %r13d, %r13d
movq 0x18(%rsp), %rdi
addq %r13, %rdi
cmpq %r9, %rdi
jg 0x3ba89
leaq (%r8,%r13), %rdi
movl %edi, (%rdx,%r13,4)
movl %edi, (%rcx)
movl %edi, (%r15,%r11,4)
movl %edi, (%r10)
movq 0x28(%rsp), %r12
movl %edi, (%r12,%r13,4)
movl %edi, (%rsi,%rbx,4)
movq 0x30(%rsp), %r12
movl %edi, (%r12,%r11,4)
movl %edi, (%rax,%rbx,4)
incq %r13
addq $-0x4, %rsi
addq %r14, %rax
addq %r14, %r10
addq $-0x4, %rcx
addq %rbp, %r11
jmp 0x3ba3d
incq %r9
movq 0x10(%rsp), %rax
addq %rax, %rdx
addq %r14, 0x20(%rsp)
movq 0x40(%rsp), %rsi
addq $-0x4, %rsi
movq 0x58(%rsp), %r10
addq $0x4, %r10
movq 0x60(%rsp), %rcx
addq %rax, %rcx
movq %rcx, %rax
addq $-0x4, 0x30(%rsp)
addq $0x4, %r15
addq %r14, 0x28(%rsp)
movl 0xc(%rsp), %ecx
addl %r13d, %ecx
movq %rbp, %rdi
movq 0x48(%rsp), %r13
jmp 0x3ba08
andl $0x0, 0x1aabc420(%rip)  # 0x1aaf7f00
movq 0x38(%rsp), %rsi
leal (%rsi,%r13), %ecx
movl %ecx, %eax
cltd
pushq $0x2
popq %r8
idivl %r8d
movl %esi, %edx
imull %edi, %edx
addl %r13d, %edx
leal -0x1(%rdi), %r8d
xorl %r9d, %r9d
leaq 0x1ab11197(%rip), %r10  # 0x1ab4cca0
movl %esi, %r11d
cmpl %eax, %r11d
jg 0x3bb4a
movl %ecx, %esi
subl %r11d, %esi
movslq %r9d, %r9
leaq (%r10,%r9,4), %rbx
leal 0x1(%r9), %ebp
movl %edx, %r14d
cmpl %r13d, %esi
jg 0x3bb42
incq %r9
movl %ebp, 0x1aabc3ce(%rip)  # 0x1aaf7f00
movl %r14d, (%rbx)
incl %esi
addq $0x4, %rbx
incl %ebp
incl %r14d
jmp 0x3bb24
incl %r11d
addl %r8d, %edx
jmp 0x3bb0c
movl %edi, %eax
notl %eax
movl %eax, 0x1ab116fc(%rip)  # 0x1ab4d250
pushq $0x1
popq %rax
subl %edi, %eax
movl %eax, 0x1ab116f5(%rip)  # 0x1ab4d254
leal -0x1(%rdi), %eax
movl %eax, 0x1ab116f0(%rip)  # 0x1ab4d258
leal 0x1(%rdi), %eax
movl %eax, 0x1ab116eb(%rip)  # 0x1ab4d25c
movl %eax, %ecx
movq 0x38(%rsp), %r11
imull %r11d, %ecx
movl %ecx, 0x1ab116ee(%rip)  # 0x1ab4d270
movl %edi, %edx
imull %r13d, %edx
leal (%rdx,%r11), %esi
movl %esi, 0x1ab116e2(%rip)  # 0x1ab4d274
movq %rdi, %r10
imull %r11d, %edi
leal (%rdi,%r13), %r8d
movl %r8d, 0x1ab116d4(%rip)  # 0x1ab4d278
imull %r13d, %eax
movl %eax, 0x1ab116ce(%rip)  # 0x1ab4d27c
leal 0x1(%rcx), %r9d
movl %r9d, 0x1ab116c7(%rip)  # 0x1ab4d280
addl %r10d, %ecx
movl %ecx, 0x1ab116c2(%rip)  # 0x1ab4d284
subl %r10d, %esi
movl %esi, 0x1ab116bd(%rip)  # 0x1ab4d288
leal (%rdx,%r11), %ecx
incl %ecx
movl %ecx, 0x1ab116b5(%rip)  # 0x1ab4d28c
leal (%rdi,%r13), %ecx
decl %ecx
movl %ecx, 0x1ab116ad(%rip)  # 0x1ab4d290
addl %r10d, %r8d
movl %r8d, 0x1ab116a7(%rip)  # 0x1ab4d294
movl %eax, %ecx
subl %r10d, %ecx
movl %ecx, 0x1ab116a0(%rip)  # 0x1ab4d298
decl %eax
movl %eax, 0x1ab1169c(%rip)  # 0x1ab4d29c
callq 0x3b386
callq 0x3b3ca
xorl %eax, %eax
leaq 0x1aadeacd(%rip), %rcx  # 0x1ab1a6e0
cmpq $0x10000, %rax          # imm = 0x10000
je 0x3bc3d
movl %eax, %esi
notl %esi
movb $0x1, %dl
testw $0x1144, %si            # imm = 0x1144
je 0x3bc35
movl %eax, %esi
notl %esi
movb $0x2, %dl
testw $0x2288, %si            # imm = 0x2288
jne 0x3bc38
movb %dl, (%rax,%rcx)
incq %rax
jmp 0x3bc13
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq