LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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       # 0x42302
movl $0x8, %edi
callq 0x6400
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4295c
movslq 0x4(%rsp), %rax
leal 0x1(%rax), %ecx
movq %r15, 0x10(%rsp,%rax,8)
movl %ecx, 0x4(%rsp)
cmpq $0x7, %rax
jl 0x4214c
xorl %r14d, %r14d
movq 0x10(%rsp,%r14,8), %rbx
movq %rbx, %rdi
callq 0x6710
cmpq $0x0, (%rbx)
jne 0x422e5
movl $0x8, %esi
movq %rbx, %rdi
callq 0x6410
incq %r14
cmpq $0x8, %r14
jne 0x42181
leaq 0x346fb(%rip), %rax     # 0x768b0
cmpl $0x0, (%rax)
js 0x421e3
xorl %ecx, %ecx
movq $-0x1, %rdx
leaq 0x37ec6(%rip), %rsi     # 0x7a090
movl (%rsi), %edi
addl %edi, %ecx
movslq (%rax), %rdi
incq %rdx
addq $0x4, %rsi
cmpq %rdi, %rdx
jl 0x421ca
cvtsi2sd %ecx, %xmm0
jmp 0x421e7
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
movl $0x1, %ebx
leaq 0x37e95(%rip), %r14     # 0x7a090
leaq 0x1b3fe(%rip), %r15     # 0x5d600
xorl %r12d, %r12d
movl (%rbp,%r14), %eax
addl %eax, %r12d
movq 0x33d94(%rip), %rdi     # 0x75fa8
movl %ebx, %esi
callq 0x6730
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x6490
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
divsd 0x8(%rsp), %xmm0
movq %r13, %rdi
callq 0x6690
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
movq 0x33d73(%rip), %rdi     # 0x75fe8
movl %ebx, %esi
callq 0x6730
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x6490
movl (%rbp,%r14), %esi
movq %r13, %rdi
callq 0x6730
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
addq $0x4, %rbp
incl %ebx
cmpq $0x28, %rbp
jne 0x42205
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 0x6410
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6810
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rsp,%rax)
je 0x42a9d
movq 0x335af(%rip), %rdi     # 0x75fe8
leaq 0x1d2a8(%rip), %rsi     # 0x5fce8
movl $0xd, %edx
callq 0x6490
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x33590(%rip), %rdi     # 0x75fe8
callq 0x6490
movq %rax, %rbx
leaq 0x1b226(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x42af7
movq (%r14), %r15
movq 0x8(%r14), %r12
cmpq %r12, %r15
je 0x42af7
movl $0xfffffefb, %ebp       # imm = 0xFFFFFEFB
movq %rsp, %rbx
leaq 0x1dbfd(%rip), %r14     # 0x606b5
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 0x6690
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x6490
addq $0x20, %r15
cmpq %r12, %r15
jne 0x42ab8
movq 0x3346a(%rip), %rax     # 0x75f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x6330
leaq 0xf8(%rsp), %rdi
callq 0x60f0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x42b3a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6600
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6810
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
je 0x42bf9
movq 0x33456(%rip), %rdi     # 0x75fe8
leaq 0x1d14f(%rip), %rsi     # 0x5fce8
movl $0xd, %edx
callq 0x6490
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x33437(%rip), %rdi     # 0x75fe8
callq 0x6490
movq %rax, %rbx
leaq 0x1b0cd(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x42ca6
movq 0x8(%r14), %r15
subq (%r14), %r15
je 0x42ca6
sarq $0x5, %r15
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %r12d, %r12d
leaq 0x1da99(%rip), %r13     # 0x606b5
movq (%r14), %rax
movsd 0x18(%rax,%r12,8), %xmm0
ucomisd 0x1a3da(%rip), %xmm0    # 0x5d008
jne 0x42c32
jnp 0x42c99
movq (%rbx), %rax
movl (%rax,%r12), %esi
leaq 0x8(%rsp), %rdi
callq 0x6280
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1d161(%rip), %rsi     # 0x5fdb6
callq 0x6490
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 0x6690
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x6490
addq $0x4, %r12
decq %r15
jne 0x42c1c
movq 0x332bb(%rip), %rax     # 0x75f68
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 0x6330
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 0x42cec
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6600
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6810
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
je 0x42da9
movq 0x332a6(%rip), %rdi     # 0x75fe8
leaq 0x1cf9f(%rip), %rsi     # 0x5fce8
movl $0xd, %edx
callq 0x6490
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x33287(%rip), %rdi     # 0x75fe8
callq 0x6490
movq %rax, %rbx
leaq 0x1af1d(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x42e5b
movq (%r14), %r12
movq 0x8(%r14), %r13
cmpq %r13, %r12
je 0x42e5b
movl $0xfffffefb, %ebp       # imm = 0xFFFFFEFB
leaq 0x8(%rsp), %rbx
leaq 0x1a836(%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 0x6690
movl $0x1, %r15d
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6490
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 0x6690
incq %r15
cmpq $0x6, %r15
jne 0x42df7
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1d86f(%rip), %rsi     # 0x606b5
callq 0x6490
addq $0x218, %r12            # imm = 0x218
cmpq %r13, %r12
jne 0x42dca
movq 0x33106(%rip), %rax     # 0x75f68
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 0x6330
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 0x42ea3
jmp 0x42ea3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6600
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6810
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rsp,%rax)
je 0x43472
movq 0x32bda(%rip), %rdi     # 0x75fe8
leaq 0x1c8d3(%rip), %rsi     # 0x5fce8
movl $0xd, %edx
callq 0x6490
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x32bbb(%rip), %rdi     # 0x75fe8
callq 0x6490
movq %rax, %rbx
leaq 0x1a851(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x434a7
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 0x6690
leaq 0x1d21b(%rip), %rsi     # 0x606b5
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq 0x32aba(%rip), %rax     # 0x75f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x6330
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 0x6600
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4396c
movl %esi, %ecx
xorl %edx, %edx
xorl %eax, %eax
movl (%rdi,%rdx,4), %esi
testl %eax, %eax
jle 0x4395a
movl %eax, %r8d
xorl %r9d, %r9d
cmpl (%rdi,%r9,4), %esi
je 0x43963
incq %r9
cmpq %r9, %r8
jne 0x4394c
movslq %eax, %r8
incl %eax
movl %esi, (%rdi,%r8,4)
incq %rdx
cmpq %rcx, %rdx
jne 0x4393f
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1c435(%rip), %rsi     # 0x5fdc6
leaq 0x1c432(%rip), %rdx     # 0x5fdca
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x200fc
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq $-0x1, %rdx
callq 0x66b0
leaq 0x1(%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6440
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x439e3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6410
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 0x43a0c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6410
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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, %rax
shrq $0x20, %rax
xorl %esi, %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
xorl %r8d, %r8d
movl %eax, %ecx
movl %ecx, %r9d
leaq (%r9,%r9,2), %r9
shlq $0x4, %r9
movl 0x28(%rdi,%r9), %r10d
cmpl $0x1, %r10d
je 0x45055
testl %r10d, %r10d
jne 0x45061
jmp 0x45071
addq %rdi, %r9
cmpq %rsi, (%r9)
je 0x45147
incl %ecx
cmpl $0x1000000, %ecx        # imm = 0x1000000
cmovael %r8d, %ecx
cmpl %eax, %ecx
jne 0x45038
movl 0x30000000(%rdi), %ecx
cmpl $0xf42400, %ecx         # imm = 0xF42400
jl 0x450c1
movl $0x1, %r8d
movl $0x28, %r9d
cmpl $0x1, (%rdi,%r9)
jne 0x450a9
cmpl %r8d, -0x8(%rdi,%r9)
jg 0x450a9
movl $0x2, (%rdi,%r9)
decl %ecx
movl %ecx, 0x30000000(%rdi)
addq $0x30, %r9
cmpq $0x30000028, %r9        # imm = 0x30000028
jne 0x4508b
incl %r8d
cmpl $0x800000, %ecx         # imm = 0x800000
jge 0x45085
leaq 0x30000000(%rdi), %r8
xorl %r10d, %r10d
movl %eax, %r9d
movl %r9d, %r11d
leaq (%r11,%r11,2), %r11
shlq $0x4, %r11
testl $0xfffffffd, 0x28(%rdi,%r11) # imm = 0xFFFFFFFD
je 0x45101
incl %r9d
cmpl $0x1000000, %r9d        # imm = 0x1000000
cmovael %r10d, %r9d
cmpl %eax, %r9d
jne 0x450ce
movl $0x1, %edi
callq 0x64e0
cmpl $-0x1, %r9d
je 0x450f7
movslq %r9d, %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movq %rsi, (%rdi,%rax)
movl (%rdx), %esi
movl %esi, 0x8(%rdi,%rax)
movl 0x4(%rdx), %esi
movl %esi, 0xc(%rdi,%rax)
movl 0x8(%rdx), %esi
movl %esi, 0x10(%rdi,%rax)
movq 0x10(%rdx), %rdx
movq %rdx, 0x18(%rdi,%rax)
movl $0x1, %edx
movl %edx, 0x20(%rdi,%rax)
movl %edx, 0x28(%rdi,%rax)
incl %ecx
movl %ecx, (%r8)
popq %rax
retq
cmpl $-0x1, %ecx
je 0x45071
movslq %ecx, %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rdi,%rax), %r8
addq $0x20, %r8
movl (%r8), %ecx
jmp 0x45140
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3526a(%rip), %rsi     # 0x7a690
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x1, %edx
callq 0x6810
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x30(%rsp,%rax)
je 0x45527
movq 0x30b97(%rip), %r14     # 0x75fe8
leaq 0x1aa3b(%rip), %rsi     # 0x5fe93
movl $0x1d, %edx
movq %r14, %rdi
callq 0x6490
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq 0x30b65(%rip), %rdi     # 0x75fe8
callq 0x6040
movq %rax, %rdi
callq 0x6290
movq 0x30b51(%rip), %rdi     # 0x75fe8
movl %ebp, %esi
callq 0x6730
movq %rax, %r14
leaq 0x1aa09(%rip), %rsi     # 0x5feb1
movl $0xe, %edx
movq %rax, %rdi
callq 0x6490
movq %r14, %rdi
movl %ebx, %esi
callq 0x6730
movq %rax, %rbx
leaq 0x1a9f7(%rip), %rsi     # 0x5fec0
movl $0xd, %edx
movq %rax, %rdi
callq 0x6490
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6690
movq %rax, %rbx
leaq 0x17cab(%rip), %rsi     # 0x5d199
movl $0x8, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x455c6
leaq 0x1a9bd(%rip), %rsi     # 0x5feeb
leaq 0x10(%rsp), %rdi
movl $0x5, %edx
callq 0x6490
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x6730
movq %rax, %r14
leaq 0x1a95e(%rip), %rsi     # 0x5feb1
movl $0xe, %edx
movq %rax, %rdi
callq 0x6490
movq %r14, %rdi
movl %ebx, %esi
callq 0x6730
leaq 0x1a94f(%rip), %rsi     # 0x5fec0
movl $0xd, %edx
movq %rax, %rdi
callq 0x6490
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 0x6690
leaq 0x1a915(%rip), %rsi     # 0x5fece
movl $0x9, %edx
movq %rax, %rdi
callq 0x6490
movq 0x3099b(%rip), %rax     # 0x75f68
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 0x6330
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 0x6600
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl %edx, %eax
xorl %r8d, %r8d
movslq %edx, %rdx
cmpl $0x1869f, %eax          # imm = 0x1869F
jg 0x462b8
movl $0x186a0, %r8d          # imm = 0x186A0
subl %edx, %r8d
leaq (%rsi,%rdx), %r10
xorl %r9d, %r9d
cmpb $0x5d, (%r10,%r9)
je 0x46242
incq %r9
cmpq %r9, %r8
jne 0x46231
jmp 0x46245
movl %r9d, %r8d
cmpl $0x1, %ecx
jne 0x46282
cmpl $0x4, %r8d
jl 0x462b8
leal -0x3(%r8), %ecx
leaq (%rdx,%rsi), %r9
addq $0x3, %r9
xorl %r10d, %r10d
leaq (%rdx,%r10), %r11
cmpq $0x1869c, %r11          # imm = 0x1869C
jg 0x46278
movb (%r9,%r10), %r11b
movb %r11b, 0x3e98(%rdi,%r10)
incq %r10
cmpq %r10, %rcx
jne 0x4625f
jmp 0x462b8
cmpl $0x4, %r8d
jl 0x462b8
leal -0x3(%r8), %ecx
leaq (%rdx,%rsi), %r9
addq $0x3, %r9
xorl %r10d, %r10d
leaq (%rdx,%r10), %r11
cmpq $0x1869c, %r11          # imm = 0x1869C
jg 0x462b0
movb (%r9,%r10), %r11b
movb %r11b, 0x3f98(%rdi,%r10)
incq %r10
cmpq %r10, %rcx
jne 0x46297
addl %r8d, %eax
cmpl $0x1869f, %eax          # imm = 0x1869F
jg 0x462e1
movslq %r8d, %rax
addq %rdx, %rax
movslq %eax, %rcx
cmpb $0x5d, (%rsi,%rcx)
je 0x462e1
incq %rax
cmpq $0x1869f, %rax          # imm = 0x1869F
jle 0x462c8
movl $0x186a0, %eax          # imm = 0x186A0
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4639b
movq %rsi, %r15
movq %rdi, %r14
movslq 0x4(%rdi), %r13
movslq %ebx, %r12
testq %r13, %r13
jne 0x4631c
xorl %eax, %eax
cmpb $0x42, (%r15,%r12)
setne %al
incl %eax
movl %eax, (%r14)
movb 0x2(%r15,%r12), %al
cmpb $0x5d, %al
jne 0x4633f
xorl %eax, %eax
movl %eax, 0x8(%r14,%r13,4)
movslq 0x4(%r14), %rcx
movl %eax, 0xc88(%r14,%rcx,4)
movl $0x2, %eax
jmp 0x46397
movsbl %al, %edi
callq 0x463a7
movl %eax, 0x8(%r14,%r13,4)
movsbl 0x3(%r15,%r12), %edi
callq 0x463a7
movslq 0x4(%r14), %rcx
movl %eax, 0xc88(%r14,%rcx,4)
movl $0x4, %eax
cmpl $0x1869c, %ebx          # imm = 0x1869C
je 0x46397
movl %ebx, %ecx
movl $0x4, %eax
leal (%rcx,%rax), %edx
movslq %edx, %rdx
cmpb $0x5d, (%r15,%rdx)
je 0x46397
leaq (%r12,%rax), %rdx
incq %rdx
incq %rax
cmpq $0x186a0, %rdx          # imm = 0x186A0
jl 0x46377
incl 0x4(%r14)
addl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x304f9(%rip), %rax     # 0x768bc
movl (%rax), %eax
leal (%rax,%rax), %ecx
movl %ecx, %edx
negl %edx
movl %edx, 0x3490e(%rip)     # 0x7ace0
movl %eax, %edx
notl %edx
movl %edx, 0x34908(%rip)     # 0x7ace4
movd %eax, %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x19ba3(%rip), %xmm1    # 0x5ff90
psubd %xmm0, %xmm1
movq %xmm1, 0x348ef(%rip)    # 0x7ace8
movaps 0x19ba0(%rip), %xmm0    # 0x5ffa0
movaps %xmm0, 0x348e9(%rip)    # 0x7acf0
movl $0x2, 0x348ef(%rip)     # 0x7ad00
leal -0x1(%rax), %edx
movl %edx, 0x348ea(%rip)     # 0x7ad04
movl %eax, 0x348e8(%rip)     # 0x7ad08
incl %eax
movl %eax, 0x348e4(%rip)     # 0x7ad0c
movl %ecx, 0x348e2(%rip)     # 0x7ad10
jmp 0x570f4
// File: /workspace/github_cpp_makefile_star2_O3/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 0x46d41
cmpq $0x0, (%r12)
je 0x46d2c
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 0x3a3c8
xorl %edx, %edx
divq (%r12)
incq %rdx
leaq 0x2fc1c(%rip), %rax     # 0x768c0
movl (%rax), %eax
movslq %eax, %rbp
movq (%r15,%rbp,8), %rcx
cmpq %rcx, %rdx
jle 0x46cc5
subq %rcx, %rdx
movq (%rbx,%rbp,8), %rcx
incq %rbp
cmpq %rcx, %rdx
jg 0x46cb2
movl %ebp, %ecx
jmp 0x46cc7
movl %eax, %ecx
leaq 0x2fbee(%rip), %rsi     # 0x768bc
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 0x46ce7
movq 0x18(%rsp), %rdi
movl %r13d, %esi
movl 0xc(%rsp), %edx
callq 0x556c8
testb %al, %al
jne 0x46d2f
movq (%r14), %rax
subq %rax, (%r12)
movq (%r14), %rax
subq %rax, (%r15,%rbp,8)
movq $0x0, (%r14)
cmpq $0x0, (%r12)
jne 0x46c8a
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_O3/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 0x160e3(%rip), %rsi     # 0x5e483
callq 0x64d0
testq %rax, %rax
je 0x4841f
movq %rax, %r15
testl %ebp, %ebp
jle 0x483d9
movl %ebp, %r13d
leaq 0x17c2e(%rip), %r12     # 0x5ffe9
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x67a0
cmpl $-0x1, %eax
je 0x483ef
addq $0x4, %r14
decq %r13
jne 0x483bb
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x63f0
movq 0x2dbf2(%rip), %rdi     # 0x75fe8
leaq 0x15c6d(%rip), %rsi     # 0x5e06a
callq 0x63e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x63e0
movq %rax, %rdi
callq 0x6190
movl $0x1, %edi
callq 0x64e0
movq 0x2dbc2(%rip), %rdi     # 0x75fe8
leaq 0x15c2b(%rip), %rsi     # 0x5e058
callq 0x63e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x63e0
leaq 0x14cb7(%rip), %rsi     # 0x5d0fb
movq %rax, %rdi
jmp 0x48408
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4852f
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x9dea8(%rdi), %r13
leaq 0x9dcd8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x9a848(%rdi), %r15
movl $0x3670, %edx           # imm = 0x3670
movq %r15, %rdi
xorl %esi, %esi
callq 0x6200
movq %r14, %rdi
movl $0x1, %esi
movq %r13, %rdx
movq (%rsp), %rcx
movq %r15, %r8
callq 0x47e57
leaq 0x9deb0(%r14), %rdx
leaq 0x9ddc0(%r14), %rcx
leaq 0x9c290(%r14), %r8
movq %r14, %rdi
movl $0x2, %esi
callq 0x47e57
cmpl $0x43a, %r12d           # imm = 0x43A
je 0x4852f
addl $0xfffffbc7, %r12d      # imm = 0xFFFFFBC7
xorl %r13d, %r13d
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x46c0d
movl %eax, %r15d
movq %r14, %rdi
movl %eax, %esi
movl %ebp, %edx
callq 0x55eaf
incl %r13d
testl %r15d, %r15d
movl $0x0, %eax
cmovnel %eax, %r13d
testl %r12d, %r12d
je 0x4852f
xorl $0x3, %ebp
incl %r12d
cmpl $0x2, %r13d
jl 0x484f3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1482f(%rip), %rsi     # 0x5e483
movq %rdi, 0x8(%rsp)
callq 0x64d0
testq %rax, %rax
je 0x49d18
movq %rax, %r15
testl %ebp, %ebp
jle 0x49cd0
movl %ebp, %r13d
leaq 0x163a5(%rip), %r12     # 0x6001d
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 0x67a0
cmpl $-0x1, %eax
je 0x49ce6
movl $0x8, %r14d
leaq (%r14,%rbp), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x67a0
cmpl $-0x1, %eax
je 0x49ce6
addq $0x8, %r14
cmpq $0x30, %r14
jne 0x49ca4
incq %rbx
addq $0x30, %rbp
cmpq %r13, %rbx
jne 0x49c7f
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x63f0
movq 0x2c2fb(%rip), %rdi     # 0x75fe8
leaq 0x14376(%rip), %rsi     # 0x5e06a
callq 0x63e0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x63e0
movq %rax, %rdi
callq 0x6190
movl $0x1, %edi
callq 0x64e0
movq 0x2c2c9(%rip), %rdi     # 0x75fe8
leaq 0x14332(%rip), %rsi     # 0x5e058
callq 0x63e0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x63e0
leaq 0x133bc(%rip), %rsi     # 0x5d0fb
movq %rax, %rdi
jmp 0x49d01
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4a136
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)
movb (%rsi,%rdx), %r8b
cmpb $0x1, %r8b
jne 0x4a128
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), %r8b
movb %r8b, 0x36(%rdi,%rcx)
addq $0x1c, %rcx
cmpq %rcx, %rax
jne 0x4a0e1
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2c723(%rip), %rbp     # 0x768b0
cmpl $0x0, (%rbp)
jle 0x4a228
movl %edx, %r14d
movq %rsi, %r15
leaq 0x4748(%rsi), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x1ab1753d(%rip), %rbx  # 0x1ab616f0
movsd 0x12e4d(%rip), %xmm1    # 0x5d008
movslq (%rbx,%r12,4), %r13
movsbl 0x43f8(%r15,%r13), %eax
testl %eax, %eax
jne 0x4a1ee
movq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0x4fc2a
movsd 0x12e27(%rip), %xmm1    # 0x5d008
movl %eax, %eax
leaq 0x1aae54f6(%rip), %rdi  # 0x1ab2f6e0
movzbl (%rdi,%rax), %eax
movapd %xmm1, %xmm0
cmpl %r14d, %eax
je 0x4a203
movsd 0x12e11(%rip), %xmm0    # 0x5d010
testl %eax, %eax
jne 0x4a21c
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 0x4a1bb
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6310
addsd %xmm0, %xmm0
divsd 0x8(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a28f
sqrtsd %xmm0, %xmm0
jmp 0x4a294
callq 0x6300
mulsd 0x15d94(%rip), %xmm0    # 0x60030
addsd 0x10(%rsp), %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6310
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 0x4a30c
sqrtsd %xmm0, %xmm0
jmp 0x4a32b
movsd %xmm2, (%rsp)
movsd %xmm1, 0x10(%rsp)
callq 0x6300
movsd 0x10(%rsp), %xmm1
xorpd %xmm3, %xmm3
movsd (%rsp), %xmm2
addsd %xmm1, %xmm0
movsd 0x15d01(%rip), %xmm1    # 0x60038
minsd %xmm0, %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm3, %xmm2
jb 0x4a34e
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x4a357
movapd %xmm2, %xmm0
callq 0x6300
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x15caa(%rip), %xmm0    # 0x60040
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a3ae
sqrtsd %xmm0, %xmm0
jmp 0x4a3b3
callq 0x6300
movsd %xmm0, 0x8(%rsp)
testl %r12d, %r12d
jle 0x4a486
movsd 0x8(%rsp), %xmm0
mulsd 0x15c68(%rip), %xmm0    # 0x60038
movsd %xmm0, 0x8(%rsp)
addq $0x1c, %r14
movsd 0x15c66(%rip), %xmm1    # 0x60048
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpb $0x0, 0x18(%r14)
jne 0x4a3f6
cmpb $0x1, 0x19(%r14)
jne 0x4a474
movsd %xmm1, 0x10(%rsp)
movl 0x4(%r14), %eax
movl 0x8(%r14), %ecx
addl %eax, %ecx
jne 0x4a445
movq %rbx, %rdi
callq 0x3a3c8
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 0x15c15(%rip), %xmm1    # 0x60050
addsd 0x14a4d(%rip), %xmm1    # 0x5ee90
jmp 0x4a462
movq %r14, %rdi
movl %ebp, %esi
callq 0x4a2a7
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 0x4a3e8
jmp 0x4a489
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/UctSearch.cpp
// Function: InitializeSearchSetting()
void
InitializeSearchSetting( void )
{
  // Ownerの初期化
  for (int i = 0; i < board_max; i++){
    owner[i] = 50;
    owner_index[i] = 5;
    candidates[i] = true;
  }

  // 乱数の初期化
  std::random_device rand;
  for (int i = 0; i < THREAD_MAX; i++) {
    mt[i].seed(rand());
  }


  SetTimeManagementParameter();
  InitializeTimeSetting();

  pondered = false;
  pondering_stop = true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1390, %rsp           # imm = 0x1390
leaq 0x2c058(%rip), %rax     # 0x768b8
movslq (%rax), %rbx
testq %rbx, %rbx
jle 0x4a8b1
leaq 0x1aabb011(%rip), %rdi  # 0x1ab05880
movl $0x1, %esi
movq %rbx, %rdx
callq 0x6200
shlq $0x3, %rbx
leaq 0x1aaba2c9(%rip), %rax  # 0x1ab04b50
xorl %ecx, %ecx
leaq 0x1aab8870(%rip), %rdx  # 0x1ab03100
movabsq $0x4049000000000000, %rsi # imm = 0x4049000000000000
movq %rsi, (%rcx,%rdx)
movl $0x5, (%rax)
addq $0x4, %rax
addq $0x8, %rcx
cmpq %rcx, %rbx
jne 0x4a89a
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x39c14
leaq 0x1aa9107b(%rip), %r14  # 0x1aadb940
xorl %r15d, %r15d
movabsq $0x5851f42d4c957f2d, %r12 # imm = 0x5851F42D4C957F2D
movq %r14, %r13
movq %rbx, %rdi
callq 0x6560
imulq $0x9c8, %r15, %rdx      # imm = 0x9C8
leaq (%r14,%rdx), %rcx
movl %eax, %esi
movq %rsi, (%rdx,%r14)
movl $0x1, %eax
movq %rsi, %rdx
shrq $0x3e, %rdx
xorq %rsi, %rdx
imulq %r12, %rdx
addq %rax, %rdx
movq %rdx, (%r13,%rax,8)
incq %rax
movq %rdx, %rsi
cmpq $0x138, %rax            # imm = 0x138
jne 0x4a8f6
movq $0x138, 0x9c0(%rcx) # imm = 0x138
incq %r15
addq $0x9c8, %r13            # imm = 0x9C8
cmpq $0x40, %r15
jne 0x4a8d5
callq 0x4d78e
callq 0x4d476
movb $0x0, 0x1aabb286(%rip)  # 0x1ab05bc9
movb $0x1, 0x1aabb280(%rip)  # 0x1ab05bca
leaq 0x8(%rsp), %rdi
callq 0x63a0
addq $0x1390, %rsp           # imm = 0x1390
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x4a97e
jmp 0x4a969
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x63a0
movq %rbx, %rdi
callq 0x6760
movq %rax, %rdi
callq 0x200f1
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/UctSearch.cpp
// Function: StopPondering()
void
StopPondering( void )
{
  if (!pondering_mode) {
    return ;
  }

  if (ponder) {
    pondering_stop = true;
    for (int i = 0; i < threads; i++) {
      worker[i]->join();
      delete worker[i];
    }
    ponder = false;
    pondered = true;
    PrintPonderingCount(GetPoCount());
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x1, 0x1aa90fab(%rip)  # 0x1aadb93c
jne 0x4aa0a
cmpb $0x1, 0x1aabb231(%rip)  # 0x1ab05bcb
jne 0x4aa0a
movb $0x1, 0x1aabb227(%rip)  # 0x1ab05bca
cmpl $0x0, 0x2bece(%rip)     # 0x76878
jle 0x4a9e9
leaq 0x1aabb21d(%rip), %rbx  # 0x1ab05bd0
xorl %r14d, %r14d
movq (%rbx), %rdi
callq 0x6710
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4a9cc
cmpq $0x0, (%rdi)
jne 0x4aa12
movl $0x8, %esi
callq 0x6410
incq %r14
movslq 0x2be98(%rip), %rax     # 0x76878
addq $0x8, %rbx
cmpq %rax, %r14
jl 0x4a9b6
movb $0x0, 0x1aabb1db(%rip)  # 0x1ab05bcb
movb $0x1, 0x1aabb1d2(%rip)  # 0x1ab05bc9
callq 0x4d8e2
movl %eax, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1e979
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x60b0
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/UctSearch.cpp
// Function: CorrectDescendentNodes(std::vector<int, std::allocator<int>>&, int)
static void
CorrectDescendentNodes( std::vector<int> &indexes, int index )
{
  child_node_t *uct_child = uct_node[index].child;
  const int child_num = uct_node[index].child_num;

  indexes.push_back(index);

  for (int i = 0; i < child_num; i++) {
    if (uct_child[i].index != NOT_EXPANDED) {
      CorrectDescendentNodes(indexes, uct_child[i].index);
    }
  }   
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
movq 0x1aa8fb14(%rip), %r15  # 0x1aadb930
movslq %esi, %rax
imulq $0x4548, %rax, %r12     # imm = 0x4548
movl 0x18(%r15,%r12), %r14d
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
je 0x4be41
movl %esi, (%rax)
addq $0x4, %rax
movq %rax, 0x8(%rbx)
jmp 0x4be51
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4cd58
testl %r14d, %r14d
jle 0x4be85
addq %r12, %r15
addq $0x2c, %r15
leaq (%r14,%r14,8), %rax
leaq (%rax,%rax,2), %r12
addq %r14, %r12
xorl %r14d, %r14d
movl (%r15,%r14), %esi
cmpl $-0x1, %esi
je 0x4be7c
movq %rbx, %rdi
callq 0x4be06
addq $0x1c, %r14
cmpq %r14, %r12
jne 0x4be6b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/mcts/MoveSelection.cpp
// Function: SetResignThreshold(double)
void
SetResignThreshold( const double threshold )
{
  if (threshold <= 0.0) {
    PrintResignThresholdIsTooSmall(threshold);
    resign_threshold = 0.0;
  } else if (threshold > 1.0) {
    PrintResignThresholdIsTooLarge(threshold);
  } else {
    resign_threshold = threshold;
  }
}

// Assembly:
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x4d1f1
ucomisd 0xfe26(%rip), %xmm0     # 0x5d008
ja 0x1eb58
movsd %xmm0, 0x29690(%rip)    # 0x76880
retq
pushq %rax
callq 0x1ec8f
movq $0x0, 0x2967e(%rip) # 0x76880
addq $0x8, %rsp
retq