// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/board/GoBoard.cpp
// Function: IsLegalNotEye(game_info_t*, int, int)
bool
IsLegalNotEye( game_info_t *game, const int pos, const int color )
{
  const int *string_id = game->string_id;
  const string_t *string = game->string;

  // 既に石がある
  if (game->board[pos] != S_EMPTY) {
    // 候補手から除外
    game->candidates[pos] = false;
    return false;
  }

  if (game->seki[pos]) {
    return false;
  }

  // 眼
  if (eye[Pat3(game->pat, pos)] != color ||
      string[string_id[NORTH(pos)]].libs == 1 ||
      string[string_id[ WEST(pos)]].libs == 1 ||
      string[string_id[ EAST(pos)]].libs == 1 ||
      string[string_id[SOUTH(pos)]].libs == 1){

    // 自殺手かどうか
    if (nb4_empty[Pat3(game->pat, pos)] == 0 &&
        IsSuicide(game, string, color, pos)) {
      return false;
    }

    // 劫
    if (game->ko_pos == pos &&
        game->ko_move == (game->moves - 1)) {
      return false;
    }

    // 盤端の特殊処理
    if (false_eye[Pat3(game->pat, pos)] == color) {
      if (IsFalseEyeConnection(game, pos, color)) {
        return true;
      } else {
        game->candidates[pos] = false;
        return false;
      }
    }

    return true;
  }

  // 候補手から除外
  game->candidates[pos] = false;

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb48, %rsp            # imm = 0xB48
movq %rdi, %rbx
movslq %esi, %rax
cmpb $0x0, 0x43f8(%rdi,%rax)
je 0x54d2e
movb $0x0, 0x96ce0(%rbx,%rax)
jmp 0x54d38
cmpb $0x0, 0x97029(%rbx,%rax)
je 0x54d4c
xorl %eax, %eax
addq $0xb48, %rsp            # imm = 0xB48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %esi, %r12d
movq %rax, 0x8(%rsp)
leaq 0x9620(%rbx), %r14
leaq 0x4748(%rbx), %r13
movq %r13, %rdi
movl %edx, 0x4(%rsp)
callq 0x4f84b
movl %eax, %eax
leaq 0x1aab9969(%rip), %rcx  # 0x1ab0e6e0
movzbl (%rax,%rcx), %eax
cmpl 0x4(%rsp), %eax
jne 0x54dfe
movl 0x20b35(%rip), %eax     # 0x758bc
movl %r12d, %ecx
subl %eax, %ecx
movslq %ecx, %rcx
movslq 0x95720(%rbx,%rcx,4), %rcx
imulq $0x7c8, %rcx, %rcx      # imm = 0x7C8
cmpl $0x1, 0x4(%r14,%rcx)
je 0x54dfe
movq 0x8(%rsp), %rcx
movslq 0x9571c(%rbx,%rcx,4), %rcx
imulq $0x7c8, %rcx, %rcx      # imm = 0x7C8
cmpl $0x1, 0x4(%r14,%rcx)
je 0x54dfe
movq 0x8(%rsp), %rcx
movslq 0x95724(%rbx,%rcx,4), %rcx
imulq $0x7c8, %rcx, %rcx      # imm = 0x7C8
cmpl $0x1, 0x4(%r14,%rcx)
je 0x54dfe
addl %r12d, %eax
cltq
movslq 0x95720(%rbx,%rax,4), %rax
imulq $0x7c8, %rax, %rax      # imm = 0x7C8
cmpl $0x1, 0x4(%r14,%rax)
jne 0x5512a
movq %r13, %rdi
movl %r12d, %esi
callq 0x4f84b
movl %eax, %eax
leaq 0x1aae98ce(%rip), %rcx  # 0x1ab3e6e0
cmpb $0x0, (%rax,%rcx)
jne 0x54e32
movq %rbx, %rdi
movq %r14, %rsi
movl 0x4(%rsp), %edx
movl %r12d, %ecx
callq 0x54c72
testb %al, %al
jne 0x54d38
cmpl %r12d, 0x43c4(%rbx)
jne 0x54e4f
movl 0x43b0(%rbx), %eax
decl %eax
cmpl %eax, 0x43c8(%rbx)
je 0x54d38
movq %r13, %rdi
movl %r12d, %esi
callq 0x4f84b
movl %eax, %eax
leaq 0x1aac987d(%rip), %rcx  # 0x1ab1e6e0
movzbl (%rax,%rcx), %ecx
movb $0x1, %al
movl 0x4(%rsp), %esi
cmpl %esi, %ecx
jne 0x54d3a
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x50(%rsp)
movl 0x20a2f(%rip), %eax     # 0x758bc
movl %r12d, %ecx
subl %eax, %ecx
movl %ecx, 0x20(%rsp)
leal -0x1(%r12), %ecx
movl %ecx, 0x24(%rsp)
leal 0x1(%r12), %ecx
movl %ecx, 0x28(%rsp)
addl %r12d, %eax
movl %eax, 0x2c(%rsp)
xorl %eax, %eax
movl $0x1, %ecx
xorl %r13d, %r13d
movq 0x8(%rsp), %r9
testl %r13d, %r13d
jle 0x54ef1
movslq 0x20(%rsp,%rax,4), %rdx
movl 0x95720(%rbx,%rdx,4), %edx
movl %r13d, %r10d
xorl %edi, %edi
xorl %r8d, %r8d
cmpl %edx, 0x40(%rsp,%rdi,4)
movzbl %r8b, %r8d
cmovel %ecx, %r8d
incq %rdi
cmpq %rdi, %r10
jne 0x54ed7
testb $0x1, %r8b
jne 0x54f07
movslq 0x20(%rsp,%rax,4), %rdx
movl 0x95720(%rbx,%rdx,4), %edx
movslq %r13d, %rdi
incl %r13d
movl %edx, 0x40(%rsp,%rdi,4)
incq %rax
cmpq $0x4, %rax
jne 0x54ebe
movq %r14, 0x10(%rsp)
xorl %r15d, %r15d
leaq 0x1ab0c331(%rip), %rbp  # 0x1ab61250
leaq 0x40(%rsp), %r14
movslq (%r15,%rbp), %rax
addq %r9, %rax
movsbl 0x43f8(%rbx,%rax), %ecx
xorl %esi, %ecx
cmpl $0x3, %ecx
jne 0x54f60
movl 0x95720(%rbx,%rax,4), %esi
movq %rbx, %rdi
movq %r14, %rdx
movl %r13d, %ecx
callq 0x5ba4c
movl 0x4(%rsp), %esi
movq 0x8(%rsp), %r9
testb %al, %al
jne 0x55115
addq $0x4, %r15
cmpq $0x10, %r15
jne 0x54f24
xorl %r13d, %r13d
xorl %r11d, %r11d
xorl %r14d, %r14d
movslq %r13d, %rax
movslq 0x20(%rsp,%rax,4), %rax
movsbl 0x43f8(%rbx,%rax), %ecx
cmpl %esi, %ecx
jne 0x55064
movslq 0x95720(%rbx,%rax,4), %rbp
imulq $0x7c8, %rbp, %rax      # imm = 0x7C8
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r15
cmpl $0x2, 0x4(%rcx,%rax)
jne 0x54fe0
movswl 0x8(%r15), %edx
cmpl %r12d, %edx
movl %r11d, 0x1c(%rsp)
jne 0x54fc2
movslq %edx, %rax
movswl 0x8(%r15,%rax,2), %edx
movq %rbx, %rdi
callq 0x5b63e
movl 0x4(%rsp), %esi
testb %al, %al
movq 0x8(%rsp), %r9
movl 0x1c(%rsp), %r11d
jne 0x55123
testl %r11d, %r11d
jle 0x54ff8
movl %r11d, %eax
xorl %ecx, %ecx
cmpl %ebp, 0x30(%rsp,%rcx,4)
je 0x55064
incq %rcx
cmpq %rcx, %rax
jne 0x54fea
movzwl 0x8(%r15), %edx
xorl %eax, %eax
cmpl $0x2b7, %edx            # imm = 0x2B7
je 0x5504c
movl %r14d, %ecx
xorl %eax, %eax
movswl %dx, %edx
cmpl %r12d, %edx
je 0x5503b
xorl %r13d, %r13d
testl %r14d, %r14d
jle 0x5502e
cmpl %edx, 0x60(%rsp,%r13,4)
je 0x5503b
incq %r13
cmpq %r13, %rcx
jne 0x5501c
movl %r14d, %r13d
leal (%rax,%r14), %edi
movslq %edi, %rdi
movl %edx, 0x60(%rsp,%rdi,4)
incl %eax
movslq %edx, %rdx
movzwl 0x8(%r15,%rdx,2), %edx
cmpl $0x2b7, %edx            # imm = 0x2B7
jne 0x5500c
addl %r14d, %eax
movl 0x4(%r15), %ecx
movslq %r11d, %rdx
movl %ecx, 0x50(%rsp,%rdx,4)
incl %r11d
movl %ebp, 0x30(%rsp,%rdx,4)
movl %eax, %r14d
leal 0x1(%r13), %eax
cmpl $0x3, %r13d
movl %eax, %r13d
jl 0x54f73
testl %r11d, %r11d
jle 0x55096
movl %r11d, %ecx
xorl %edx, %edx
xorl %r10d, %r10d
movl 0x50(%rsp,%rdx,4), %esi
addl %esi, %r10d
decl %r10d
incq %rdx
cmpq %rdx, %rcx
jne 0x55082
jmp 0x55099
xorl %r10d, %r10d
movslq 0x30(%rsp), %rcx
imulq $0x7c8, %rcx, %rcx      # imm = 0x7C8
movq 0x10(%rsp), %rdx
movzwl 0x57c(%rdx,%rcx), %esi
cmpl $0x11f, %esi            # imm = 0x11F
je 0x55104
movslq 0x34(%rsp), %rdx
imulq $0x7c8, %rdx, %rdx      # imm = 0x7C8
movq 0x10(%rsp), %rdi
addq %rdi, %rdx
addq %rdi, %rcx
movq 0x10(%rsp), %r8
movswq %si, %rsi
imulq $0x7c8, %rsi, %rdi      # imm = 0x7C8
cmpl $0x1, 0x4(%r8,%rdi)
jne 0x550f4
cmpw $0x0, 0x57c(%rdx,%rsi,2)
jne 0x55115
movzwl 0x57c(%rcx,%rsi,2), %esi
cmpl $0x11f, %esi            # imm = 0x11F
jne 0x550d6
cmpl $0x1, %r11d
movb $0x1, %al
je 0x55115
cmpl %r10d, %r14d
je 0x54d3a
movb $0x0, 0x96ce0(%rbx,%r9)
jmp 0x54d38
movb $0x1, %al
jmp 0x54d3a
movq 0x8(%rsp), %rax
jmp 0x54d24