LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/Point.cpp
// Function: ParseSgfPoint[abi:cxx11](int, int)
std::string
ParseSgfPoint( const int x, const int y )
{
  std::string sgf_pos;

  if ((x ==  0 && y ==  0) ||
      (x == -1 && y == -1)) {
    sgf_pos = std::string("tt");
  } else {
    sgf_pos  = static_cast<char>(x - 1 + 'a');
    sgf_pos += static_cast<char>(y - 1 + 'a');
  }

  return sgf_pos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl %edx, %eax
orl %esi, %eax
setne %al
movl %edx, %ecx
andl %esi, %ecx
cmpl $-0x1, %ecx
setne %cl
testb %cl, %al
jne 0x56791
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xa904(%rip), %rsi      # 0x61061
leaq 0xa8ff(%rip), %rdx      # 0x61063
movq %rsp, %rdi
callq 0x200fc
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64f0
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x567bc
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6410
jmp 0x567bc
movl %edx, %ebp
addb $0x60, %sil
movsbl %sil, %r8d
movl $0x1, %ecx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67c0
addb $0x60, %bpl
movsbl %bpl, %esi
movq %rbx, %rdi
callq 0x6350
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x567ce
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x567e4
movq (%r15), %rsi
incq %rsi
callq 0x6410
movq %r14, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/ZobristHash.cpp
// Function: SetHashSize(unsigned int)
void
SetHashSize( const unsigned int new_size )
{
  if (!(new_size & (new_size - 1))) {
    uct_hash_size = new_size;
    uct_hash_limit = new_size * 9 / 10;
  } else {
    std::cerr << "Hash size must be 2 ^ n" << std::endl;
    for (int i = 1; i <= 20; i++) {
      std::cerr << "2^" << i << ":" << (1 << i) << std::endl;
    }
    exit(1);
  }

}

// Assembly:
leal -0x1(%rdi), %eax
testl %eax, %edi
jne 0x56810
movl %edi, 0x200d7(%rip)     # 0x768d0
leal (%rdi,%rdi,8), %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rax, %rcx
shrq $0x23, %rcx
movl %ecx, 0x200c5(%rip)     # 0x768d4
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x1f7c9(%rip), %rbx     # 0x75fe8
leaq 0xa83e(%rip), %rsi      # 0x61064
movl $0x17, %edx
movq %rbx, %rdi
callq 0x6490
movq %rbx, %rdi
callq 0x6190
movl $0x1, %ebp
leaq 0xa835(%rip), %r14      # 0x6107c
leaq 0x6848(%rip), %r15      # 0x5d096
movl $0x2, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6490
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6730
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x6490
movl $0x1, %esi
movl %ebp, %ecx
shll %cl, %esi
movq %r12, %rdi
callq 0x6730
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
incl %ebp
cmpl $0x15, %ebp
jne 0x5684e
movl $0x1, %edi
callq 0x64e0
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/ZobristHash.cpp
// Function: InitializeHash()
void
InitializeHash( void )
{
  std::random_device rnd;
  std::mt19937_64 mt(rnd());

  for (int i = 0; i < MAX_RECORDS; i++) {
    for (int j = 0; j < BOARD_MAX; j++) {
      move_bit[i][j][HASH_PASS] = mt();
      move_bit[i][j][HASH_BLACK] = mt();
      move_bit[i][j][HASH_WHITE] = mt();
      move_bit[i][j][HASH_KO] = mt();
    }
  }
    
  for (int i = 0; i < BOARD_MAX; i++) {  
    hash_bit[i][HASH_PASS]  = mt();
    hash_bit[i][HASH_BLACK] = mt();
    hash_bit[i][HASH_WHITE] = mt();
    hash_bit[i][HASH_KO]    = mt();
    shape_bit[i] = mt();
  }

  node_hash = new node_hash_t[uct_hash_size];

  if (node_hash == NULL) {
    std::cerr << "Cannot allocate memory" << std::endl;
    exit(1);
  }

  enough_size = true;

  InitializeNakadeHash();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1d58, %rsp           # imm = 0x1D58
leaq 0x9d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x39c14
movq %rbx, %rdi
callq 0x6560
movl %eax, %esi
movq %rsi, 0x8(%rsp)
movl $0x1, %eax
movabsq $0x5851f42d4c957f2d, %rcx # imm = 0x5851F42D4C957F2D
movq %rsi, %rdx
shrq $0x3e, %rdx
xorq %rsi, %rdx
imulq %rcx, %rdx
addq %rax, %rdx
movq %rdx, 0x8(%rsp,%rax,8)
incq %rax
movq %rdx, %rsi
cmpq $0x138, %rax            # imm = 0x138
jne 0x5691a
leaq 0x8(%rsp), %rbx
movq $0x138, 0x9c0(%rbx) # imm = 0x138
leaq 0x1ab0b96e(%rip), %r14  # 0x1ab622c0
xorl %r15d, %r15d
movl $0x18, %r12d
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, -0x18(%r14,%r12)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, -0x10(%r14,%r12)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, -0x8(%r14,%r12)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, (%r14,%r12)
addq $0x20, %r12
cmpq $0x6938, %r12           # imm = 0x6938
jne 0x5695b
incq %r15
addq $0x6920, %r14           # imm = 0x6920
cmpq $0x43b, %r15            # imm = 0x43B
jne 0x56955
xorl %r14d, %r14d
leaq 0x8(%rsp), %rbx
leaq 0x1c6d7363(%rip), %r15  # 0x1c72dd20
leaq 0x1c6ddc7c(%rip), %r12  # 0x1c734640
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, (%r15,%r14,4)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, 0x8(%r15,%r14,4)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, 0x10(%r15,%r14,4)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, 0x18(%r15,%r14,4)
movq %rbx, %rdi
callq 0x3a3c8
movq %rax, (%r14,%r12)
addq $0x8, %r14
cmpq $0x1a48, %r14           # imm = 0x1A48
jne 0x569c4
movl 0x1feba(%rip), %eax     # 0x768d0
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdi
callq 0x6030
movq %rax, 0x1c6df65e(%rip)  # 0x1c736088
movb $0x1, 0x1c6df65f(%rip)  # 0x1c736090
callq 0x58fe8
leaq 0x9d0(%rsp), %rdi
callq 0x63a0
addq $0x1d58, %rsp           # imm = 0x1D58
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x56a70
jmp 0x56a58
jmp 0x56a58
movq %rax, %rbx
leaq 0x9d0(%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/board/ZobristHash.cpp
// Function: InitializeUctHash()
void
InitializeUctHash( void )
{
  used = 0;
  enough_size = true;
  oldest_move = 1;
  
  for (unsigned int i = 0; i < uct_hash_size; i++) {
    node_hash[i].flag = false;
    node_hash[i].hash = 0;
    node_hash[i].color = 0;
  }
}

// Assembly:
movl $0x0, 0x1c6df612(%rip)  # 0x1c736094
movb $0x1, 0x1c6df607(%rip)  # 0x1c736090
movl $0x1, 0x1c6df605(%rip)  # 0x1c736098
cmpl $0x0, 0x1fe36(%rip)     # 0x768d0
je 0x56acd
movq 0x1c6df5e5(%rip), %rax  # 0x1c736088
addq $0x10, %rax
xorl %ecx, %ecx
movb $0x0, (%rax)
movq $0x0, -0x10(%rax)
movl $0x0, -0x8(%rax)
incq %rcx
movl 0x1fe0c(%rip), %edx     # 0x768d0
addq $0x18, %rax
cmpq %rdx, %rcx
jb 0x56aa9
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/ZobristHash.cpp
// Function: ClearUctHash()
void
ClearUctHash( void )
{
  used = 0;
  enough_size = true;

  for (unsigned int i = 0; i < uct_hash_size; i++) {
    node_hash[i].flag = false;
    node_hash[i].hash = 0;
    node_hash[i].color = 0;
    node_hash[i].moves = 0;
  }
}

// Assembly:
movl $0x0, 0x1c6df5bc(%rip)  # 0x1c736094
movb $0x1, 0x1c6df5b1(%rip)  # 0x1c736090
cmpl $0x0, 0x1fdea(%rip)     # 0x768d0
je 0x56b0d
movq 0x1c6df599(%rip), %rax  # 0x1c736088
movl 0x1fddb(%rip), %ecx     # 0x768d0
xorl %edx, %edx
xorps %xmm0, %xmm0
incq %rdx
movups %xmm0, (%rax)
movb $0x0, 0x10(%rax)
addq $0x18, %rax
cmpq %rcx, %rdx
jb 0x56afa
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/ZobristHash.cpp
// Function: ClearNotDescendentNodes(std::vector<int, std::allocator<int>>&)
void
ClearNotDescendentNodes( std::vector<int> &indexes )
{
  auto iter = indexes.begin();

  for (int i = 0; i < (int)uct_hash_size; i++) {
    if (*iter == i) {
      iter++;
    } else if (node_hash[i].flag) {
      node_hash[i].flag = false;
      node_hash[i].hash = 0;
      node_hash[i].color = 0;
      node_hash[i].moves = 0;
      used--;
    }
  }

  enough_size = true;
}

// Assembly:
movl 0x1fdbc(%rip), %edx     # 0x768d0
testl %edx, %edx
jle 0x56b6b
movl 0x1c6df576(%rip), %eax  # 0x1c736094
movq (%rdi), %rcx
movq 0x1c6df560(%rip), %rsi  # 0x1c736088
movl 0x1fda2(%rip), %edi     # 0x768d0
addq $0x10, %rsi
xorl %r8d, %r8d
xorps %xmm0, %xmm0
movl (%rcx), %r9d
cmpq %r9, %r8
jne 0x56b46
addq $0x4, %rcx
jmp 0x56b5c
cmpb $0x1, (%rsi)
jne 0x56b5c
decl %eax
movups %xmm0, -0x10(%rsi)
movb $0x0, (%rsi)
movl %eax, 0x1c6df53a(%rip)  # 0x1c736094
movl %edi, %edx
incq %r8
movslq %edx, %r9
addq $0x18, %rsi
cmpq %r9, %r8
jl 0x56b38
movb $0x1, 0x1c6df51e(%rip)  # 0x1c736090
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/ZobristHash.cpp
// Function: DeleteOldHash(game_info_t const*)
void
DeleteOldHash( const game_info_t *game )
{
  while (oldest_move < game->moves) {
    for (unsigned int i = 0; i < uct_hash_size; i++) {
      if (node_hash[i].flag && node_hash[i].moves == oldest_move) {
        node_hash[i].flag = false;
        node_hash[i].hash = 0;
        node_hash[i].color = 0;
        node_hash[i].moves = 0;
        used--;
      }
    }
    oldest_move++;
  }

  enough_size = true;
}

// Assembly:
movl 0x43b0(%rdi), %eax
movl 0x1c6df519(%rip), %ecx  # 0x1c736098
cmpl %eax, %ecx
jge 0x56bec
movl 0x1c6df50b(%rip), %edx  # 0x1c736094
movq 0x1c6df4f8(%rip), %rsi  # 0x1c736088
movl 0x1fd3a(%rip), %edi     # 0x768d0
addq $0x10, %rsi
xorps %xmm0, %xmm0
movl %edi, %r8d
testl %r8d, %r8d
je 0x56bdd
movq %rsi, %r8
xorl %r9d, %r9d
cmpb $0x1, (%r8)
jne 0x56bcc
cmpl %ecx, -0x4(%r8)
jne 0x56bcc
leaq -0x10(%r8), %r10
decl %edx
movups %xmm0, (%r10)
movb $0x0, 0x10(%r10)
movl %edx, 0x1c6df4c8(%rip)  # 0x1c736094
incq %r9
addq $0x18, %r8
cmpq %rdi, %r9
jb 0x56bab
movl %edi, %r8d
jmp 0x56be0
xorl %r8d, %r8d
incl %ecx
cmpl %eax, %ecx
jne 0x56ba0
movl %eax, 0x1c6df4ac(%rip)  # 0x1c736098
movb $0x1, 0x1c6df49d(%rip)  # 0x1c736090
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/DynamicKomi.cpp
// Function: SetHandicapNum(int)
void
SetHandicapNum( const int num )
{
  if (const_handicap_num == 0) {
    handicap_num = num;
    if (dk_mode != DK_OFF && handicap_num == 0) {
      dk_mode = DK_OFF;
    } else if (dk_mode == DK_OFF &&  handicap_num != 0) {
      dk_mode = DK_LINEAR;
    } 
  } else {
    handicap_num = const_handicap_num;
    dk_mode = DK_LINEAR;
  }
}

// Assembly:
movl 0x1c6df3ef(%rip), %eax  # 0x1c7360c8
testl %eax, %eax
je 0x56ce7
movl %eax, 0x1c6df3e9(%rip)  # 0x1c7360cc
movb $0x1, %al
jmp 0x56d0e
movl %edi, 0x1c6df3df(%rip)  # 0x1c7360cc
movb 0x1c6df3dd(%rip), %al   # 0x1c7360d0
testl %edi, %edi
sete %cl
testb %al, %cl
je 0x56d00
xorl %eax, %eax
jmp 0x56d0e
testl %edi, %edi
sete %cl
orb %al, %cl
movb $0x1, %al
testb $0x1, %cl
jne 0x56d14
movb %al, 0x1c6df3bc(%rip)   # 0x1c7360d0
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/board/DynamicKomi.cpp
// Function: DynamicKomi(game_info_t const*, uct_node_t const*, int)
void
DynamicKomi( const game_info_t *game, const uct_node_t *root, const int color )
{
  if (handicap_num != 0) {
    switch(dk_mode) {
      case DK_LINEAR:
        LinearHandicap(game);
        break;
      case DK_VALUE:
        ValueSituational(root, color);
        break;
      default:
        break;
    }
  }
}

// Assembly:
movl 0x1c6df3b1(%rip), %eax  # 0x1c7360cc
testl %eax, %eax
je 0x56d44
cmpb $0x1, 0x1c6df3aa(%rip)  # 0x1c7360d0
jne 0x56d44
movl 0x43b0(%rdi), %ecx
cmpl $0xba, %ecx
jl 0x56d45
cvtsi2sd %eax, %xmm0
addsd 0x62ce(%rip), %xmm0     # 0x5d010
jmp 0x56d64
retq
shll $0x3, %eax
cvtsi2sd %eax, %xmm1
cvtsi2sd %ecx, %xmm0
divsd 0xa328(%rip), %xmm0     # 0x61080
addsd 0x62a8(%rip), %xmm0     # 0x5d008
mulsd %xmm1, %xmm0
leaq 0x1aab61c5(%rip), %rax  # 0x1ab0cf30
movsd %xmm0, (%rax)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd 0xa0f5(%rip), %xmm0     # 0x60e70
movupd %xmm0, 0x8(%rax)
jmp 0x1e905
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/SimulationFeature.cpp
// Function: SetCrossPosition()
void
SetCrossPosition( void )
{
  cross[0] = -board_size - 1;
  cross[1] = -board_size + 1;
  cross[2] =  board_size - 1;
  cross[3] =  board_size + 1;
}

// Assembly:
leaq 0x1f7c1(%rip), %rax     # 0x768bc
movl (%rax), %eax
movl $0x1, %ecx
subl %eax, %ecx
movd %eax, %xmm0
notl %eax
movl %eax, 0x1c6df5b0(%rip)  # 0x1c7366c0
movl %ecx, 0x1c6df5ae(%rip)  # 0x1c7366c4
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
paddd 0x9f6d(%rip), %xmm0     # 0x61090
movq %xmm0, 0x1c6df59d(%rip) # 0x1c7366c8
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Territory.cpp
// Function: IsRemainingDeadStone(game_info_t const*, int, statistic_t const*)
bool
IsRemainingDeadStone( const game_info_t *game, const int color, const statistic_t statistic[] )
{
  const char *board = game->board;
  const int other = GetOppositeColor(color);
  double owner[BOARD_MAX];

  std::fill_n(owner, BOARD_MAX, 0);

  CalculateOwner(statistic, color, owner);

  for (int i = 0; i < pure_board_max; i++) {
    const int pos = onboard_pos[i];
    if (board[pos] == other && owner[pos] > 0.95) {
      return true;
    }
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a48, %rsp           # imm = 0x1A48
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movq %rsp, %rdi
xorl %ebp, %ebp
movl $0x1a48, %edx           # imm = 0x1A48
xorl %esi, %esi
callq 0x6200
leaq 0x1d98f(%rip), %rdx     # 0x768b0
cmpl $0x0, (%rdx)
jle 0x58fd2
movslq %ebx, %rsi
xorl %edi, %edi
leaq 0x1ab087ba(%rip), %rax  # 0x1ab616f0
movslq (%rax,%rdi,4), %rcx
movq %rcx, %r8
shlq $0x4, %r8
movl 0x4(%r15,%r8), %r10d
movl 0x8(%r15,%r8), %r9d
addl %r10d, %r9d
je 0x58f70
addq %r15, %r8
movl (%r8,%rsi,4), %r8d
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r9d, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp,%rcx,8)
incq %rdi
movslq (%rdx), %rcx
cmpq %rcx, %rdi
jl 0x58f36
testl %ecx, %ecx
jle 0x58fd0
movq %rcx, %rdx
negq %rdx
movb $0x1, %bpl
movl $0x1, %esi
movsd 0x723b(%rip), %xmm0     # 0x601d0
movslq -0x4(%rax,%rsi,4), %rdi
movsbl 0x43f8(%r14,%rdi), %r8d
xorl %ebx, %r8d
cmpl $0x3, %r8d
jne 0x58fb7
movsd (%rsp,%rdi,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x58fd2
cmpq %rcx, %rsi
setb %bpl
leaq (%rdx,%rsi), %rdi
incq %rdi
incq %rsi
cmpq $0x1, %rdi
jne 0x58f95
jmp 0x58fd2
xorl %ebp, %ebp
andb $0x1, %bpl
movl %ebp, %eax
addq $0x1a48, %rsp           # imm = 0x1A48
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Nakade.cpp
// Function: Enqueue(nakade_queue_t*, int)
static void
Enqueue( nakade_queue_t *nq, int pos )
{
  nq->pos[nq->tail++] = pos;
  if (nq->tail >= NAKADE_QUEUE_SIZE) {
    nq->tail = 0;
  }
  if (nq->tail == nq->head) {
    std::cerr << "queue  overflow" << std::endl;
  }
}

// Assembly:
movslq 0x7c(%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x7c(%rdi)
movl %esi, (%rdi,%rax,4)
movl 0x7c(%rdi), %eax
cmpl $0x1e, %eax
jl 0x59c4f
movl $0x0, 0x7c(%rdi)
xorl %eax, %eax
cmpl 0x78(%rdi), %eax
jne 0x59c98
pushq %rbx
movq 0x1c38c(%rip), %rbx     # 0x75fe8
leaq 0x84a5(%rip), %rsi      # 0x62108
movl $0xf, %edx
movq %rbx, %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
popq %rbx
jmp 0x6290
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/UctFeature.cpp
// Function: CheckCaptureAfterKoForTree(game_info_t const*, int, unsigned int*)
void
CheckCaptureAfterKoForTree( const game_info_t *game, const int color, unsigned int *tactical_features )
{
  const string_t *string = game->string;
  const char *board = game->board;
  const int *string_id = game->string_id;
  const int other = GetOppositeColor(color);
  const int previous_move_2 = game->record[game->moves - 2].pos;
  int id, lib, neighbor4[4];
  GetNeighbor4(neighbor4, previous_move_2);

  for (int i = 0; i < 4; i++) {
    if (board[neighbor4[i]] == other) {
      id = string_id[neighbor4[i]];
      if (string[id].libs == 1) {
        lib = string[id].lib[0];
        CompareSwapFeature(tactical_features, lib, UCT_CAPTURE_INDEX, UCT_CAPTURE_AFTER_KO);
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x9620(%rdi), %r15
movslq 0x43b0(%rdi), %rax
shlq $0x4, %rax
movl -0x1c(%rax,%rdi), %esi
movq %rsp, %rdi
callq 0x54386
xorl %eax, %eax
movslq (%rsp,%rax,4), %rcx
movsbl 0x43f8(%r14,%rcx), %edx
xorl %ebp, %edx
cmpl $0x3, %edx
jne 0x5b151
movslq 0x95720(%r14,%rcx,4), %rcx
imulq $0x7c8, %rcx, %rcx      # imm = 0x7C8
cmpl $0x1, 0x4(%r15,%rcx)
jne 0x5b151
addq %r15, %rcx
movswq 0x8(%rcx), %rdx
leaq (%rdx,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdx, %rcx
cmpl $0x6, (%rbx,%rcx)
ja 0x5b151
movl $0x7, (%rbx,%rcx)
incq %rax
cmpq $0x4, %rax
jne 0x5b106
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/UctFeature.cpp
// Function: CheckCaptureForTree(game_info_t const*, int, int, unsigned int*)
void
CheckCaptureForTree( const game_info_t *game, const int color, const int pos, unsigned int *tactical_features )
{
  const char *board = game->board;
  const int other = GetOppositeColor(color);
  const string_t *string = game->string;
  const int *string_id = game->string_id;
  int neighbor, id;
  int neighbor4[4];
  bool check;

  GetNeighbor4(neighbor4, pos);

  for (int i = 0; i < 4; i++) {
    if (board[neighbor4[i]] == other) {
      if (string[string_id[neighbor4[i]]].libs == 1) {
        check = false;
        id = string_id[neighbor4[i]];
        neighbor = string[id].neighbor[0];
        while (neighbor != NEIGHBOR_END) {
          if (string[neighbor].libs == 1) {
            check = true;
            break;
          }
          neighbor = string[id].neighbor[neighbor];
        }
        if (check) {
          CompareSwapFeature(tactical_features, pos, UCT_CAPTURE_INDEX, UCT_SEMEAI_CAPTURE);
          return;
        } else {
          CompareSwapFeature(tactical_features, pos, UCT_CAPTURE_INDEX, UCT_CAPTURE);
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
leaq 0x9620(%rdi), %r12
movq %rsp, %rdi
movl %edx, %esi
callq 0x54386
leal (,%r15,8), %eax
subl %r15d, %eax
cltq
xorl %ecx, %ecx
movslq (%rsp,%rcx,4), %rdx
movsbl 0x43f8(%r14,%rdx), %esi
xorl %ebp, %esi
cmpl $0x3, %esi
jne 0x5b42f
movslq 0x95720(%r14,%rdx,4), %rdx
imulq $0x7c8, %rdx, %rdx      # imm = 0x7C8
cmpl $0x1, 0x4(%r12,%rdx)
jne 0x5b42f
addq %r12, %rdx
movzwl 0x57c(%rdx), %esi
cmpl $0x11f, %esi            # imm = 0x11F
je 0x5b422
movswq %si, %rsi
imulq $0x7c8, %rsi, %rdi      # imm = 0x7C8
cmpl $0x1, 0x4(%r12,%rdi)
je 0x5b43a
movzwl 0x57c(%rdx,%rsi,2), %esi
jmp 0x5b3fd
cmpl $0x3, (%rbx,%rax,4)
ja 0x5b42f
movl $0x4, (%rbx,%rax,4)
incq %rcx
cmpq $0x4, %rcx
jne 0x5b3c8
jmp 0x5b447
cmpl $0x4, (%rbx,%rax,4)
ja 0x5b447
movl $0x5, (%rbx,%rax,4)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/UctFeature.cpp
// Function: CheckAtariForTree(game_info_t const*, int, int, unsigned int*)
void
CheckAtariForTree( const game_info_t *game, const int color, const int pos, unsigned int *tactical_features )
{
  const char *board = game->board;
  const int other = GetOppositeColor(color);
  const string_t *string = game->string;
  const int *string_id = game->string_id;
  int id, neighbor4[4];

  GetNeighbor4(neighbor4, pos);

  for (int i = 0; i < 4; i++) {
    if (board[neighbor4[i]] == other) {
      id = string_id[neighbor4[i]];
      if (string[id].libs == 2) {
        CompareSwapFeature(tactical_features, pos, UCT_ATARI_INDEX, UCT_ATARI);
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
leaq 0x9620(%rdi), %r12
movq %rsp, %rdi
movl %edx, %esi
callq 0x54386
leal (,%r15,8), %eax
subl %r15d, %eax
cltq
xorl %ecx, %ecx
movslq (%rsp,%rcx,4), %rdx
movsbl 0x43f8(%r14,%rdx), %esi
xorl %ebp, %esi
cmpl $0x3, %esi
jne 0x5b4c5
movslq 0x95720(%r14,%rdx,4), %rdx
imulq $0x7c8, %rdx, %rdx      # imm = 0x7C8
cmpl $0x2, 0x4(%r12,%rdx)
jne 0x5b4c5
cmpl $0x0, 0x8(%rbx,%rax,4)
jne 0x5b4c5
movl $0x1, 0x8(%rbx,%rax,4)
incq %rcx
cmpq $0x4, %rcx
jne 0x5b48b
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/UctFeature.cpp
// Function: CheckKoRecaptureForTree(game_info_t const*, int, unsigned int*)
void
CheckKoRecaptureForTree( const game_info_t *game, const int color, unsigned int *tactical_features )
{
  const string_t *string = game->string;
  const char *board = game->board;
  const int *string_id = game->string_id;
  const int pm3 = game->record[game->moves - 3].pos;
  const int other = GetOppositeColor(color);

  if (board[pm3] == other) {
    const int id = string_id[pm3];
    if (string[id].libs == 1) {
      const int lib = string[id].lib[0];
      CompareSwapFeature(tactical_features, lib, UCT_CAPTURE_INDEX, UCT_KO_RECAPTURE);
    }
  }
}

// Assembly:
movslq 0x43b0(%rdi), %rax
shlq $0x4, %rax
movslq -0x2c(%rax,%rdi), %rax
movsbl 0x43f8(%rdi,%rax), %ecx
xorl %esi, %ecx
cmpl $0x3, %ecx
jne 0x5b56d
movslq 0x95720(%rdi,%rax,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x9624(%rdi,%rax)
jne 0x5b56d
addq %rdi, %rax
addq $0x9620, %rax           # imm = 0x9620
movswq 0x8(%rax), %rcx
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rcx, %rax
cmpl $0x5, (%rdx,%rax)
ja 0x5b56d
movl $0x6, (%rdx,%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: IsCapturableAtari(game_info_t const*, int, int, int)
bool
IsCapturableAtari( const game_info_t *game, const int pos, const int color, const int opponent_pos )
{
  const int other = GetOppositeColor(color);

  if (!IsLegal(game, pos, color)) {
    return false;
  }

  std::unique_ptr<search_game_info_t> search_game(new search_game_info_t(game));
  search_game_info_t *capturable_game = search_game.get();

  // とりあえず石を置く
  PutStoneForSearch(capturable_game, pos, color);

  const string_t *string = capturable_game->string;
  const int *string_id = capturable_game->string_id;
  const int id = string_id[opponent_pos];

  // 周囲に取り返せる石があれば安全
  int neighbor = string[id].neighbor[0];
  while (neighbor != NEIGHBOR_END) {
    if (string[neighbor].libs == 1) {
      return false;
    }
    neighbor = string[id].neighbor[neighbor];
  }

  if (!IsLegalForSearch(capturable_game, string[string_id[opponent_pos]].lib[0], other)) {
    return true;
  }
  // 逃げるつもりでダメに打つ
  PutStoneForSearch(capturable_game, string[string_id[opponent_pos]].lib[0], other);

  // 逃げても呼吸点が1つなら捕獲可能と判定
  if (string[string_id[opponent_pos]].libs == 1) {
    return true;
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %r14d
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r12
callq 0x55478
testb %al, %al
je 0x5b794
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x51d58
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x51f85
movq %rbx, %r15
addq $0x95f0, %r15           # imm = 0x95F0
movslq %r14d, %r12
movslq 0x956f0(%rbx,%r12,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movzwl 0x9b6c(%rbx,%rax), %ecx
cmpl $0x11f, %ecx            # imm = 0x11F
je 0x5b740
leaq (%r15,%rax), %rdx
movswq %cx, %rcx
imulq $0x7c8, %rcx, %rsi      # imm = 0x7C8
cmpl $0x1, 0x4(%r15,%rsi)
je 0x5b799
movzwl 0x57c(%rdx,%rcx,2), %ecx
cmpl $0x11f, %ecx            # imm = 0x11F
jne 0x5b71d
xorl $0x3, %ebp
movswl 0x8(%r15,%rax), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x51ea8
movb $0x1, %r14b
testb %al, %al
je 0x5b79c
movslq 0x956f0(%rbx,%r12,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movswl 0x8(%r15,%rax), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x51f85
movslq 0x956f0(%rbx,%r12,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x4(%r15,%rax)
sete %r14b
jmp 0x5b79c
xorl %r14d, %r14d
jmp 0x5b7a9
xorl %r14d, %r14d
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5b7b9
jmp 0x5b7b9
movq %rax, %r14
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movq %r14, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: CheckOiotoshi(game_info_t const*, int, int, int)
int
CheckOiotoshi( const game_info_t *game, const int pos, const int color, const int opponent_pos )
{
  const int other = GetOppositeColor(color);
  int num = -1;

  if (!IsLegal(game, pos, color)) {
    return -1;
  }

  std::unique_ptr<search_game_info_t> search_game(new search_game_info_t(game));
  search_game_info_t *oiotoshi_game = search_game.get();
  
  PutStoneForSearch(oiotoshi_game, pos, color);

  const string_t *string = oiotoshi_game->string;
  const int *string_id = oiotoshi_game->string_id;
  const int id = string_id[opponent_pos];

  int neighbor = string[id].neighbor[0];
  while (neighbor != NEIGHBOR_END) {
    if (string[neighbor].libs == 1) {
      return -1;
    }
    neighbor = string[id].neighbor[neighbor];
  }

  if (!IsLegalForSearch(oiotoshi_game, string[string_id[opponent_pos]].lib[0], other)) {
    return -1;
  }
  PutStoneForSearch(oiotoshi_game, string[string_id[opponent_pos]].lib[0], other);

  if (string[string_id[opponent_pos]].libs == 1) {
    num = string[string_id[opponent_pos]].size;
  }

  return num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r13
callq 0x55478
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x5b8e5
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x51d58
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x51f85
movq %rbx, %r12
addq $0x95f0, %r12           # imm = 0x95F0
movslq %r15d, %r15
movslq 0x956f0(%rbx,%r15,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movzwl 0x9b6c(%rbx,%rax), %ecx
cmpl $0x11f, %ecx            # imm = 0x11F
je 0x5b872
leaq (%r12,%rax), %rdx
movswq %cx, %rcx
imulq $0x7c8, %rcx, %rsi      # imm = 0x7C8
cmpl $0x1, 0x4(%r12,%rsi)
je 0x5b8d2
movzwl 0x57c(%rdx,%rcx,2), %ecx
cmpl $0x11f, %ecx            # imm = 0x11F
jne 0x5b84f
xorl $0x3, %ebp
movswl 0x8(%r12,%rax), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x51ea8
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x5b8d8
movslq 0x956f0(%rbx,%r15,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movswl 0x8(%r12,%rax), %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x51f85
movslq 0x956f0(%rbx,%r15,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x4(%r12,%rax)
jne 0x5b8d8
addq %rax, %r12
movl 0x7c0(%r12), %r14d
jmp 0x5b8d8
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5b8fb
jmp 0x5b8fb
movq %rax, %r14
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movq %r14, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: CapturableCandidate(game_info_t const*, int)
int
CapturableCandidate( const game_info_t *game, const int id )
{
  const string_t *string = game->string;
  int neighbor = string[id].neighbor[0];
  bool flag = false;
  int capturable_pos = -1;

  // 隣接する呼吸点が1つの敵連が1つだけの時, 候補を返す
  while (neighbor != NEIGHBOR_END) {
    if (string[neighbor].libs == 1) {
      if (string[neighbor].size >= 2) {
        return -1;
      } else {
        if (flag) {
          return -1;
        }
        capturable_pos = string[neighbor].lib[0];
        flag = true;
      }
    }
    neighbor = string[id].neighbor[neighbor];
  }

  return capturable_pos;
}

// Assembly:
movslq %esi, %rax
imulq $0x7c8, %rax, %rcx      # imm = 0x7C8
movzwl 0x9b9c(%rdi,%rcx), %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x11f, %esi            # imm = 0x11F
je 0x5b97c
addq $0x9620, %rdi           # imm = 0x9620
xorl %edx, %edx
addq %rdi, %rcx
movswq %si, %rsi
imulq $0x7c8, %rsi, %r8       # imm = 0x7C8
cmpl $0x1, 0x4(%rdi,%r8)
jne 0x5b96c
addq %rdi, %r8
cmpl $0x2, 0x7c0(%r8)
setge %al
orb %dl, %al
testb $0x1, %al
jne 0x5b97d
movswl 0x8(%r8), %eax
movb $0x1, %dl
movzwl 0x57c(%rcx,%rsi,2), %esi
cmpl $0x11f, %esi            # imm = 0x11F
jne 0x5b93e
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: IsDeadlyExtension(game_info_t const*, int, int)
bool
IsDeadlyExtension( const game_info_t *game, const int color, const int id )
{
  const int other = GetOppositeColor(color);
  int pos = game->string[id].lib[0];

  if (nb4_empty[Pat3(game->pat, pos)] == 0 &&
      IsSuicide(game, game->string, other, pos)) {
    return true;
  }

  std::unique_ptr<search_game_info_t> search_game_data(new search_game_info_t(game));
  search_game_info_t *search_game = search_game_data.get();

  PutStoneForSearch(search_game, pos, other);

  if (search_game->string[search_game->string_id[pos]].libs == 1) {
    return true;
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r15
xorl $0x3, %ebx
movslq %edx, %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movswl 0x9628(%rdi,%rax), %ebp
addq $0x4748, %rdi           # imm = 0x4748
movl %ebp, %esi
callq 0x4fc2a
movl %eax, %eax
leaq 0x1aae3d24(%rip), %rcx  # 0x1ab3f6e0
cmpb $0x0, (%rcx,%rax)
jne 0x5b9dc
leaq 0x9620(%r15), %rsi
movq %r15, %rdi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x55637
movb $0x1, %r12b
testb %al, %al
jne 0x5ba2c
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x51d58
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x51f85
movslq %ebp, %rax
movslq 0x956f0(%r14,%rax,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x95f4(%r14,%rax)
sete %r12b
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %r14, %rdi
callq 0x6410
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5ba3a
movq %rax, %rbx
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %r14, %rdi
callq 0x6410
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: IsSelfAtariCapture(game_info_t const*, int, int, int)
bool
IsSelfAtariCapture( const game_info_t *game, const int pos, const int color, const int id )
{
  if (!IsLegal(game, pos, color)) {
    return false;
  }

  std::unique_ptr<search_game_info_t> search_game(new search_game_info_t(game));
  search_game_info_t *capture_game = search_game.get();

  PutStoneForSearch(capture_game, pos, color);

  const string_t *string = capture_game->string;
  const int *string_id = capture_game->string_id;
  const int string_pos = game->string[id].origin;

  if (string[string_id[string_pos]].libs == 1) {
    return true;
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
callq 0x55478
testb %al, %al
je 0x5bad0
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x51d58
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x51f85
movslq %ebp, %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movslq 0x9ddc(%r14,%rax), %rax
movslq 0x956f0(%rbx,%rax,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x95f4(%rbx,%rax)
sete %bpl
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
jmp 0x5bad2
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5badf
movq %rax, %r14
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movq %r14, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: CheckLibertyState(game_info_t const*, int, int, int)
int
CheckLibertyState( const game_info_t *game, const int pos, const int color, const int id )
{
  const int string_pos = game->string[id].origin;
  const int libs = game->string[id].libs;

  if (!IsLegal(game, pos, color)) {
    return L_DECREASE;
  }

  std::unique_ptr<search_game_info_t> search_game(new search_game_info_t(game));
  search_game_info_t *liberty_game = search_game.get();

  PutStoneForSearch(liberty_game, pos, color);

  const string_t *string = liberty_game->string;
  const int *string_id = liberty_game->string_id;
  const int new_libs = string[string_id[string_pos]].libs;

  if (new_libs > libs + 1) {
    return L_INCREASE;
  } else if (new_libs > libs) {
    return L_EVEN;
  } else {
    return L_DECREASE;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movslq %ecx, %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movslq 0x9ddc(%rdi,%rax), %rbx
movl 0x9624(%rdi,%rax), %r13d
callq 0x55478
xorl %r12d, %r12d
testb %al, %al
je 0x5bb93
movq %rbx, %r12
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x51d58
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x51f85
movslq 0x956f0(%rbx,%r12,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movl 0x95f4(%rbx,%rax), %eax
leal 0x1(%r13), %ecx
xorl %edx, %edx
cmpl %r13d, %eax
setg %dl
cmpl %ecx, %eax
movl $0x2, %r12d
cmovlel %edx, %r12d
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5bba7
movq %rax, %r14
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %rbx, %rdi
callq 0x6410
movq %r14, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Semeai.cpp
// Function: IsAlreadyCaptured(game_info_t const*, int, int*, int)
bool 
IsAlreadyCaptured( const game_info_t *game, const int id, int player_id[], int player_ids )
{
  const string_t *string = game->string;
  const int *string_id = game->string_id;
  int lib1, lib2;
  bool checked;
  int neighbor4[4];
  int i, j;

  if (string[id].libs == 1) {
    return true;
  } else if (string[id].libs == 2) {
    lib1 = string[id].lib[0];
    lib2 = string[id].lib[lib1];

    GetNeighbor4(neighbor4, lib1);
    checked = false;
    for (i = 0; i < 4; i++) {
      for (j = 0; j < player_ids; j++) {
        if (player_id[j] == string_id[neighbor4[i]]) {
          checked = true;
          player_id[j] = 0;
        }
      }
    }
    if (checked == false) return false;

    GetNeighbor4(neighbor4, lib2);
    checked = false;
    for (i = 0; i < 4; i++) {
      for (j = 0; j < player_ids; j++) {
        if (player_id[j] == string_id[neighbor4[i]]) {
          checked = true;
          player_id[j] = 0;
        }
      }
    }
    if (checked == false) return false;

    for (i = 0; i < player_ids; i++) {
      if (player_id[i] != 0) {
        return false;
      }
    }

    return true;
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebp
movslq %esi, %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
movl 0x9624(%rdi,%rax), %ecx
cmpl $0x1, %ecx
je 0x5c36b
cmpl $0x2, %ecx
jne 0x5c367
movq %rdx, %rbx
movq %rdi, %r14
addq %rdi, %rax
addq $0x9620, %rax           # imm = 0x9620
movswq 0x8(%rax), %rsi
movswl 0x8(%rax,%rsi,2), %r15d
movq %rsp, %rdi
callq 0x54386
movl %ebp, %r12d
xorl %eax, %eax
xorl %ecx, %ecx
testl %ebp, %ebp
jle 0x5c359
movslq (%rsp,%rax,4), %rdx
xorl %esi, %esi
movl (%rbx,%rsi,4), %edi
cmpl 0x95720(%r14,%rdx,4), %edi
jne 0x5c351
movl $0x0, (%rbx,%rsi,4)
movb $0x1, %cl
incq %rsi
cmpq %rsi, %r12
jne 0x5c33b
incq %rax
cmpq $0x4, %rax
jne 0x5c331
testb $0x1, %cl
jne 0x5c37a
xorl %eax, %eax
jmp 0x5c36d
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %rdi
movl %r15d, %esi
callq 0x54386
xorl %ecx, %ecx
xorl %eax, %eax
testl %ebp, %ebp
jle 0x5c3b1
movslq (%rsp,%rcx,4), %rdx
xorl %esi, %esi
movl (%rbx,%rsi,4), %edi
cmpl 0x95720(%r14,%rdx,4), %edi
jne 0x5c3a9
movl $0x0, (%rbx,%rsi,4)
movb $0x1, %al
incq %rsi
cmpq %rsi, %r12
jne 0x5c393
incq %rcx
cmpq $0x4, %rcx
jne 0x5c389
testl %ebp, %ebp
setle %cl
andb $0x1, %al
sete %dl
orb %cl, %dl
jne 0x5c36d
decq %r12
xorl %ecx, %ecx
cmpl $0x0, (%rbx,%rcx,4)
sete %al
jne 0x5c36d
leaq 0x1(%rcx), %rdx
cmpq %rcx, %r12
movq %rdx, %rcx
jne 0x5c3cd
jmp 0x5c36d
// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Ladder.cpp
// Function: CheckLadderExtension(game_info_t const*, int, int)
bool
CheckLadderExtension( const game_info_t *game, const int color, const int pos )
{
  const char *board = game->board;
  const string_t *string = game->string;
  const int *string_id = game->string_id;

  if (board[pos] != color){
    return false;
  }

  const int id = string_id[pos];
  const int ladder = string[id].lib[0];

  if (string[id].libs == 1 &&
      IsLegal(game, ladder, color)) {
    std::unique_ptr<search_game_info_t> search_game(new search_game_info_t(game));
    search_game_info_t *ladder_game = search_game.get();
    PutStoneForSearch(ladder_game, ladder, color);
    if (IsLadderCaptured(0, ladder_game, ladder, GetOppositeColor(color)) == DEAD) {
      return true;
    } 
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq %edx, %rax
movsbl 0x43f8(%rdi,%rax), %ecx
cmpl %esi, %ecx
jne 0x5cdad
movq %rdi, %r15
movslq 0x95720(%rdi,%rax,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x9624(%rdi,%rax)
jne 0x5cdad
movl %esi, %ebx
movswl 0x9628(%r15,%rax), %ebp
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x55478
testb %al, %al
je 0x5cdad
movl $0x69ae40, %edi         # imm = 0x69AE40
callq 0x6400
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x51d58
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x51f85
xorl $0x3, %ebx
xorl %edi, %edi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x5caf3
movl %eax, %ebx
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %r14, %rdi
callq 0x6410
movb $0x1, %al
testb %bl, %bl
je 0x5cdaf
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5cdbc
movq %rax, %rbx
movl $0x69ae40, %esi         # imm = 0x69AE40
movq %r14, %rdi
callq 0x6410
movq %rbx, %rdi
callq 0x6760
// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/request.cpp
// Function: REST::Request::Request(int, sockaddr_storage)
Request::Request(int client, struct sockaddr_storage client_addr) : handle(client), addr(client_addr) {
  time = std::chrono::high_resolution_clock::now();

  // TODO config
  struct timeval tv {
    .tv_sec = 30,
    .tv_usec = 0
  };

  // set timeout for reading
  setsockopt(handle, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x18(%rdi), %rax
leaq 0x30(%rdi), %rcx
leaq 0x60(%rdi), %r8
leaq 0x98(%rdi), %rdx
vxorps %xmm0, %xmm0, %xmm0
movl $0x9, (%rdi)
movq %rdi, %rbx
movq %rax, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movb %al, 0x18(%rdi)
movl %eax, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %rcx, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movl %eax, 0x60(%rdi)
movq %rax, 0x68(%rdi)
movq %r8, 0x70(%rdi)
movq %r8, 0x78(%rdi)
movq %rax, 0x80(%rdi)
movq %rdx, 0x88(%rdi)
movq %rax, 0x90(%rdi)
movb %al, 0x98(%rdi)
movq %rax, 0xa8(%rdi)
movb %al, 0xb0(%rdi)
vmovups %xmm0, 0xb8(%rdi)
movl %esi, 0xc8(%rdi)
vmovups 0x20(%rsp), %zmm0
vmovups 0x60(%rsp), %zmm1
vmovups %zmm1, 0x110(%rdi)
vmovups %zmm0, 0xd0(%rdi)
vzeroupper
callq 0x210d0
vmovups 0x195b0(%rip), %xmm0    # 0x3d0d0
movq %rax, 0xc0(%rbx)
movq %rsp, %rcx
movl $0x1, %esi
movl $0x14, %edx
movl $0x10, %r8d
vmovaps %xmm0, (%rcx)
movl 0xc8(%rbx), %edi
callq 0x23170
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/request.h
// Function: REST::Request::header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*) const
std::string header(std::string const& key, const char default_value[]) const {
      auto h = headers.find(key);
      if (h == headers.end())
        return default_value;
      else
        return h->second;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x28(%rsi), %rdi
movq %rsi, %r15
movq %rdx, %rsi
movq %rcx, %r14
callq 0x219b0
addq $0x30, %r15
cmpq %r15, %rax
je 0x2489b
leaq 0x10(%rbx), %rcx
movq %rbx, %rdi
movq %rcx, (%rbx)
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
addq %rsi, %rdx
callq 0x21600
jmp 0x248ab
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x215f0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/json.hpp
// Function: nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, double, std::allocator>::parser::parse()
basic_json parse()
        {
            basic_json result = parse_internal(true);

            expect(lexer::token_type::end_of_input);

            // return parser result and replace it with null in case the
            // top-level value was discarded by the callback function
            return result.is_discarded() ? basic_json() : result;
        }

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
movq %rsi, %r14
callq 0x224d0
movl $0xd, %esi
movq %r14, %rdi
callq 0x21980
cmpb $0x7, 0x8(%rsp)
jne 0x24dd8
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%rbx)
jmp 0x24de5
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x22920
leaq 0x8(%rsp), %rdi
callq 0x21a10
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x8(%rsp), %rdi
movq %rax, %rbx
callq 0x21a10
movq %rbx, %rdi
callq 0x23160
nop
// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/json.hpp
// Function: nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, double, std::allocator>::lexer::lexer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
explicit lexer(const string_t& s) noexcept
            : m_stream(nullptr), m_buffer(s)
        {
            m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
            assert(m_content != nullptr);
            m_start = m_cursor = m_content;
            m_limit = m_content + s.size();
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18(%rbx), %rax
movq $0x0, (%rdi)
movq %rsi, %r14
addq $0x8, %rdi
movq %rax, 0x8(%rbx)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x21600
vxorps %xmm0, %xmm0, %xmm0
movq $0x0, 0x48(%rbx)
vmovups %ymm0, 0x28(%rbx)
movq (%r14), %rax
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x24eae
movq %rax, 0x40(%rbx)
movq %rax, 0x30(%rbx)
addq 0x8(%r14), %rax
movq %rax, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
vzeroupper
retq
leaq 0x18378(%rip), %rdi     # 0x3d22d
leaq 0x18386(%rip), %rsi     # 0x3d242
leaq 0x18391(%rip), %rcx     # 0x3d254
movl $0x1a0f, %edx           # imm = 0x1A0F
vzeroupper
callq 0x21b40
movq %rax, %rdi
callq 0x24985
// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/json.hpp
// Function: nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, double, std::allocator>::lexer::yyfill()
void yyfill() noexcept
        {
            if (m_stream == nullptr or not * m_stream)
            {
                return;
            }

            const ssize_t offset_start = m_start - m_content;
            const ssize_t offset_marker = m_marker - m_start;
            const ssize_t offset_cursor = m_cursor - m_start;

            m_buffer.erase(0, static_cast<size_t>(offset_start));
            std::string line;
            assert(m_stream != nullptr);
            std::getline(*m_stream, line);
            m_buffer += "\n" + line; // add line with newline symbol

            m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
            assert(m_content != nullptr);
            m_start  = m_content;
            m_marker = m_start + offset_marker;
            m_cursor = m_start + offset_cursor;
            m_limit  = m_start + m_buffer.size() - 1;
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq (%rdi), %rax
testq %rax, %rax
je 0x256d5
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x256d5
movq 0x30(%rdi), %rbp
movq 0x38(%rdi), %r12
movq 0x40(%rdi), %r13
leaq 0x8(%rdi), %r14
movq %rdi, %rbx
movq %rbp, %rdx
subq 0x28(%rdi), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x212d0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%rbx), %r15
testq %r15, %r15
je 0x256e4
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22180
movsbl %al, %edx
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x23240
leaq 0x1a358(%rip), %rsi     # 0x3f9b3
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x21fb0
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x21440
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2568f
callq 0x22130
movq 0x8(%rbx), %rax
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x25703
subq %rbp, %r12
subq %rbp, %r13
movq %rax, 0x30(%rbx)
addq %rax, %r12
addq %rax, %r13
movq %r12, 0x38(%rbx)
movq %r13, 0x40(%rbx)
movq 0x10(%rbx), %rcx
leaq -0x1(%rax,%rcx), %rax
movq %rax, 0x48(%rbx)
leaq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
je 0x256d5
callq 0x22130
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17d62(%rip), %rdi     # 0x3d44d
leaq 0x17b50(%rip), %rsi     # 0x3d242
leaq 0x17d68(%rip), %rcx     # 0x3d461
movl $0x1dd3, %edx           # imm = 0x1DD3
callq 0x21b40
leaq 0x17b23(%rip), %rdi     # 0x3d22d
leaq 0x17b31(%rip), %rsi     # 0x3d242
leaq 0x17d49(%rip), %rcx     # 0x3d461
movl $0x1dd8, %edx           # imm = 0x1DD8
callq 0x21b40
movq %rax, %rdi
callq 0x24985