// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/UctRating.cpp
// Function: AnalyzeUctRating(game_info_t*, int, double*)
void
AnalyzeUctRating( game_info_t *game, int color, double rate[] )
{
  const int moves = game->moves;
  unsigned int tactical_features[BOARD_MAX * UCT_INDEX_MAX] = {0};  
  const int distance_index = CheckFeaturesForTree(game, color, tactical_features);

  CheckRemove2StonesForTree(game, color, tactical_features);
  if (moves > 2 && game->ko_move == moves - 2) {
    CheckCaptureAfterKoForTree(game, color, tactical_features);
    CheckKoConnectionForTree(game, tactical_features);
  } else if (moves > 3 && game->ko_move == moves - 3) {
    CheckKoRecaptureForTree(game, color, tactical_features);
  }

  for (int i = 0; i < pure_board_max; i++) {
    const int pos = onboard_pos[i];
    if (IsLegal(game, pos, color)) {
      CheckSelfAtariForTree(game, color, pos, tactical_features);
      CheckCaptureForTree(game, color, pos, tactical_features);
      CheckAtariForTree(game, color, pos, tactical_features);

      rate[i] = CalculateMoveScoreWithBTFM(game, pos, tactical_features, distance_index);
    } else {
      rate[i] = 0.0;
    }
  }
  rate[pure_board_max] = CalculateMoveScoreWithBTFM(game, PASS, tactical_features, distance_index);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5c18, %rsp           # imm = 0x5C18
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl 0x43b0(%rdi), %r15d
leaq 0x10(%rsp), %r12
movl $0x5bfc, %edx           # imm = 0x5BFC
movq %r12, %rdi
xorl %esi, %esi
callq 0x6200
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x59fc0
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x5b56e
cmpl $0x3, %r15d
jl 0x49b73
movl 0x43c8(%r14), %eax
leal -0x2(%r15), %ecx
cmpl %ecx, %eax
jne 0x49b4d
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x5b0d4
movq %r14, %rdi
movq %r12, %rsi
callq 0x5b4db
jmp 0x49b73
cmpl $0x3, %r15d
setne %cl
addl $-0x3, %r15d
cmpl %r15d, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x49b73
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %esi
callq 0x5b50f
leaq 0x2cd36(%rip), %rax     # 0x768b0
cmpl $0x0, (%rax)
jle 0x49c04
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
leaq 0x1ab17b5e(%rip), %rax  # 0x1ab616f0
movl (%rax,%r15,4), %r13d
movq %r14, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x55478
xorps %xmm0, %xmm0
testb %al, %al
je 0x49bec
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5b165
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5b391
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5b454
movq %r14, %rdi
movl %r13d, %esi
movq %r12, %rdx
movl 0xc(%rsp), %ecx
callq 0x49374
movsd %xmm0, (%rbx,%r15,8)
incq %r15
leaq 0x2ccb4(%rip), %rax     # 0x768b0
movslq (%rax), %rax
cmpq %rax, %r15
jl 0x49b8b
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
movl 0xc(%rsp), %ecx
callq 0x49374
leaq 0x2cc92(%rip), %rax     # 0x768b0
movslq (%rax), %rax
movsd %xmm0, (%rbx,%rax,8)
addq $0x5c18, %rsp           # imm = 0x5C18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq