// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/gtp/Gtp.cpp
// Function: GTP_final_status_list()
static void
GTP_final_status_list( void )
{
  char dead[2048] = { 0 };
  char pos[5];
  int owner[BOARD_MAX]; 
  char *command;

  StopPondering();
  
  OwnerCopy(owner);
  
  command = STRTOK(NULL, DELIM, &next_token);

  CHOMP(command);
  
  if (!strcmp(command, "dead")){
    for (int y = board_start; y <= board_end; y++) {
      for (int x = board_start; x <= board_end; x++) {
        if ((game->board[POS(x, y)] == player_color && owner[POS(x, y)] <= 30) ||
            (game->board[POS(x, y)] == GetOppositeColor(player_color) && owner[POS(x, y)] >= 70)) {
#if defined (_WIN32)
          sprintf_s(pos, 5, "%c%d ", GOGUI_X(POS(x, y)), GOGUI_Y(POS(x, y)));
          strcat_s(dead, 2048, pos);
#else
          snprintf(pos, 5, "%c%d ", GOGUI_X(POS(x, y)), GOGUI_Y(POS(x, y)));
          strncat(dead, pos, 5);
#endif
        }
      }
    }
  } else if (!strcmp(command, "alive")){
    for (int y = board_start; y <= board_end; y++) {
      for (int x = board_start; x <= board_end; x++) {
        if ((game->board[POS(x, y)] == player_color && owner[POS(x, y)] >= 70) ||
            (game->board[POS(x, y)] == GetOppositeColor(player_color) && owner[POS(x, y)] <= 30)) {
#if defined (_WIN32)
          sprintf_s(pos, 5, "%c%d ", GOGUI_X(POS(x, y)), GOGUI_Y(POS(x, y)));
          strcat_s(dead, 2048, pos);
#else
          snprintf(pos, 5, "%c%d ", GOGUI_X(POS(x, y)), GOGUI_Y(POS(x, y)));
          strncat(dead, pos, 5);
#endif
        }
      }
    }
  }
  
  GTP_response(dead, true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1538, %rsp           # imm = 0x1538
leaq 0x10(%rsp), %rdi
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x6200
callq 0x4a986
leaq 0x810(%rsp), %rdi
callq 0x4b940
leaq 0x3cb49(%rip), %rsi     # 0x5d402
xorl %edi, %edi
callq 0x6640
movq %rax, %rbx
movq %rax, %rdi
callq 0x6160
cmpb $0xa, -0x1(%rbx,%rax)
jne 0x208d7
movb $0x0, -0x1(%rbx,%rax)
leaq 0x3d3ec(%rip), %rsi     # 0x5dcca
movq %rbx, %rdi
callq 0x6580
testl %eax, %eax
je 0x20a1a
leaq 0x3d3e0(%rip), %rsi     # 0x5dcd5
movq %rbx, %rdi
callq 0x6580
testl %eax, %eax
jne 0x20b2a
leaq 0x55fb4(%rip), %rax     # 0x768c0
movl (%rax), %ebp
leaq 0x55faf(%rip), %rax     # 0x768c4
movl (%rax), %ecx
cmpl %ecx, %ebp
jg 0x20b2a
leaq 0x55f96(%rip), %r12     # 0x768bc
leaq 0x3d3a2(%rip), %rbx     # 0x5dccf
leaq 0xb(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x55f82(%rip), %rax     # 0x768c0
movslq (%rax), %r13
cmpl %ecx, %r13d
jg 0x20a08
movq 0x56a3f(%rip), %rdx     # 0x77390
movl (%r12), %esi
movl 0x55ae5(%rip), %edi     # 0x76440
movl %ebp, %eax
imull %esi, %eax
movslq %eax, %r9
leaq (%r9,%r13), %r8
addq %rdx, %r9
movsbl 0x43f8(%r13,%r9), %r9d
cmpl %r9d, %edi
jne 0x20983
cmpl $0x45, 0x810(%rsp,%r8,4)
jg 0x20997
xorl %edi, %r9d
cmpl $0x3, %r9d
jne 0x209f9
cmpl $0x1e, 0x810(%rsp,%r8,4)
jg 0x209f9
addl %r13d, %eax
cltd
idivl %esi
movslq %edx, %rcx
leaq 0x3ca79(%rip), %rdx     # 0x5d420
movsbl -0x4(%rcx,%rdx), %ecx
leaq 0x55f01(%rip), %rdx     # 0x768b4
movl (%rdx), %r8d
subl %eax, %r8d
addl $0x5, %r8d
movl $0x5, %esi
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6680
movl $0x5, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x6250
movq 0x569aa(%rip), %rdx     # 0x77390
movl (%r12), %esi
movl 0x55a50(%rip), %edi     # 0x76440
leaq 0x55ecd(%rip), %rax     # 0x768c4
movl (%rax), %ecx
incq %r13
leal -0x1(%r13), %eax
cmpl %ecx, %eax
jl 0x2095b
leal 0x1(%rbp), %eax
cmpl %ecx, %ebp
movl %eax, %ebp
jl 0x20937
jmp 0x20b2a
leaq 0x55e9f(%rip), %rax     # 0x768c0
movl (%rax), %ebp
leaq 0x55e9a(%rip), %rax     # 0x768c4
movl (%rax), %ecx
cmpl %ecx, %ebp
jg 0x20b2a
leaq 0x55e81(%rip), %r12     # 0x768bc
leaq 0x3d28d(%rip), %rbx     # 0x5dccf
leaq 0xb(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x55e6d(%rip), %rax     # 0x768c0
movslq (%rax), %r13
cmpl %ecx, %r13d
jg 0x20b1d
movq 0x5692a(%rip), %rdx     # 0x77390
movl (%r12), %esi
movl 0x559d0(%rip), %edi     # 0x76440
movl %ebp, %eax
imull %esi, %eax
movslq %eax, %r9
leaq (%r9,%r13), %r8
addq %rdx, %r9
movsbl 0x43f8(%r13,%r9), %r9d
cmpl %r9d, %edi
jne 0x20a98
cmpl $0x1f, 0x810(%rsp,%r8,4)
jl 0x20aac
xorl %edi, %r9d
cmpl $0x3, %r9d
jne 0x20b0e
cmpl $0x46, 0x810(%rsp,%r8,4)
jl 0x20b0e
addl %r13d, %eax
cltd
idivl %esi
movslq %edx, %rcx
leaq 0x3c964(%rip), %rdx     # 0x5d420
movsbl -0x4(%rcx,%rdx), %ecx
leaq 0x55dec(%rip), %rdx     # 0x768b4
movl (%rdx), %r8d
subl %eax, %r8d
addl $0x5, %r8d
movl $0x5, %esi
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6680
movl $0x5, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x6250
movq 0x56895(%rip), %rdx     # 0x77390
movl (%r12), %esi
movl 0x5593b(%rip), %edi     # 0x76440
leaq 0x55db8(%rip), %rax     # 0x768c4
movl (%rax), %ecx
incq %r13
leal -0x1(%r13), %eax
cmpl %ecx, %eax
jl 0x20a70
leal 0x1(%rbp), %eax
cmpl %ecx, %ebp
movl %eax, %ebp
jl 0x20a4c
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x21a05
addq $0x1538, %rsp           # imm = 0x1538
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq