// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/board/GoBoard.cpp
// Function: InitializeBoard(game_info_t*)
void
InitializeBoard( game_info_t *game )
{
  memset(game->record, 0, sizeof(record_t) * MAX_RECORDS);
  memset(game->pat,    0, sizeof(pattern_t) * board_max);

  std::fill_n(game->board, board_max, 0);
  std::fill_n(game->update_num, 2, 0);
  std::fill_n(game->capture_num, 2, 0);
  std::fill_n(game->capture_dir, 2, 0);
  std::fill(game->update_pos[0], game->update_pos[2], 0);
  std::fill(game->capture_pos[0], game->capture_pos[2], 0);
  std::fill_n(game->tactical_features, board_max * ALL_MAX, 0);

  game->capture_pos[0][0] = game->capture_pos[1][0] = CAPTURE_END;
  
  game->current_hash = 0;
  game->previous1_hash = 0;
  game->previous2_hash = 0;
  game->positional_hash = 0;
  game->move_hash = 0;

  SetKomi(default_komi);

  game->moves = 1;

  game->pass_count = 0;

  std::fill_n(game->candidates, BOARD_MAX, false);

  for (int y = 0; y < board_size; y++){
    for (int x = 0; x < OB_SIZE; x++) {
      game->board[POS(x, y)] = S_OB;
      game->board[POS(y, x)] = S_OB;
      game->board[POS(y, board_size - 1 - x)] = S_OB;
      game->board[POS(board_size - 1 - x, y)] = S_OB;
    }
  }

  for (int y = board_start; y <= board_end; y++) {
    for (int x = board_start; x <= board_end; x++) {
      game->candidates[POS(x, y)] = true;
    }
  }

  for (int i = 0; i < MAX_STRING; i++) {
    game->string[i].flag = false;
  }

  ClearPattern(game->pat);

  InitializeNeighbor();
  InitializeEye();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x43b0, %edx           # imm = 0x43B0
xorl %esi, %esi
callq 0x6210
leaq 0x4748(%rbx), %rdi
movslq 0x21a05(%rip), %r12     # 0x758b8
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %rdx
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x6210
leaq 0x43f8(%rbx), %r15
testq %r12, %r12
jle 0x53ee3
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x6210
movq $0x0, 0x99cf8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x98728(%rbx)
leaq 0x99d00(%rbx), %rdi
movl $0xb48, %edx            # imm = 0xB48
xorl %esi, %esi
callq 0x6210
leaq 0x98738(%rbx), %rdi
movl $0x15c0, %edx           # imm = 0x15C0
xorl %esi, %esi
callq 0x6210
movl 0x21994(%rip), %eax     # 0x758b8
testl %eax, %eax
jle 0x53f3d
addq %rax, %rax
leaq (%rax,%rax,2), %rdx
leaq 0x97372(%rbx), %rdi
xorl %esi, %esi
callq 0x6210
movl $0x2b7, %eax            # imm = 0x2B7
movl %eax, 0x99218(%rbx)
movl %eax, 0x98738(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x43d0(%rbx)
movups %xmm0, 0x43e0(%rbx)
movq $0x0, 0x43f0(%rbx)
movsd 0x21956(%rip), %xmm0    # 0x758c8
movsd %xmm0, 0x1aab7fb6(%rip) # 0x1ab0bf30
movsd %xmm0, 0x1aab7f8e(%rip) # 0x1ab0bf10
movsd 0x907e(%rip), %xmm1     # 0x5d008
addsd %xmm0, %xmm1
movsd %xmm1, 0x1aab7fa2(%rip) # 0x1ab0bf38
movsd %xmm1, 0x1aab7f7a(%rip) # 0x1ab0bf18
addsd 0xaeca(%rip), %xmm0     # 0x5ee70
movsd %xmm0, 0x1aab7f92(%rip) # 0x1ab0bf40
movsd %xmm0, 0x1aab7f6a(%rip) # 0x1ab0bf20
movl $0x1, 0x43b0(%rbx)
movl $0x0, 0x4744(%rbx)
leaq 0x96ce0(%rbx), %r12
xorl %r13d, %r13d
movl $0x349, %edx            # imm = 0x349
movq %r12, %rdi
xorl %esi, %esi
callq 0x6210
movl 0x218d3(%rip), %ebp     # 0x758bc
testl %ebp, %ebp
jle 0x54071
movl $0x1, %eax
movb $0x3, %cl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movslq %r13d, %rsi
xorl %edi, %edi
movslq 0x218b3(%rip), %r8      # 0x758bc
imulq %rsi, %r8
addq %r15, %r8
movb %cl, (%rdi,%r8)
movl 0x218a1(%rip), %r8d     # 0x758bc
imull %edi, %r8d
addl %r13d, %r8d
movslq %r8d, %r8
movb %cl, (%r15,%r8)
movl 0x2188c(%rip), %r8d     # 0x758bc
leal (%rdx,%r8), %r9d
imull %r8d, %r9d
addl %r13d, %r9d
movslq %r9d, %r8
movb %cl, (%r15,%r8)
movl 0x21873(%rip), %r8d     # 0x758bc
imull %eax, %r8d
addl %edx, %r8d
movslq %r8d, %r8
movb %cl, (%r15,%r8)
incq %rdi
decl %edx
cmpl $0x5, %edi
jne 0x54002
incl %r13d
movl 0x21852(%rip), %ebp     # 0x758bc
incl %eax
cmpl %ebp, %r13d
jl 0x53ff8
movl 0x21848(%rip), %r13d    # 0x758c0
movl 0x21845(%rip), %r14d    # 0x758c4
subl %r13d, %r14d
jl 0x540ae
leal 0x1(%rbp), %eax
imull %eax, %r13d
leaq 0x1(%r14), %r15
incl %r14d
movslq %r13d, %r13
leaq (%r12,%r13), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x6210
addl %ebp, %r13d
decl %r14d
jne 0x54092
movl $0x9de4, %eax           # imm = 0x9DE4
movb $0x0, (%rbx,%rax)
addq $0x7c8, %rax            # imm = 0x7C8
cmpq $0x95ee4, %rax          # imm = 0x95EE4
jne 0x540b3
movq (%rsp), %rdi
callq 0x4d75c
callq 0x540e3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x54127