// File: /workspace/github_cpp_makefile_star2_O1/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 0x213c9(%rip), %xmm0    # 0x758c8
movsd %xmm0, 0x1aab7a09(%rip) # 0x1ab0bf10
movsd 0x8af9(%rip), %xmm1     # 0x5d008
addsd %xmm0, %xmm1
movsd %xmm1, 0x1aab79fd(%rip) # 0x1ab0bf18
addsd 0xa94d(%rip), %xmm0     # 0x5ee70
movsd %xmm0, 0x1aab79f5(%rip) # 0x1ab0bf20
movl 0x2138f(%rip), %eax     # 0x758c0
movq %rax, 0x10(%rsp)
cltq
movl 0x21386(%rip), %ecx     # 0x758c4
movq %rax, 0x28(%rsp)
movq %rcx, 0x18(%rsp)
cmpl %ecx, %eax
jg 0x545f4
movl 0x21366(%rip), %eax     # 0x758bc
movq 0x18(%rsp), %r11
leal 0x1(%r11), %ecx
movslq %eax, %rdx
leaq 0x1(%rdx), %r8
movq 0x28(%rsp), %rbx
imulq %rbx, %r8
leaq 0x1aab870a(%rip), %rsi  # 0x1ab0cc80
leaq (%rsi,%r8,4), %rsi
leaq (,%rdx,4), %rdi
leaq 0x1aab9427(%rip), %r9   # 0x1ab0d9b0
leaq (%r9,%r8,4), %r8
incl %edx
movq 0x10(%rsp), %r10
imull %r10d, %edx
movl %r11d, %r9d
notl %r9d
addq %r10, %r9
xorl %r10d, %r10d
leaq 0x1ab0c145(%rip), %r11  # 0x1ab606f0
movq 0x10(%rsp), %r13
movslq %r10d, %r10
leaq (,%r10,4), %r15
xorl %r14d, %r14d
leal (%rdx,%r14), %ebp
leaq (%r15,%r14,4), %r12
movl %ebp, (%r11,%r12)
leal (%r14,%r13), %ebp
movl %ebp, (%rsi,%r14,4)
movl %ebx, (%r8,%r14,4)
incq %r14
movl %r9d, %ebp
addl %r14d, %ebp
jne 0x545be
incq %rbx
addq %r14, %r10
addq %rdi, %rsi
addq %rdi, %r8
addq %rax, %rdx
cmpl %ebx, %ecx
jne 0x545b0
movq 0x18(%rsp), %rax
cmpl %eax, 0x10(%rsp)
jg 0x546e3
movl 0x212ab(%rip), %eax     # 0x758b4
movl %eax, %ecx
shrl $0x1f, %ecx
movl %eax, 0x20(%rsp)
addl %eax, %ecx
sarl %ecx
movq 0x10(%rsp), %rsi
addl %esi, %ecx
movslq 0x21298(%rip), %rdx     # 0x758bc
cmpl %ecx, %esi
cmovgl %esi, %ecx
movq 0x18(%rsp), %rax
leal 0x1(%rax), %edi
movl %edi, 0xc(%rsp)
subl %esi, %eax
addl $0x5, %eax
movl %edx, %edi
movl %eax, 0x40(%rsp)
imull %eax, %edi
movl %edi, 0x38(%rsp)
leaq 0x1(%rdx), %rax
movq 0x28(%rsp), %r12
imulq %r12, %rax
leaq 0x1ab0adb5(%rip), %r9   # 0x1ab5f410
leaq (%r9,%rax,4), %rbp
leaq (,%rdx,4), %r11
leaq 0x1ab0a072(%rip), %rbx  # 0x1ab5e6e0
leaq (%rbx,%rax,4), %r14
leal -0x4(%rsi), %eax
movl %eax, 0x30(%rsp)
negl %ecx
cmpl $-0x1, 0x20(%rsp)
jl 0x546d2
movq %r12, %r13
imulq %rdx, %r13
movl 0x30(%rsp), %eax
movl %eax, %edi
movq %r14, %r15
movq %rbp, %r10
movl 0x38(%rsp), %eax
movl %eax, %r8d
movl 0x40(%rsp), %eax
movl %edi, (%r15)
cltq
leaq (%rax,%r13), %rsi
movl %edi, (%rbx,%rsi,4)
movl %edi, (%r10)
movslq %r8d, %r8
leaq (%r12,%r8), %rsi
movl %edi, (%r9,%rsi,4)
decl %eax
subl %edx, %r8d
addq %r11, %r10
addq $0x4, %r15
leal (%rcx,%rdi), %esi
incl %esi
incl %edi
cmpl $-0x3, %esi
jne 0x546a0
incq %r12
addq $0x4, %rbp
addq %r11, %r14
cmpl %r12d, 0xc(%rsp)
jne 0x5467b
movslq 0x211ca(%rip), %r14     # 0x758b4
testq %r14, %r14
jle 0x54737
leaq 0x1ab0ba4a(%rip), %rax  # 0x1ab60140
xorl %ecx, %ecx
movl $0xf, %edx
movq %rax, %rsi
movl %ecx, %edi
xorl %r8d, %r8d
cmpl %r8d, %ecx
movl %r8d, %r9d
cmoval %ecx, %r9d
addl %edi, %r9d
cmpl $0xf, %r9d
cmovael %edx, %r9d
movl %r9d, (%rsi)
incq %r8
incl %edi
addq $0x4c, %rsi
cmpq %r8, %r14
jne 0x54705
incq %rcx
addq $0x4, %rax
cmpq %r14, %rcx
jne 0x546fd
leaq 0x1aab7812(%rip), %rbx  # 0x1ab0bf50
movl $0xd24, %edx            # imm = 0xD24
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6210
cmpl $-0x1, %r14d
jl 0x5490c
movl %r14d, %r11d
shrl $0x1f, %r11d
addl %r14d, %r11d
sarl %r11d
movq 0x10(%rsp), %rcx
addl %ecx, %r11d
movslq 0x21149(%rip), %r14     # 0x758bc
movq 0x18(%rsp), %rax
addl $0x5, %eax
movslq %eax, %rdx
cmpl %r11d, %ecx
cmovgl %ecx, %r11d
incl %r11d
movq %rdx, %rsi
movq 0x28(%rsp), %rcx
subq %rcx, %rsi
imulq %r14, %rsi
leaq (,%rcx,4), %r8
leaq (%r8,%rsi,4), %rax
addq %rbx, %rax
leaq (,%r14,4), %rdi
movq %rdi, %r10
negq %r10
leaq -0x1(%r14), %r9
imulq %rcx, %r9
leaq (%rbx,%r9,4), %r12
leaq 0x1(%r14), %r9
imulq %rcx, %r9
leaq (%rbx,%r9,4), %r15
leaq (%rsi,%rdx), %r9
shlq $0x2, %rdx
subq %rcx, %r9
leaq (%rbx,%r9,4), %r9
leaq (%rdx,%rsi,4), %r13
subq %r8, %r13
movl %r11d, %r8d
addq %rbx, %r13
movl $0x1, 0xc(%rsp)
movl $0x1, %ebp
movq %r15, %rsi
movq %r12, %rbx
movq %rax, 0x20(%rsp)
movq %rcx, %r11
movq %r13, %rcx
movq 0x20(%rsp), %r13
movl %r8d, 0x4c(%rsp)
movq %r10, 0x50(%rsp)
cmpq 0x28(%rsp), %r11
jl 0x548e1
movq %r11, 0x58(%rsp)
movl 0xc(%rsp), %r8d
movl %r8d, %r8d
movq %r8, 0x20(%rsp)
movq %r12, 0x40(%rsp)
xorl %r11d, %r11d
movq %r9, 0x38(%rsp)
movq %r13, %r8
movq %r15, %r13
movq %rsi, 0x30(%rsp)
movq %rsi, %r15
movq %rbx, 0x60(%rsp)
movq %rax, %r10
movq %r14, %rax
xorl %r14d, %r14d
movq %rbp, %rsi
movq %rcx, %rbp
movq 0x20(%rsp), %rcx
addl %r14d, %ecx
movl %ecx, (%r13,%r14,4)
movl %ecx, (%r12,%rdx)
movl %ecx, (%r15)
movl %ecx, (%r10,%r11,4)
movl %ecx, (%r8,%r14,4)
movl %ecx, (%r9)
movl %ecx, (%rbx,%rdx)
movl %ecx, (%rbp,%r11,4)
movq %rbp, %rcx
movq %rsi, %rbp
incq %r14
addq %rdi, %rbx
addq %rdi, %r15
addq $-0x4, %r9
subq %rax, %r11
addq $-0x4, %r12
cmpl %r14d, %ebp
jne 0x5485b
addl %r14d, 0xc(%rsp)
movl 0x4c(%rsp), %r14d
movq %rax, %r11
movq %r10, %rax
movq 0x50(%rsp), %r10
movq 0x40(%rsp), %r12
movq %r13, %r15
movq 0x38(%rsp), %r9
movq 0x30(%rsp), %rsi
movq 0x60(%rsp), %rbx
movq %r8, %r13
movl %r14d, %r8d
movq %r11, %r14
movq 0x58(%rsp), %r11
incq %r11
addq %r10, %r13
addq $-0x4, %rbx
addq $0x4, %rsi
addq %r10, %r9
addq $-0x4, %rcx
addq $0x4, %rax
addq %rdi, %r12
addq %rdi, %r15
incq %rbp
cmpl %r11d, %r8d
jne 0x54815
movl $0x0, 0x1aab75ea(%rip)  # 0x1ab0bf00
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r12
leal (%r15,%r12), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
cmpl %ecx, %r12d
jg 0x5499a
movl 0x1aab75c8(%rip), %edx  # 0x1ab0bf00
movl 0x20f7e(%rip), %esi     # 0x758bc
movl %r12d, %edi
imull %esi, %edi
addl %r15d, %edi
decl %esi
movl $0x1, %r8d
leaq 0x1ab0c34a(%rip), %r9   # 0x1ab60ca0
movl %r12d, %r10d
movl %eax, %r11d
subl %r10d, %r11d
cmpl %r15d, %r11d
jg 0x54988
movslq %edx, %r11
shlq $0x2, %r11
xorl %ebx, %ebx
leal (%rdi,%rbx), %ebp
leaq (%r11,%rbx,4), %r14
movl %ebp, (%r9,%r14)
incq %rbx
cmpl %ebx, %r8d
jne 0x5496d
addl %ebx, %edx
movl %edx, 0x1aab7578(%rip)  # 0x1ab0bf00
leal 0x1(%r10), %r11d
incq %r8
addq %rsi, %rdi
cmpl %ecx, %r10d
movl %r11d, %r10d
jne 0x54959
movl 0x20f1c(%rip), %eax     # 0x758bc
movl %eax, %ecx
notl %ecx
movl %ecx, 0x1ab0c8a6(%rip)  # 0x1ab61250
movl $0x1, %ecx
subl %eax, %ecx
movl %ecx, 0x1ab0c89d(%rip)  # 0x1ab61254
leal -0x1(%rax), %ecx
movl %ecx, 0x1ab0c898(%rip)  # 0x1ab61258
leal 0x1(%rax), %ecx
movl %ecx, 0x1ab0c893(%rip)  # 0x1ab6125c
movl %ecx, %edx
imull %r12d, %edx
movl %edx, 0x1ab0c89b(%rip)  # 0x1ab61270
movl %eax, %esi
imull %r15d, %esi
leal (%rsi,%r12), %edi
movl %edi, 0x1ab0c88f(%rip)  # 0x1ab61274
movl %eax, %r8d
imull %r12d, %r8d
leal (%r8,%r15), %r9d
movl %r9d, 0x1ab0c881(%rip)  # 0x1ab61278
imull %r15d, %ecx
movl %ecx, 0x1ab0c87b(%rip)  # 0x1ab6127c
leal 0x1(%rdx), %r10d
movl %r10d, 0x1ab0c874(%rip) # 0x1ab61280
addl %eax, %edx
movl %edx, 0x1ab0c870(%rip)  # 0x1ab61284
subl %eax, %edi
movl %edi, 0x1ab0c86c(%rip)  # 0x1ab61288
leal (%rsi,%r12), %edx
incl %edx
movl %edx, 0x1ab0c864(%rip)  # 0x1ab6128c
leal (%r8,%r15), %edx
decl %edx
movl %edx, 0x1ab0c85c(%rip)  # 0x1ab61290
addl %eax, %r9d
movl %r9d, 0x1ab0c856(%rip)  # 0x1ab61294
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x1ab0c850(%rip)  # 0x1ab61298
decl %ecx
movl %ecx, 0x1ab0c84c(%rip)  # 0x1ab6129c
callq 0x540e3
callq 0x54127
xorl %eax, %eax
leaq 0x1aad9c7d(%rip), %rcx  # 0x1ab2e6e0
movl %eax, %esi
notl %esi
movb $0x1, %dl
testl $0x1144, %esi           # imm = 0x1144
je 0x54a7f
movl %eax, %esi
notl %esi
movb $0x2, %dl
testl $0x2288, %esi           # imm = 0x2288
jne 0x54a82
movb %dl, (%rax,%rcx)
incq %rax
cmpq $0x10000, %rax          # imm = 0x10000
jne 0x54a63
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq