// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/UctSearch.cpp
// Function: UctSearchPondering(game_info_t*, int, int)
void
UctSearchPondering( game_info_t *game, int color, int lz_analysis_cs )
{
  if (!pondering_mode) {
    return;
  }

  // 探索情報をクリア
  for (int i = 0; i < board_max; i++) {
    statistic[i].clear();
  }
  statistic_count = 0;
  std::fill_n(criticality_index, board_max, 0);  
  for (int i = 0; i < board_max; i++) {
    criticality[i] = 0.0;    
  }

  ResetPoCount();

  for (int i = 0; i < pure_board_max; i++) {
    const int pos = onboard_pos[i];
    owner[pos] = 50;
    owner_index[pos] = 5;
    candidates[pos] = true;
  }

  // UCTの初期化
  current_root = ExpandRoot(game, color);

  pondered = false;

  // 子ノードが1つ(パスのみ)ならPASSを返す
  if (uct_node[current_root].child_num <= 1) {
    ponder = false;
    pondering_stop = true;
    return;
  }

  ponder = true;
  pondering_stop = false;

  // Dynamic Komiの算出(置碁のときのみ)
  DynamicKomi(game, &uct_node[current_root], color);

  for (int i = 0; i < threads; i++) {
    t_arg[i].thread_id = i;
    t_arg[i].game = game;
    t_arg[i].color = color;
    t_arg[i].lz_analysis_cs = lz_analysis_cs;
    worker[i] = new std::thread(ParallelUctSearchPondering, &t_arg[i]);
  }

  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x4(%rsp)
cmpb $0x1, 0x1aa905da(%rip)  # 0x1aadb93c
jne 0x4b518
movl %esi, %r13d
movq %rdi, 0x8(%rsp)
leaq 0x2b541(%rip), %rax     # 0x768b8
movslq (%rax), %r15
testq %r15, %r15
jle 0x4b3d9
leaq 0x1aabaa4a(%rip), %rax  # 0x1ab05dd0
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
xchgl %esi, (%rax,%rdx,4)
incq %rdx
cmpq $0x4, %rdx
jne 0x4b38a
incq %rcx
addq $0x10, %rax
cmpq %r15, %rcx
jb 0x4b388
xorl %eax, %eax
xchgl %eax, 0x1aabdeb4(%rip)  # 0x1ab09260
leaq (,%r15,4), %rdx
leaq 0x1aabdeb5(%rip), %rdi  # 0x1ab09270
xorl %esi, %esi
callq 0x6200
shlq $0x3, %r15
leaq 0x1aabebd3(%rip), %rdi  # 0x1ab09fa0
xorl %esi, %esi
movq %r15, %rdx
callq 0x6200
jmp 0x4b3e1
xorl %eax, %eax
xchgl %eax, 0x1aabde7f(%rip)  # 0x1ab09260
callq 0x4d8d9
leaq 0x2b4c3(%rip), %rax     # 0x768b0
movslq (%rax), %rax
testq %rax, %rax
movq 0x8(%rsp), %r15
jle 0x4b43f
xorl %ecx, %ecx
leaq 0x1ab162ed(%rip), %rdx  # 0x1ab616f0
leaq 0x1aab7cf6(%rip), %rsi  # 0x1ab03100
movabsq $0x4049000000000000, %rdi # imm = 0x4049000000000000
leaq 0x1aab9735(%rip), %r8   # 0x1ab04b50
leaq 0x1aaba45e(%rip), %r9   # 0x1ab05880
movslq (%rdx,%rcx,4), %r10
movq %rdi, (%rsi,%r10,8)
movl $0x5, (%r8,%r10,4)
movb $0x1, (%r10,%r9)
incq %rcx
cmpq %rcx, %rax
jne 0x4b422
movq %r15, %rdi
movl %r13d, %esi
callq 0x4addf
movl %eax, 0x1aa904e8(%rip)  # 0x1aadb938
movb $0x0, 0x1aaba772(%rip)  # 0x1ab05bc9
movq 0x1aa904d2(%rip), %rsi  # 0x1aadb930
cltq
imulq $0x4548, %rax, %rax     # imm = 0x4548
cmpl $0x2, 0x18(%rsi,%rax)
jge 0x4b481
movb $0x0, 0x1aaba756(%rip)  # 0x1ab05bcb
movb $0x1, 0x1aaba74e(%rip)  # 0x1ab05bca
jmp 0x4b518
movb $0x1, 0x1aaba743(%rip)  # 0x1ab05bcb
movb $0x0, 0x1aaba73b(%rip)  # 0x1ab05bca
addq %rax, %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x56d15
cmpl $0x0, 0x2b3d4(%rip)     # 0x76878
jle 0x4b518
leaq 0x1aaba723(%rip), %rbx  # 0x1ab05bd0
leaq 0x1aac053c(%rip), %rbp  # 0x1ab0b9f0
xorl %r14d, %r14d
leaq 0x10(%rsp), %r12
movl %r14d, 0x8(%rbp)
movq %r15, (%rbp)
movl %r13d, %r15d
movl %r13d, 0xc(%rbp)
movl 0x4(%rsp), %eax
movl %eax, 0x10(%rbp)
movl $0x8, %edi
callq 0x6400
movq %rax, %r13
movq %rbp, 0x10(%rsp)
movq %rax, %rdi
leaq 0x51(%rip), %rsi        # 0x4b53f
movq %r12, %rdx
callq 0x4ccd8
movq %r13, (%rbx)
incq %r14
movslq 0x2b375(%rip), %rax     # 0x76878
addq $0x8, %rbx
addq $0x18, %rbp
cmpq %rax, %r14
movl %r15d, %r13d
movq 0x8(%rsp), %r15
jl 0x4b4bc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x8, %esi
movq %r13, %rdi
callq 0x6410
movq %rbx, %rdi
callq 0x6760