// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movl %edx, 0xc(%rsp)
movq %rdi, 0x10(%rsp)
cmpb $0x1, 0x1aa93126(%rip)  # 0x1aac693c
jne 0x3392b
movl %esi, 0x8(%rsp)
leaq 0x1aabd5a9(%rip), %r15  # 0x1aaf0dd0
xorl %r14d, %r14d
leaq 0x2e087(%rip), %rbx     # 0x618b8
movslq (%rbx), %rsi
cmpq %rsi, %r14
jge 0x3384a
movq %r15, %rdi
callq 0x35010
incq %r14
addq $0x10, %r15
jmp 0x33831
xorl %r14d, %r14d
xorl %eax, %eax
xchgl %eax, 0x1aac0a0b(%rip)  # 0x1aaf4260
leaq 0x24(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x1aac0a0c(%rip), %rdi  # 0x1aaf4270
callq 0x355fe
movl (%rbx), %eax
testl %eax, %eax
cmovlel %r14d, %eax
shlq $0x3, %rax
leaq 0x1aac1724(%rip), %rcx  # 0x1aaf4fa0
movl 0x8(%rsp), %ebx
cmpq %r14, %rax
je 0x33890
andq $0x0, (%r14,%rcx)
addq $0x8, %r14
jmp 0x33880
callq 0x35c40
leaq 0x2e014(%rip), %rax     # 0x618b0
movl (%rax), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
leaq 0x1ab18e44(%rip), %rdx  # 0x1ab4c6f0
leaq 0x1aaba84d(%rip), %rsi  # 0x1aaee100
movabsq $0x4049000000000000, %rdi # imm = 0x4049000000000000
leaq 0x1aabc28c(%rip), %r8   # 0x1aaefb50
leaq 0x1aabcfb5(%rip), %r9   # 0x1aaf0880
movq 0x10(%rsp), %r14
cmpq %rcx, %rax
je 0x338ef
movslq (%rdx,%rcx,4), %r10
movq %rdi, (%rsi,%r10,8)
movl $0x5, (%r8,%r10,4)
movb $0x1, (%r10,%r9)
incq %rcx
jmp 0x338d0
movq %r14, %rdi
movl %ebx, %esi
callq 0x3331c
movl %eax, 0x1aa93039(%rip)  # 0x1aac6938
movb $0x0, 0x1aabd2c3(%rip)  # 0x1aaf0bc9
movq 0x1aa93023(%rip), %rsi  # 0x1aac6930
cltq
imulq $0x4548, %rax, %rax     # imm = 0x4548
cmpl $0x2, 0x18(%rsi,%rax)
jge 0x3393a
movb $0x0, 0x1aabd2a7(%rip)  # 0x1aaf0bcb
movb $0x1, 0x1aabd29f(%rip)  # 0x1aaf0bca
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x1aabd28a(%rip)  # 0x1aaf0bcb
movb $0x0, 0x1aabd282(%rip)  # 0x1aaf0bca
addq %rax, %rsi
movq %r14, %rdi
movl %ebx, %edx
callq 0x3d2f5
leaq 0x1aabd274(%rip), %rbp  # 0x1aaf0bd0
leaq 0x1aac308d(%rip), %r14  # 0x1aaf69f0
xorl %r15d, %r15d
leaq 0x72(%rip), %r12        # 0x339df
leaq 0x18(%rsp), %r13
movslq 0x2deff(%rip), %rax     # 0x61878
cmpq %rax, %r15
jge 0x3392b
movl %r15d, 0x8(%r14)
movq 0x10(%rsp), %rax
movq %rax, (%r14)
movl %ebx, 0xc(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x10(%r14)
pushq $0x8
popq %rdi
callq 0x63e0
movq %rax, %rbx
movq %r14, 0x18(%rsp)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x35024
movq %rbx, (%rbp)
incq %r15
addq $0x8, %rbp
addq $0x18, %r14
movl 0x8(%rsp), %ebx
jmp 0x33972
movq %rax, %r14
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x63f0
movq %r14, %rdi
callq 0x6740