LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/MovePredictionTest.cpp
// Function: EvaluateMovePrediction()
void
EvaluateMovePrediction( void )
{
  std::thread *workers[TEST_WORKER_THREADS];

  for (int i = 0; i < TEST_WORKER_THREADS; i++) {
    workers[i] = new std::thread(PredictionTestWorker, i);
  }

  int sum = 0;

  for (int i = 0; i < TEST_WORKER_THREADS; i++) {
    workers[i]->join();
    delete workers[i];
  }
  

  for (int i = 0; i < pure_board_max + 1; i++) {
    sum += appearance[i];
  }

  for (int i = 0, part = 0; i < 10; i++) {
    part += appearance[i];
    std::cout << i + 1 << " " << static_cast<double>(part) / sum << std::endl;
    std::cerr << i + 1 << " " << appearance[i] << std::endl;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x4(%rsp), %rbx
movl $0x0, (%rbx)
leaq 0x1b6(%rip), %r14       # 0x4202a
movl $0x8, %edi
callq 0x6410
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x42682
movslq 0x4(%rsp), %rax
leal 0x1(%rax), %ecx
movq %r15, 0x10(%rsp,%rax,8)
movl %ecx, 0x4(%rsp)
cmpq $0x7, %rax
jl 0x41e74
xorl %r14d, %r14d
movq 0x10(%rsp,%r14,8), %rbx
movq %rbx, %rdi
callq 0x6720
cmpq $0x0, (%rbx)
jne 0x4200d
movl $0x8, %esi
movq %rbx, %rdi
callq 0x6420
incq %r14
cmpq $0x8, %r14
jne 0x41ea9
leaq 0x339d3(%rip), %rax     # 0x758b0
cmpl $0x0, (%rax)
js 0x41f0b
xorl %ecx, %ecx
movq $-0x1, %rdx
leaq 0x3719e(%rip), %rsi     # 0x79090
movl (%rsi), %edi
addl %edi, %ecx
movslq (%rax), %rdi
incq %rdx
addq $0x4, %rsi
cmpq %rdi, %rdx
jl 0x41ef2
cvtsi2sd %ecx, %xmm0
jmp 0x41f0f
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
movl $0x1, %ebx
leaq 0x3716d(%rip), %r14     # 0x79090
leaq 0x1b6d6(%rip), %r15     # 0x5d600
xorl %r12d, %r12d
movl (%rbp,%r14), %eax
addl %eax, %r12d
movq 0x3306c(%rip), %rdi     # 0x74fa8
movl %ebx, %esi
callq 0x6740
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x64a0
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
divsd 0x8(%rsp), %xmm0
movq %r13, %rdi
callq 0x66a0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x3304b(%rip), %rdi     # 0x74fe8
movl %ebx, %esi
callq 0x6740
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x64a0
movl (%rbp,%r14), %esi
movq %r13, %rdi
callq 0x6740
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
addq $0x4, %rbp
incl %ebx
cmpq $0x28, %rbp
jne 0x41f2d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x60b0
movq %rax, %rbx
movl $0x8, %esi
movq %r15, %rdi
callq 0x6420
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: OutputGamma(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<mm_t, std::allocator<mm_t>> const&)
void
OutputGamma( const std::string filename, const std::vector<mm_t> &data )
{
  std::ofstream ofs(filename, std::ios::out);

  if (!ofs) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  for (const mm_t &datum : data) {
    ofs << std::scientific << datum.gamma << "\n";
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x6820
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rsp,%rax)
je 0x427d5
movq 0x32877(%rip), %rdi     # 0x74fe8
leaq 0x1d4f0(%rip), %rsi     # 0x5fc68
movl $0xd, %edx
callq 0x64a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x32858(%rip), %rdi     # 0x74fe8
callq 0x64a0
movq %rax, %rbx
leaq 0x1b4ee(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x4282f
movq (%r14), %r15
movq 0x8(%r14), %r12
cmpq %r12, %r15
je 0x4282f
movl $0xfffffefb, %ebp       # imm = 0xFFFFFEFB
movq %rsp, %rbx
leaq 0x1dd55(%rip), %r14     # 0x60545
movq (%rsp), %rax
movq -0x18(%rax), %rax
movl 0x18(%rsp,%rax), %ecx
andl %ebp, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%rsp,%rax)
movsd 0x18(%r15), %xmm0
movq %rbx, %rdi
callq 0x66a0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x64a0
addq $0x20, %r15
cmpq %r12, %r15
jne 0x427f0
movq 0x32732(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x6340
leaq 0xf8(%rsp), %rdi
callq 0x60f0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x42872
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: OutputGamma(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<mm_t, std::allocator<mm_t>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&)
void
OutputGamma( const std::string filename, const std::vector<mm_t> &data, const std::vector<unsigned int> &index_list )
{
  std::ofstream ofs(filename, std::ios::out);

  if (!ofs) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  const std::size_t data_size = data.size();

  for (std::size_t i = 0; i < data_size; i++) {
    if (data[i].gamma != 1.0) {
      ofs << index_list[i] << "\t" << std::scientific << data[i].gamma << "\n";
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x6820
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
je 0x42931
movq 0x3271e(%rip), %rdi     # 0x74fe8
leaq 0x1d397(%rip), %rsi     # 0x5fc68
movl $0xd, %edx
callq 0x64a0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x326ff(%rip), %rdi     # 0x74fe8
callq 0x64a0
movq %rax, %rbx
leaq 0x1b395(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x429de
movq 0x8(%r14), %r15
subq (%r14), %r15
je 0x429de
sarq $0x5, %r15
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %r12d, %r12d
leaq 0x1dbf1(%rip), %r13     # 0x60545
movq (%r14), %rax
movsd 0x18(%rax,%r12,8), %xmm0
ucomisd 0x1a6a2(%rip), %xmm0    # 0x5d008
jne 0x4296a
jnp 0x429d1
movq (%rbx), %rax
movl (%rax,%r12), %esi
leaq 0x8(%rsp), %rdi
callq 0x6290
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1d3a9(%rip), %rsi     # 0x5fd36
callq 0x64a0
movq (%rbp), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbp,%rax), %ecx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl %edx, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%rbp,%rax)
movq (%r14), %rax
movsd 0x18(%rax,%r12,8), %xmm0
movq %rbp, %rdi
callq 0x66a0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x64a0
addq $0x4, %r12
decq %r15
jne 0x42954
movq 0x32583(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x10(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x8(%rsp,%rcx)
callq 0x6340
leaq 0x100(%rsp), %rdi
callq 0x60f0
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x42a24
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: OutputBTFMParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<btfm_t, std::allocator<btfm_t>> const&)
void
OutputBTFMParameter( const std::string filename, const std::vector<btfm_t> &data )
{
  std::ofstream ofs(filename, std::ios::out);

  if (!ofs) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  for (const btfm_t &datum : data) {
    ofs << std::scientific << datum.w;
    for (int k = 0; k < FM_DIMENSION; k++) {
      ofs << " " << std::scientific << datum.v[k];
    }
    ofs << "\n";
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x6820
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
je 0x42ae1
movq 0x3256e(%rip), %rdi     # 0x74fe8
leaq 0x1d1e7(%rip), %rsi     # 0x5fc68
movl $0xd, %edx
callq 0x64a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x3254f(%rip), %rdi     # 0x74fe8
callq 0x64a0
movq %rax, %rbx
leaq 0x1b1e5(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x42b93
movq (%r14), %r12
movq 0x8(%r14), %r13
cmpq %r13, %r12
je 0x42b93
movl $0xfffffefb, %ebp       # imm = 0xFFFFFEFB
leaq 0x8(%rsp), %rbx
leaq 0x1aafe(%rip), %r14     # 0x5d600
movq 0x8(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x20(%rsp,%rax), %ecx
andl %ebp, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x20(%rsp,%rax)
movsd (%r12), %xmm0
movq %rbx, %rdi
callq 0x66a0
movl $0x1, %r15d
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64a0
movq 0x8(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x20(%rsp,%rax), %ecx
andl %ebp, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x20(%rsp,%rax)
movsd (%r12,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x66a0
incq %r15
cmpq $0x6, %r15
jne 0x42b2f
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1d9c7(%rip), %rsi     # 0x60545
callq 0x64a0
addq $0x218, %r12            # imm = 0x218
cmpq %r13, %r12
jne 0x42b02
movq 0x323ce(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x10(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x8(%rsp,%rcx)
callq 0x6340
leaq 0x100(%rsp), %rdi
callq 0x60f0
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x42bdb
jmp 0x42bdb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: OutputGammaAdditionMode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, mm_t const&)
void
OutputGammaAdditionMode( const std::string filename, const mm_t &datum )
{
  std::ofstream ofs(filename, std::ios::app);

  if (!ofs) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  ofs << std::scientific << datum.gamma << "\n";
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x6820
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rsp,%rax)
je 0x431aa
movq 0x31ea2(%rip), %rdi     # 0x74fe8
leaq 0x1cb1b(%rip), %rsi     # 0x5fc68
movl $0xd, %edx
callq 0x64a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x31e83(%rip), %rdi     # 0x74fe8
callq 0x64a0
movq %rax, %rbx
leaq 0x1ab19(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x431df
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x18(%rsp,%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%rsp,%rax)
movsd 0x18(%r14), %xmm0
movq %rsp, %rdi
callq 0x66a0
leaq 0x1d373(%rip), %rsi     # 0x60545
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq 0x31d82(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x6340
leaq 0xf8(%rsp), %rdi
callq 0x60f0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: GetUniquePattern(unsigned int*, int)
int
GetUniquePattern( unsigned int pattern[], const int array_size )
{
  int size = 0;

  for (int i = 0; i < array_size; i++) {
    bool is_unique = true;
    for (int j = 0; j < size; j++) {
      if (pattern[i] == pattern[j]) {
        is_unique = false;
        break;
      }
    }
    if (is_unique) {
      pattern[size++] = pattern[i];
    }
  }

  return size;
}

// Assembly:
testl %esi, %esi
jle 0x436c8
movl %esi, %ecx
xorl %edx, %edx
xorl %eax, %eax
testl %eax, %eax
jle 0x436b3
movl (%rdi,%rdx,4), %esi
movl %eax, %r8d
xorl %r9d, %r9d
cmpl (%rdi,%r9,4), %esi
je 0x436bf
incq %r9
cmpq %r9, %r8
jne 0x436a5
movl (%rdi,%rdx,4), %esi
movslq %eax, %r8
incl %eax
movl %esi, (%rdi,%r8,4)
incq %rdx
cmpq %rcx, %rdx
jne 0x43698
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: TrimRightSpace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string
TrimRightSpace( const std::string &src )
{
  std::string trimCharacters = " 　";
  size_t pos = src.find_last_not_of(trimCharacters);
  std::string dst = src.substr(0, pos + 1);
  return dst;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c659(%rip), %rsi     # 0x5fd46
leaq 0x1c656(%rip), %rdx     # 0x5fd4a
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x2030e
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq $-0x1, %rdx
callq 0x66c0
leaq 0x1(%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6450
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4373f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6420
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x43768
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6420
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/PatternAnalyzer.cpp
// Function: Count(std::unique_ptr<hash_table_t, std::default_delete<hash_table_t>>&, unsigned long long, pattern_t*)
static void
Count( std::unique_ptr<hash_table_t> &hash_table, unsigned long long hash, pattern_t *pat )
{
  const int key = SearchData(hash_table, hash);

  if (key == -1) {
    if (hash_table->num >= HASH_TABLE_LIMIT) {
      RemoveData(hash_table);
    }
    AddData(hash_table, hash, pat);
  } else {
    hash_table->data[key].count++;
  }
}

// Assembly:
pushq %rax
movq %rsi, %rcx
shrq $0x20, %rcx
xorl %esi, %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
movq (%rdi), %rax
xorl %r9d, %r9d
movl %ecx, %r8d
movl %r8d, %edi
leaq (%rdi,%rdi,2), %r10
shlq $0x4, %r10
movl 0x28(%rax,%r10), %r11d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl $0x1, %r11d
je 0x44d1d
testl %r11d, %r11d
jne 0x44d25
jmp 0x44d3d
addq %rax, %r10
cmpq %rsi, (%r10)
je 0x44d3a
incl %r8d
cmpl $0x1000000, %r8d        # imm = 0x1000000
cmovael %r9d, %r8d
cmpl %ecx, %r8d
jne 0x44cfb
jmp 0x44d3d
movl %r8d, %edi
cmpl $-0x1, %edi
je 0x44d5a
movslq %edi, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdi
addq $0x20, %rdi
jmp 0x44e2d
leaq 0x30000000(%rax), %rdi
movl 0x30000000(%rax), %r8d
movl %ecx, %r9d
cmpl $0xf42400, %r8d         # imm = 0xF42400
jl 0x44dbc
movl $0x1, %r9d
movl $0x28, %r10d
cmpl $0x1, (%rax,%r10)
jne 0x44da0
cmpl %r9d, -0x8(%rax,%r10)
jg 0x44da0
movl $0x2, (%rax,%r10)
decl %r8d
movl %r8d, 0x30000000(%rax)
addq $0x30, %r10
cmpq $0x30000028, %r10       # imm = 0x30000028
jne 0x44d80
incl %r9d
cmpl $0x800000, %r8d         # imm = 0x800000
jge 0x44d7a
movl %ecx, %r9d
movl %r9d, %r8d
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
testl $0xfffffffd, 0x28(%rax,%r8) # imm = 0xFFFFFFFD
je 0x44dee
incl %r9d
xorl %r8d, %r8d
cmpl $0x1000000, %r9d        # imm = 0x1000000
cmovael %r8d, %r9d
cmpl %ecx, %r9d
jne 0x44dbc
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
cmpl $-0x1, %r9d
je 0x44e31
movslq %r9d, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq %rsi, (%rax,%rcx)
movl (%rdx), %esi
movl %esi, 0x8(%rax,%rcx)
movl 0x4(%rdx), %esi
movl %esi, 0xc(%rax,%rcx)
movl 0x8(%rdx), %esi
movl %esi, 0x10(%rax,%rcx)
movq 0x10(%rdx), %rdx
movq %rdx, 0x18(%rax,%rcx)
movl $0x1, %edx
movl %edx, 0x20(%rax,%rcx)
movl %edx, 0x28(%rax,%rcx)
incl (%rdi)
popq %rax
retq
movl $0x1, %edi
callq 0x64f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/learn/LearningLog.cpp
// Function: OutputLearningLogFile(int, int, double)
void
OutputLearningLogFile( const int update_steps, const int all_moves, const double consume_time )
{
  std::ofstream ofs(learning_log_file_path, std::ios::app);

  if (!ofs) {
    std::cerr << "Training log file open error." << std::endl;
    std::cerr << update_steps << ", all_moves : " << all_moves << ", run_time : " << consume_time << " seconds" << std::endl;
  } else {
    ofs << "step " << update_steps << ", all_moves : " << all_moves << ", run_time : ";
    ofs << std::fixed << std::setprecision(3) << consume_time << " seconds\n";
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movsd %xmm0, 0x8(%rsp)
movl %esi, %ebx
movl %edi, %ebp
leaq 0x34596(%rip), %rsi     # 0x79690
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x1, %edx
callq 0x6820
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x30(%rsp,%rax)
je 0x451fb
movq 0x2fec3(%rip), %r14     # 0x74fe8
leaq 0x1acd7(%rip), %rsi     # 0x5fe03
movl $0x1d, %edx
movq %r14, %rdi
callq 0x64a0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq 0x2fe91(%rip), %rdi     # 0x74fe8
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x2fe7d(%rip), %rdi     # 0x74fe8
movl %ebp, %esi
callq 0x6740
movq %rax, %r14
leaq 0x1aca5(%rip), %rsi     # 0x5fe21
movl $0xe, %edx
movq %rax, %rdi
callq 0x64a0
movq %r14, %rdi
movl %ebx, %esi
callq 0x6740
movq %rax, %rbx
leaq 0x1ac93(%rip), %rsi     # 0x5fe30
movl $0xd, %edx
movq %rax, %rdi
callq 0x64a0
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x66a0
movq %rax, %rbx
leaq 0x17fd7(%rip), %rsi     # 0x5d199
movl $0x8, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x4529a
leaq 0x1ac59(%rip), %rsi     # 0x5fe5b
leaq 0x10(%rsp), %rdi
movl $0x5, %edx
callq 0x64a0
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x6740
movq %rax, %r14
leaq 0x1abfa(%rip), %rsi     # 0x5fe21
movl $0xe, %edx
movq %rax, %rdi
callq 0x64a0
movq %r14, %rdi
movl %ebx, %esi
callq 0x6740
leaq 0x1abeb(%rip), %rsi     # 0x5fe30
movl $0xd, %edx
movq %rax, %rdi
callq 0x64a0
leaq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x28(%rsp,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x28(%rsp,%rcx)
movq -0x18(%rax), %rax
movq $0x3, 0x18(%rsp,%rax)
movsd 0x8(%rsp), %xmm0
callq 0x66a0
leaq 0x1abb1(%rip), %rsi     # 0x5fe3e
movl $0x9, %edx
movq %rax, %rdi
callq 0x64a0
movq 0x2fcc7(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x18(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x10(%rsp,%rcx)
callq 0x6340
leaq 0x108(%rsp), %rdi
callq 0x60f0
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/sgf/SgfExtractor.cpp
// Function: GetPlayerName(SGF_record_t*, char const*, int, int)
static int
GetPlayerName( SGF_record_t *kifu, const char *sgf_text, const int cursor, const int color )
{
  int tmp_cursor = 0;

  while ((cursor + tmp_cursor < 100000) && (sgf_text[cursor + tmp_cursor] != ']')) tmp_cursor++;

  if (color == S_BLACK) {
    for (int i = 0; i < tmp_cursor - 3; i++) {
      if (cursor + i + 3 < 100000){
        kifu->black_name[i] = sgf_text[cursor + i + 3];
      }
    }
  } else {
    for (int i = 0; i < tmp_cursor - 3; i++) {
      if (cursor + i + 3 < 100000){
        kifu->white_name[i] = sgf_text[cursor + i + 3];
      }
    }
  }

  while ((cursor + tmp_cursor < 100000) && (sgf_text[cursor + tmp_cursor] != ']')) tmp_cursor++;  
  return cursor + tmp_cursor;
}

// Assembly:
xorl %r8d, %r8d
cmpl $0x1869f, %edx          # imm = 0x1869F
jg 0x45ff6
movslq %edx, %rax
movl $0x186a0, %r8d          # imm = 0x186A0
subl %edx, %r8d
addq %rsi, %rax
xorl %r9d, %r9d
cmpb $0x5d, (%rax,%r9)
je 0x45ff3
incq %r9
cmpq %r9, %r8
jne 0x45fe2
jmp 0x45ff6
movl %r9d, %r8d
cmpl $0x1, %ecx
jne 0x46036
cmpl $0x4, %r8d
jl 0x4606f
leal -0x3(%r8), %eax
movslq %edx, %rcx
leaq (%rcx,%rsi), %r9
addq $0x3, %r9
xorl %r10d, %r10d
leaq (%rcx,%r10), %r11
cmpq $0x1869c, %r11          # imm = 0x1869C
jg 0x4602c
movb (%r9,%r10), %r11b
movb %r11b, 0x3e98(%rdi,%r10)
incq %r10
cmpq %r10, %rax
jne 0x46013
jmp 0x4606f
cmpl $0x4, %r8d
jl 0x4606f
leal -0x3(%r8), %eax
movslq %edx, %rcx
leaq (%rcx,%rsi), %r9
addq $0x3, %r9
xorl %r10d, %r10d
leaq (%rcx,%r10), %r11
cmpq $0x1869c, %r11          # imm = 0x1869C
jg 0x46067
movb (%r9,%r10), %r11b
movb %r11b, 0x3f98(%rdi,%r10)
incq %r10
cmpq %r10, %rax
jne 0x4604e
leal (%r8,%rdx), %eax
cmpl $0x1869f, %eax          # imm = 0x1869F
jg 0x4609c
movslq %r8d, %rcx
movslq %edx, %rax
addq %rcx, %rax
movslq %eax, %rcx
cmpb $0x5d, (%rsi,%rcx)
je 0x4609c
incq %rax
cmpq $0x1869f, %rax          # imm = 0x1869F
jle 0x46083
movl $0x186a0, %eax          # imm = 0x186A0
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/sgf/SgfExtractor.cpp
// Function: GetMove(SGF_record_t*, char const*, int)
static int
GetMove( SGF_record_t *kifu, const char *sgf_text, const int cursor )
{
  int tmp_cursor = 0;

  if (cursor + 3 < 100000){
    if (kifu->moves == 0) {
      if (sgf_text[cursor] == 'B') {
        kifu->start_color = S_BLACK;
      } else {
        kifu->start_color = S_WHITE;
      }
    }
  
    if (sgf_text[cursor + 2] == ']') {
      kifu->move_x[kifu->moves] = PASS;
      kifu->move_y[kifu->moves] = PASS;
      tmp_cursor = 2;
    } else {
      kifu->move_x[kifu->moves] = ParsePosition(sgf_text[cursor + 2]);
      kifu->move_y[kifu->moves] = ParsePosition(sgf_text[cursor + 3]);
      tmp_cursor = 4;
      while ((cursor + tmp_cursor < 100000) && (sgf_text[cursor + tmp_cursor] != ']')) tmp_cursor++;        
    }

    kifu->moves++;
  }

  return cursor + tmp_cursor;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
xorl %eax, %eax
cmpl $0x1869c, %edx          # imm = 0x1869C
jg 0x46156
movq %rsi, %r15
movq %rdi, %r14
movslq 0x4(%rdi), %r13
movslq %ebx, %r12
testq %r13, %r13
jne 0x460d7
xorl %eax, %eax
cmpb $0x42, (%r15,%r12)
setne %al
incl %eax
movl %eax, (%r14)
movb 0x2(%r15,%r12), %al
cmpb $0x5d, %al
jne 0x460fa
xorl %eax, %eax
movl %eax, 0x8(%r14,%r13,4)
movslq 0x4(%r14), %rcx
movl %eax, 0xc88(%r14,%rcx,4)
movl $0x2, %eax
jmp 0x46152
movsbl %al, %edi
callq 0x46162
movl %eax, 0x8(%r14,%r13,4)
movsbl 0x3(%r15,%r12), %edi
callq 0x46162
movslq 0x4(%r14), %rcx
movl %eax, 0xc88(%r14,%rcx,4)
movl $0x4, %eax
cmpl $0x1869c, %ebx          # imm = 0x1869C
je 0x46152
movl %ebx, %ecx
movl $0x4, %eax
leal (%rcx,%rax), %edx
movslq %edx, %rdx
cmpb $0x5d, (%r15,%rdx)
je 0x46152
leaq (%r12,%rax), %rdx
incq %rdx
incq %rax
cmpq $0x186a0, %rdx          # imm = 0x186A0
jl 0x46132
incl 0x4(%r14)
addl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/Rating.cpp
// Function: SetNeighbor()
void
SetNeighbor( void )
{
  neighbor[ 0] = -2 * board_size;
  neighbor[ 1] = - board_size - 1;
  neighbor[ 2] = - board_size;
  neighbor[ 3] = - board_size + 1;
  neighbor[ 4] = -2;
  neighbor[ 5] = -1;
  neighbor[ 6] = 0;
  neighbor[ 7] = 1;
  neighbor[ 8] = 2;
  neighbor[ 9] = board_size - 1;
  neighbor[10] = board_size;
  neighbor[11] = board_size + 1;
  neighbor[12] = 2 * board_size;

  SetCrossPosition();
}

// Assembly:
leaq 0x2f73d(%rip), %rax     # 0x758bc
movl (%rax), %eax
leal (%rax,%rax), %ecx
movl %ecx, %edx
negl %edx
movl %edx, 0x33b52(%rip)     # 0x79ce0
movl %eax, %edx
notl %edx
movl %edx, 0x33b4c(%rip)     # 0x79ce4
movl %eax, %edx
negl %edx
movl %edx, 0x33b46(%rip)     # 0x79ce8
movl $0x1, %edx
subl %eax, %edx
movl %edx, 0x33b3d(%rip)     # 0x79cec
movaps 0x19d2a(%rip), %xmm0    # 0x5fee0
movaps %xmm0, 0x33b33(%rip)    # 0x79cf0
movl $0x2, 0x33b39(%rip)     # 0x79d00
leal -0x1(%rax), %edx
movl %edx, 0x33b34(%rip)     # 0x79d04
movl %eax, 0x33b32(%rip)     # 0x79d08
incl %eax
movl %eax, 0x33b2e(%rip)     # 0x79d0c
movl %ecx, 0x33b2c(%rip)     # 0x79d10
jmp 0x56754
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/Rating.cpp
// Function: RatingMove(game_info_t*, int, std::mersenne_twister_engine<unsigned long, 64ul, 312ul, 156ul, 31ul, 13043109905998158313ul, 29ul, 6148914691236517205ul, 17ul, 8202884508482404352ul, 37ul, 18444473444759240704ul, 43ul, 6364136223846793005ul>&)
int
RatingMove( game_info_t *game, int color, std::mt19937_64 &mt )
{
  long long *rate = game->rate[color - 1];
  long long *sum_rate_row = game->sum_rate_row[color - 1];
  long long *sum_rate = &game->sum_rate[color - 1];
  int y, pos;
  long long rand_num;

  // レートの部分更新
  PartialRating(game, color, sum_rate, sum_rate_row, rate);

  // 合法手を選択するまでループ
  while (true) {
    if (*sum_rate == 0) {
      pos = PASS;
      break;
    }

    rand_num = (mt() % (*sum_rate)) + 1;

    // 縦方向の位置を求める
    y = board_start;
    while (rand_num > sum_rate_row[y]){
      rand_num -= sum_rate_row[y++];
    }

    // 横方向の位置を求める
    pos = POS(board_start, y);
    do {
      rand_num -= rate[pos];
      if (rand_num <= 0) break;
      pos++;
    } while (true);

    // 選ばれた手が合法手ならループを抜け出し
    // そうでなければその箇所のレートを0にし, 手を選びなおす
    if (IsLegalNotEye(game, pos, color)) {
      break;
    } else {
      *sum_rate -= rate[pos];
      sum_rate_row[y] -= rate[pos];
      rate[pos] = 0;
    }
  }

  return pos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x20(%rsp)
movq %rdi, %r13
movl %esi, 0xc(%rsp)
movslq %esi, %rsi
imulq $0x1a48, %rsi, %r14     # imm = 0x1A48
leaq (%r14,%rdi), %r8
addq $0x98e00, %r8           # imm = 0x98E00
imulq $0xe8, %rsi, %rbx
leaq (%rbx,%rdi), %r15
addq $0x9dbf0, %r15          # imm = 0x9DBF0
leaq 0x9dea0(%rdi,%rsi,8), %r12
movq %r12, %rdx
movq %r15, %rcx
callq 0x46b0a
cmpq $0x0, (%r12)
je 0x46af5
addq %r13, %rbx
addq $0x9dbf8, %rbx          # imm = 0x9DBF8
movq %r13, 0x18(%rsp)
leaq (%r14,%r13), %rax
addq $0x98df8, %rax          # imm = 0x98DF8
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
callq 0x3a512
xorl %edx, %edx
divq (%r12)
incq %rdx
leaq 0x2ee53(%rip), %rax     # 0x758c0
movl (%rax), %eax
movslq %eax, %rbp
movq (%r15,%rbp,8), %rcx
cmpq %rcx, %rdx
jle 0x46a8e
subq %rcx, %rdx
movq (%rbx,%rbp,8), %rcx
incq %rbp
cmpq %rcx, %rdx
jg 0x46a7b
movl %ebp, %ecx
jmp 0x46a90
movl %eax, %ecx
leaq 0x2ee25(%rip), %rsi     # 0x758bc
imull (%rsi), %ecx
leal (%rcx,%rax), %esi
movslq %esi, %rsi
movq 0x10(%rsp), %rdi
leaq (%rdi,%rsi,8), %r14
leal (%rcx,%rax), %r13d
decl %r13d
movq %r14, %rax
addq $0x8, %r14
incl %r13d
subq 0x8(%rax), %rdx
jg 0x46ab0
movq 0x18(%rsp), %rdi
movl %r13d, %esi
movl 0xc(%rsp), %edx
callq 0x54d03
testb %al, %al
jne 0x46af8
movq (%r14), %rax
subq %rax, (%r12)
movq (%r14), %rax
subq %rax, (%r15,%rbp,8)
movq $0x0, (%r14)
cmpq $0x0, (%r12)
jne 0x46a53
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/Rating.cpp
// Function: LoadParameter(char const*, float*, int)
static void
LoadParameter( const char *filename, float params[], const int array_size )
{
  FILE *fp;
#if defined (_WIN32)
  errno_t err;

  err = fopen_s(&fp, filename, "r");
  if (err != 0) {
    std::cerr << "can not open -" << filename << "-" << std::endl;
    exit(1);
  }
  for (int i = 0; i < array_size; i++) {
    if (fscanf_s(fp, "%e", &params[i]) == EOF) {
      std::cerr << "Read Error : " << filename << std::endl;
    }
  }
#else
  fp = fopen(filename, "r");
  if (fp == NULL) {
    std::cerr << "can not open -" << filename << "-" << std::endl;
    exit(1);
  }
  for (int i = 0; i < array_size; i++) {
    if (fscanf(fp, "%e", &params[i]) == EOF) {
      std::cerr << "Read Error : " << filename << std::endl;
      exit(1);
    }
  }
#endif
  fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1633e(%rip), %rsi     # 0x5e483
callq 0x64e0
testq %rax, %rax
je 0x481c4
movq %rax, %r15
testl %ebp, %ebp
jle 0x4817e
movl %ebp, %r13d
leaq 0x17db1(%rip), %r12     # 0x5ff11
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x67b0
cmpl $-0x1, %eax
je 0x48194
addq $0x4, %r14
decq %r13
jne 0x48160
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6400
movq 0x2ce4d(%rip), %rdi     # 0x74fe8
leaq 0x15ec8(%rip), %rsi     # 0x5e06a
callq 0x63f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x63f0
movq %rax, %rdi
callq 0x61a0
movl $0x1, %edi
callq 0x64f0
movq 0x2ce1d(%rip), %rdi     # 0x74fe8
leaq 0x15e86(%rip), %rsi     # 0x5e058
callq 0x63f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x63f0
leaq 0x14f12(%rip), %rsi     # 0x5d0fb
movq %rax, %rdi
jmp 0x481ad
nop
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/Simulation.cpp
// Function: Simulation(game_info_t*, int, std::mersenne_twister_engine<unsigned long, 64ul, 312ul, 156ul, 31ul, 13043109905998158313ul, 29ul, 6148914691236517205ul, 17ul, 8202884508482404352ul, 37ul, 18444473444759240704ul, 43ul, 6364136223846793005ul>&)
void
Simulation( game_info_t *game, int starting_color, std::mt19937_64 &mt )
{
  int color = starting_color, pos = -1;
  int pass_count = 0;

  // シミュレーション打ち切り手数を設定
  int length = MAX_MOVES - game->moves;

  if (length < 0) {
    return;
  }

  // レートの初期化  
  std::fill_n(game->sum_rate, 2, 0);
  std::fill(game->sum_rate_row[0], game->sum_rate_row[2], 0);
  std::fill(game->rate[0], game->rate[2], 0);

  // 黒番のレートの計算
  Rating(game, S_BLACK, &game->sum_rate[0], game->sum_rate_row[0], game->rate[0]);
  // 白番のレートの計算
  Rating(game, S_WHITE, &game->sum_rate[1], game->sum_rate_row[1], game->rate[1]);

  // 終局まで対局をシミュレート
  while (length-- && pass_count < 2) {
    // 着手を生成する
    pos = RatingMove(game, color, mt);
    // 石を置く
    PoPutStone(game, pos, color);
    // パスの確認
    pass_count = (pos == PASS) ? (pass_count + 1) : 0;
    // 手番の入れ替え
    color = GetOppositeColor(color);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x43b0(%rdi), %r12d
cmpl $0x43a, %r12d           # imm = 0x43A
jg 0x482ec
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x9dea8(%rdi), %rax
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x9dea8(%rdi)
leaq 0x9dcd8(%rdi), %r13
movl $0x1d0, %edx            # imm = 0x1D0
movq %r13, %rdi
xorl %esi, %esi
callq 0x6210
leaq 0x9a848(%r14), %r15
movl $0x3490, %edx           # imm = 0x3490
movq %r15, %rdi
xorl %esi, %esi
callq 0x6210
movq %r14, %rdi
movl $0x1, %esi
movq (%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0x47be3
leaq 0x9deb0(%r14), %rdx
leaq 0x9ddc0(%r14), %rcx
leaq 0x9c290(%r14), %r8
movq %r14, %rdi
movl $0x2, %esi
callq 0x47be3
cmpl $0x43a, %r12d           # imm = 0x43A
je 0x482ec
addl $0xfffffbc7, %r12d      # imm = 0xFFFFFBC7
xorl %r13d, %r13d
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x469d6
movl %eax, %r15d
movq %r14, %rdi
movl %eax, %esi
movl %ebp, %edx
callq 0x554f2
incl %r13d
testl %r15d, %r15d
movl $0x0, %eax
cmovnel %eax, %r13d
testl %r12d, %r12d
je 0x482ec
xorl $0x3, %ebp
incl %r12d
cmpl $0x2, %r13d
jl 0x482b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x6210
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x596f8
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x5acd4
cmpl $0x3, %r15d
jl 0x498e2
leal -0x2(%r15), %eax
cmpl %eax, 0x43c8(%r14)
jne 0x498e2
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x5a812
movq %r14, %rdi
movq %r12, %rsi
callq 0x5ac41
jmp 0x49904
cmpl $0x4, %r15d
jl 0x49904
addl $-0x3, %r15d
cmpl %r15d, 0x43c8(%r14)
jne 0x49904
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %esi
callq 0x5ac75
leaq 0x2bfa5(%rip), %rax     # 0x758b0
cmpl $0x0, (%rax)
jle 0x49995
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
leaq 0x1ab16dcd(%rip), %rax  # 0x1ab606f0
movl (%rax,%r15,4), %r13d
movq %r14, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x54a9c
xorps %xmm0, %xmm0
testb %al, %al
je 0x4997d
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5a8a3
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5aaf7
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x5abba
movq %r14, %rdi
movl %r13d, %esi
movq %r12, %rdx
movl 0xc(%rsp), %ecx
callq 0x49130
movsd %xmm0, (%rbx,%r15,8)
incq %r15
leaq 0x2bf23(%rip), %rax     # 0x758b0
movslq (%rax), %rax
cmpq %rax, %r15
jl 0x4991c
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
movl 0xc(%rsp), %ecx
callq 0x49130
leaq 0x2bf01(%rip), %rax     # 0x758b0
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
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/UctRating.cpp
// Function: InputBTFMParameter(char const*, fm_t*, int)
static void
InputBTFMParameter( const char *filename, fm_t params[], const int n )
{
  FILE *fp;

#if defined (_WIN32)
  errno_t err;

  err = fopen_s(&fp, filename, "r");
  if (err != 0) {
    std::cerr << "can not open -" << filename << "-" << std::endl;
    exit(1);
  }
  for (int i = 0; i < n; i++) {
    if (fscanf_s(fp, "%le", &params[i].w) == EOF) {
      std::cerr << "Read Error : " << filename << std::endl;
      exit(1);
    }
    for (int j = 0; j < BTFM_DIMENSION; j++) {
      if (fscanf_s(fp, "%le", &params[i].v[j]) == EOF) {
        std::cerr << "Read Error : " << filename << std::endl;
        exit(1);
      }
    }
  }
#else
  fp = fopen(filename, "r");
  if (fp == NULL) {
    std::cerr << "can not open -" << filename << "-" << std::endl;
    exit(1);
  }
  for (int i = 0; i < n; i++) {
    if (fscanf(fp, "%le", &params[i].w) == EOF) {
      std::cerr << "Read Error : " << filename << std::endl;
      exit(1);
    }
    for (int j = 0; j < BTFM_DIMENSION; j++) {
      if (fscanf(fp, "%le", &params[i].v[j]) == EOF) {
        std::cerr << "Read Error : " << filename << std::endl;
        exit(1);
      }
    }
  }
#endif
  fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, 0x10(%rsp)
leaq 0x14a9e(%rip), %rsi     # 0x5e483
movq %rdi, 0x8(%rsp)
callq 0x64e0
testq %rax, %rax
je 0x49aa9
movq %rax, %r15
testl %ebp, %ebp
jle 0x49a61
movl %ebp, %r13d
leaq 0x16544(%rip), %r12     # 0x5ff4d
movq 0x10(%rsp), %rbp
xorl %ebx, %ebx
leaq (%rbx,%rbx,2), %rdx
shlq $0x4, %rdx
addq 0x10(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x67b0
cmpl $-0x1, %eax
je 0x49a77
movl $0x8, %r14d
leaq (%r14,%rbp), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x67b0
cmpl $-0x1, %eax
je 0x49a77
addq $0x8, %r14
cmpq $0x30, %r14
jne 0x49a35
incq %rbx
addq $0x30, %rbp
cmpq %r13, %rbx
jne 0x49a10
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6400
movq 0x2b56a(%rip), %rdi     # 0x74fe8
leaq 0x145e5(%rip), %rsi     # 0x5e06a
callq 0x63f0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x63f0
movq %rax, %rdi
callq 0x61a0
movl $0x1, %edi
callq 0x64f0
movq 0x2b538(%rip), %rdi     # 0x74fe8
leaq 0x145a1(%rip), %rsi     # 0x5e058
callq 0x63f0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x63f0
leaq 0x1362b(%rip), %rsi     # 0x5d0fb
movq %rax, %rdi
jmp 0x49a92
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/MCTSNode.cpp
// Function: InitializeNode(uct_node_t&, int, int)
void
InitializeNode( uct_node_t &node, const int pm1, const int pm2 )
{
  node.previous_move1 = pm1;
  node.previous_move2 = pm2;
  node.move_count = 0;
  node.win = 0;
  node.virtual_loss = 0;
  node.width = 0;
  node.child_num = 0;
  std::fill_n(node.seki, BOARD_MAX, false);
  std::fill_n(node.ownership, BOARD_MAX, 0.0);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
xorl %eax, %eax
xchgl %eax, 0x8(%rdi)
xorl %eax, %eax
xchgl %eax, 0xc(%rdi)
xorl %eax, %eax
xchgl %eax, 0x10(%rdi)
movq $0x0, 0x14(%rdi)
addq $0x27b4, %rdi           # imm = 0x27B4
movl $0x349, %edx            # imm = 0x349
xorl %esi, %esi
callq 0x6210
addq $0x2b00, %rbx           # imm = 0x2B00
movl $0x1a48, %edx           # imm = 0x1A48
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x6210
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/MCTSNode.cpp
// Function: ReuseRootCandidateWithoutLadderMove(uct_node_t&, bool const*)
void
ReuseRootCandidateWithoutLadderMove( uct_node_t &node, const bool ladder[] )
{
  const int child_num = node.child_num;
  child_node_t *child = node.child;

  for (int i = 0; i < child_num; i++) {
    const int pos = child[i].pos;

    child[i].rate = 0.0;
    child[i].pw = false;
    child[i].open = false;
    if (ladder[pos]) {
      node.move_count -= child[i].move_count;
      node.win -= child[i].win;
      child[i].move_count = 0;
      child[i].win = 0;
    }

    child[i].ladder = ladder[pos];
  }
}

// Assembly:
movslq 0x18(%rdi), %rcx
testq %rcx, %rcx
jle 0x49eb8
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rcx, %rax
xorl %ecx, %ecx
movswq 0x1c(%rdi,%rcx), %rdx
movl $0x0, 0x30(%rdi,%rcx)
movw $0x0, 0x34(%rdi,%rcx)
cmpb $0x1, (%rsi,%rdx)
jne 0x49ea8
movl 0x20(%rdi,%rcx), %r8d
lock
subl %r8d, 0x8(%rdi)
movl 0x28(%rdi,%rcx), %r8d
lock
subl %r8d, 0xc(%rdi)
xorl %r8d, %r8d
xchgl %r8d, 0x20(%rdi,%rcx)
xorl %r8d, %r8d
xchgl %r8d, 0x28(%rdi,%rcx)
movb (%rsi,%rdx), %dl
movb %dl, 0x36(%rdi,%rcx)
addq $0x1c, %rcx
cmpq %rcx, %rax
jne 0x49e69
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/MCTSNode.cpp
// Function: UpdateOwnership(uct_node_t&, game_info_t*, int)
void
UpdateOwnership( uct_node_t &node, game_info_t *game, const int current_color )
{
  const char *board = game->board;

  for (int i = 0; i < pure_board_max; i++) {
    const int pos = onboard_pos[i];
    int color = board[pos];

    if (color == S_EMPTY) color = territory[Pat3(game->pat, pos)];

    if (color == current_color) {
      node.ownership[pos] += 1.0;
    } else if (color == S_EMPTY) {
      node.ownership[pos] += 0.5;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
leaq 0x2b9a1(%rip), %rbp     # 0x758b0
cmpl $0x0, (%rbp)
jle 0x49faa
movl %edx, %r14d
movq %rsi, %r15
leaq 0x4748(%rsi), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x1ab167bb(%rip), %rbx  # 0x1ab606f0
movsd 0x130cb(%rip), %xmm1    # 0x5d008
movslq (%rbx,%r12,4), %r13
movsbl 0x43f8(%r15,%r13), %eax
testl %eax, %eax
jne 0x49f70
movq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0x4f84b
movsd 0x130a5(%rip), %xmm1    # 0x5d008
movl %eax, %eax
leaq 0x1aae4774(%rip), %rdi  # 0x1ab2e6e0
movzbl (%rdi,%rax), %eax
movapd %xmm1, %xmm0
cmpl %r14d, %eax
je 0x49f85
movsd 0x1308f(%rip), %xmm0    # 0x5d010
testl %eax, %eax
jne 0x49f9e
movq 0x10(%rsp), %rax
addsd 0x2b00(%rax,%r13,8), %xmm0
movsd %xmm0, 0x2b00(%rax,%r13,8)
incq %r12
movslq (%rbp), %rax
cmpq %rax, %r12
jl 0x49f3d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/ucb/UCBEvaluation.cpp
// Function: CalculateUCB1Value(child_node_t const&, int)
double
CalculateUCB1Value( const child_node_t &child, const int total_visits )
{
  const int move_count = child.move_count + child.virtual_loss.load();
  const double exploitation_term = static_cast<double>(child.win) / move_count;
  const double exploration_term = std::sqrt(2.0 * std::log(total_visits) / move_count);

  return exploitation_term + ucb_c * exploration_term;
}

// Assembly:
subq $0x18, %rsp
movl 0x4(%rdi), %eax
movl 0x8(%rdi), %ecx
addl %eax, %ecx
movl 0xc(%rdi), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sd %ecx, %xmm1
movsd %xmm1, 0x8(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
callq 0x6320
addsd %xmm0, %xmm0
divsd 0x8(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a013
sqrtsd %xmm0, %xmm0
jmp 0x4a018
callq 0x6310
mulsd 0x15f40(%rip), %xmm0    # 0x5ff60
addsd 0x10(%rsp), %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/ucb/UCBEvaluation.cpp
// Function: CalculateUCB1TunedValue(child_node_t const&, int)
double
CalculateUCB1TunedValue( const child_node_t &child, const int total_visits )
{
  const int move_count = child.move_count + child.virtual_loss.load();
  const double p = static_cast<double>(child.win) / move_count;
  const double div = std::log(total_visits) / move_count;
  const double v = p - p * p + std::sqrt(2.0 * div);

  return p + std::sqrt(div * ((0.25 < v) ? 0.25 : v));
}

// Assembly:
subq $0x18, %rsp
movl 0x4(%rdi), %eax
movl 0x8(%rdi), %ecx
addl %eax, %ecx
movl 0xc(%rdi), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sd %ecx, %xmm1
movsd %xmm1, (%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
callq 0x6320
movapd %xmm0, %xmm2
divsd (%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
subsd %xmm0, %xmm1
movapd %xmm2, %xmm0
addsd %xmm2, %xmm0
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x4a090
sqrtsd %xmm0, %xmm0
jmp 0x4a0af
movsd %xmm2, (%rsp)
movsd %xmm1, 0x10(%rsp)
callq 0x6310
movsd 0x10(%rsp), %xmm1
xorpd %xmm3, %xmm3
movsd (%rsp), %xmm2
addsd %xmm1, %xmm0
movsd 0x15ead(%rip), %xmm1    # 0x5ff68
minsd %xmm0, %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm3, %xmm2
jb 0x4a0d2
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x4a0db
movapd %xmm2, %xmm0
callq 0x6310
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/mcts/ucb/UCBEvaluation.cpp
// Function: SelectBestChildIndexByUCB1(uct_node_t const&, std::mersenne_twister_engine<unsigned long, 64ul, 312ul, 156ul, 31ul, 13043109905998158313ul, 29ul, 6148914691236517205ul, 17ul, 8202884508482404352ul, 37ul, 18444473444759240704ul, 43ul, 6364136223846793005ul>&)
int
SelectBestChildIndexByUCB1( const uct_node_t &node, std::mt19937_64 &mt )
{
  const int child_num = node.child_num;
  const int sum = node.move_count + node.virtual_loss.load();
  const double move_score_bonus_weight = bonus_weight * sqrt(bonus_equivalence / (sum + bonus_equivalence));
  const child_node_t *child = node.child;
  int max_child = 0;
  double max_value = -10000.0;

  for (int i = 0; i < child_num; i++) {
    if (child[i].pw || child[i].open) {
      const int move_count = child[i].move_count + child[i].virtual_loss.load();
      double ucb_value = 0.0;
      if (move_count == 0) {
        ucb_value = FPU + 0.0001 * (mt() % 10000);
      } else {
        ucb_value = CalculateUCB1TunedValue(child[i], sum) + CalculateMoveScoreBonus(child[i], move_score_bonus_weight);
      }
      if (ucb_value > max_value) {
        max_value = ucb_value;
        max_child = i;
      }
    }
  }
  
  return max_child;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x18(%rdi), %r12d
movl 0x8(%rdi), %eax
movl 0x10(%rdi), %ebp
addl %eax, %ebp
cvtsi2sd %ebp, %xmm1
movsd 0x15e56(%rip), %xmm0    # 0x5ff70
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a132
sqrtsd %xmm0, %xmm0
jmp 0x4a137
callq 0x6310
movsd %xmm0, 0x8(%rsp)
testl %r12d, %r12d
jle 0x4a20a
movsd 0x8(%rsp), %xmm0
mulsd 0x15e14(%rip), %xmm0    # 0x5ff68
movsd %xmm0, 0x8(%rsp)
addq $0x1c, %r14
movsd 0x15e12(%rip), %xmm1    # 0x5ff78
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpb $0x0, 0x18(%r14)
jne 0x4a17a
cmpb $0x1, 0x19(%r14)
jne 0x4a1f8
movsd %xmm1, 0x10(%rsp)
movl 0x4(%r14), %eax
movl 0x8(%r14), %ecx
addl %eax, %ecx
jne 0x4a1c9
movq %rbx, %rdi
callq 0x3a512
movq %rax, %rcx
movabsq $0x346dc5d63886594b, %rdx # imm = 0x346DC5D63886594B
mulq %rdx
shrq $0xb, %rdx
imull $0x2710, %edx, %eax     # imm = 0x2710
subl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd 0x15dc1(%rip), %xmm1    # 0x5ff80
addsd 0x14cc1(%rip), %xmm1    # 0x5ee88
jmp 0x4a1e6
movq %r14, %rdi
movl %ebp, %esi
callq 0x4a02b
xorps %xmm1, %xmm1
cvtss2sd 0x14(%r14), %xmm1
mulsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
ucomisd %xmm0, %xmm1
maxsd %xmm0, %xmm1
cmoval %r13d, %r15d
incq %r13
addq $0x1c, %r14
cmpq %r13, %r12
jne 0x4a16c
jmp 0x4a20d
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop