// File: /workspace/github_cpp_makefile_star2_O2/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 0x61f0
callq 0x32ecd
leaq 0x810(%rsp), %rdi
callq 0x33d88
leaq 0x33106(%rip), %rsi     # 0x44bd2
xorl %edi, %edi
callq 0x6610
movq %rax, %rbx
movq %rax, %rdi
callq 0x6150
cmpb $0xa, -0x1(%rbx,%rax)
jne 0x11aea
movb $0x0, -0x1(%rbx,%rax)
leaq 0x33027(%rip), %rsi     # 0x44b18
movq %rbx, %rdi
callq 0x6570
testl %eax, %eax
je 0x11b33
leaq 0x3301f(%rip), %rsi     # 0x44b23
movq %rbx, %rdi
callq 0x6570
testl %eax, %eax
je 0x11c18
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x12a66
addq $0x1538, %rsp           # imm = 0x1538
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4fd86(%rip), %rax     # 0x618c0
movl (%rax), %ebp
leaq 0x4fd81(%rip), %rax     # 0x618c4
movl (%rax), %ecx
leaq 0x4fd70(%rip), %r13     # 0x618bc
leaq 0xb(%rsp), %r14
pushq $0x5
popq %r15
leaq 0x10(%rsp), %r12
cmpl %ecx, %ebp
jg 0x11b14
leaq 0x4fd5b(%rip), %rax     # 0x618c0
movslq (%rax), %rbx
cmpl %ecx, %ebx
jg 0x11c11
movl (%r13), %esi
movl %ebp, %eax
imull %esi, %eax
movslq %eax, %rdi
leaq (%rbx,%rdi), %rdx
addq 0x50809(%rip), %rdi     # 0x62390
movsbl 0x43f8(%rbx,%rdi), %edi
movl 0x4f8aa(%rip), %r8d     # 0x61440
cmpl %edi, %r8d
jne 0x11ba5
cmpl $0x1f, 0x810(%rsp,%rdx,4)
jl 0x11bb8
xorl %edi, %r8d
cmpl $0x3, %r8d
jne 0x11c09
cmpl $0x46, 0x810(%rsp,%rdx,4)
jl 0x11c09
addq %rbx, %rax
cltd
idivl %esi
movslq %edx, %rcx
leaq 0x33028(%rip), %rdx     # 0x44bf0
movsbl -0x4(%rcx,%rdx), %ecx
leaq 0x4fce0(%rip), %rdx     # 0x618b4
movl (%rdx), %r8d
subl %eax, %r8d
addl $0x5, %r8d
movq %r14, %rdi
movq %r15, %rsi
leaq 0x32f32(%rip), %rdx     # 0x44b1d
xorl %eax, %eax
callq 0x6660
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6240
leaq 0x4fcbd(%rip), %rax     # 0x618c4
movl (%rax), %ecx
incq %rbx
jmp 0x11b68
incl %ebp
jmp 0x11b5a
leaq 0x4fca1(%rip), %rax     # 0x618c0
movl (%rax), %ebp
leaq 0x4fc9c(%rip), %rax     # 0x618c4
movl (%rax), %ecx
leaq 0x4fc8b(%rip), %r13     # 0x618bc
leaq 0xb(%rsp), %r14
pushq $0x5
popq %r15
leaq 0x10(%rsp), %r12
cmpl %ecx, %ebp
jg 0x11b14
leaq 0x4fc72(%rip), %rax     # 0x618c0
movslq (%rax), %rbx
cmpl %ecx, %ebx
jg 0x11cfa
movl (%r13), %esi
movl %ebp, %eax
imull %esi, %eax
movslq %eax, %rdi
leaq (%rbx,%rdi), %rdx
addq 0x50720(%rip), %rdi     # 0x62390
movsbl 0x43f8(%rbx,%rdi), %edi
movl 0x4f7c1(%rip), %r8d     # 0x61440
cmpl %edi, %r8d
jne 0x11c8e
cmpl $0x45, 0x810(%rsp,%rdx,4)
jg 0x11ca1
xorl %edi, %r8d
cmpl $0x3, %r8d
jne 0x11cf2
cmpl $0x1e, 0x810(%rsp,%rdx,4)
jg 0x11cf2
addq %rbx, %rax
cltd
idivl %esi
movslq %edx, %rcx
leaq 0x32f3f(%rip), %rdx     # 0x44bf0
movsbl -0x4(%rcx,%rdx), %ecx
leaq 0x4fbf7(%rip), %rdx     # 0x618b4
movl (%rdx), %r8d
subl %eax, %r8d
addl $0x5, %r8d
movq %r14, %rdi
movq %r15, %rsi
leaq 0x32e49(%rip), %rdx     # 0x44b1d
xorl %eax, %eax
callq 0x6660
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6240
leaq 0x4fbd4(%rip), %rax     # 0x618c4
movl (%rax), %ecx
incq %rbx
jmp 0x11c51
incl %ebp
jmp 0x11c3f