// File: /workspace/github_cpp_makefile_star2_O3/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 0x6200
leaq 0x4748(%rbx), %rdi
movslq 0x224bf(%rip), %r14     # 0x768b8
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %rdx
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x6200
leaq 0x43f8(%rbx), %r15
movl %r14d, %r12d
testq %r14, %r14
jle 0x5442c
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x6200
leaq 0x98728(%rbx), %rdi
movl $0x2120, %edx           # imm = 0x2120
xorl %esi, %esi
callq 0x6200
testl %r12d, %r12d
jle 0x54459
addq %r12, %r12
leaq (%r12,%r12,2), %rdx
leaq 0x97372(%rbx), %rdi
xorl %esi, %esi
callq 0x6200
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 0x2243a(%rip), %xmm0    # 0x768c8
movsd %xmm0, 0x1aab8a9a(%rip) # 0x1ab0cf30
movsd %xmm0, 0x1aab8a72(%rip) # 0x1ab0cf10
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd 0xc9c6(%rip), %xmm0     # 0x60e70
movupd %xmm0, 0x1aab8a86(%rip) # 0x1ab0cf38
movupd %xmm0, 0x1aab8a5e(%rip) # 0x1ab0cf18
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 0x6200
movl 0x223cf(%rip), %ebp     # 0x768bc
testl %ebp, %ebp
jle 0x54575
movl $0x1, %eax
movb $0x3, %cl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movslq %r13d, %rsi
xorl %edi, %edi
movslq 0x223af(%rip), %r8      # 0x768bc
imulq %rsi, %r8
addq %r15, %r8
movb %cl, (%rdi,%r8)
movl 0x2239d(%rip), %r8d     # 0x768bc
imull %edi, %r8d
addl %r13d, %r8d
movslq %r8d, %r8
movb %cl, (%r15,%r8)
movl 0x22388(%rip), %r8d     # 0x768bc
leal (%rdx,%r8), %r9d
imull %r8d, %r9d
addl %r13d, %r9d
movslq %r9d, %r8
movb %cl, (%r15,%r8)
movl 0x2236f(%rip), %r8d     # 0x768bc
imull %eax, %r8d
addl %edx, %r8d
movslq %r8d, %r8
movb %cl, (%r15,%r8)
incq %rdi
decl %edx
cmpl $0x5, %edi
jne 0x54506
incl %r13d
movl 0x2234e(%rip), %ebp     # 0x768bc
incl %eax
cmpl %ebp, %r13d
jl 0x544fc
movl 0x22344(%rip), %r13d    # 0x768c0
movl 0x22341(%rip), %r14d    # 0x768c4
subl %r13d, %r14d
jl 0x545b2
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 0x6200
addl %ebp, %r13d
decl %r14d
jne 0x54596
movl $0x9de4, %eax           # imm = 0x9DE4
movb $0x0, (%rbx,%rax)
addq $0x7c8, %rax            # imm = 0x7C8
cmpq $0x95ee4, %rax          # imm = 0x95EE4
jne 0x545b7
movq (%rsp), %rdi
callq 0x4da8c
callq 0x545ea
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x547ce