// File: kobanium[P]Ray/src/gtp/Gtp.cpp
// Function: GTP_cgos_genmove_analyze()
static void
GTP_cgos_genmove_analyze( void )
{
  std::ostringstream oss;
  std::string analyze_data;
  char pos[10];
  char *command;
  char c;
  int color;
  int point = PASS;

  StopPondering();

  command = STRTOK(input_copy, DELIM, &next_token);
  
  CHOMP(command);

  command = STRTOK(NULL, DELIM, &next_token);
  if (command == NULL){
    GTP_response(err_genmove, true);
    return;
  }
  CHOMP(command);
  c = static_cast<char>(tolower(static_cast<int>(command[0])));
  if (c == 'w') {
    color = S_WHITE;
  } else if (c == 'b') {
    color = S_BLACK;
  } else {
    GTP_response(err_genmove, true);
    return;
  }

  player_color = color;
  
  point = UctSearchGenmove(game, color, -1);
  if (point != RESIGN) {
    PutStone(game, point, color);

  }
  CgosAnalyzeData data(GetRootNode(), color);
  analyze_data = data.GetJsonData();

  IntegerToString(point, pos);

  oss << "\n";
  oss << analyze_data << "\n";
  oss << "play " << pos;
  
  GTP_response(oss.str().c_str(), true);

  UctSearchPondering(game, GetOppositeColor(color), -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
leaq -0x178(%rbp), %rdi
callq 0x7750
leaq -0x198(%rbp), %rdi
callq 0x7770
movl $0x0, -0x1bc(%rbp)
callq 0x892c0
jmp 0x25f34
leaq 0xc24d5(%rip), %rdi     # 0xe8410
leaq 0x86c5e(%rip), %rsi     # 0xacba0
callq 0x7850
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x7200
movq %rax, %rcx
movq -0x2c0(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x25fc4
movq -0x1b0(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x7200
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x25fc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x26303
xorl %eax, %eax
movl %eax, %edi
leaq 0x86bd1(%rip), %rsi     # 0xacba0
callq 0x7850
movq %rax, -0x1b0(%rbp)
cmpq $0x0, -0x1b0(%rbp)
jne 0x26007
leaq 0x86bd7(%rip), %rdi     # 0xacbc3
movl $0x1, %esi
callq 0x27f30
jmp 0x25ff8
movl $0x1, -0x1d0(%rbp)
jmp 0x262a4
movq -0x1b0(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x7200
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x26064
movq -0x1b0(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x1b0(%rbp), %rdi
callq 0x7200
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x1b0(%rbp), %rax
movsbl (%rax), %edi
callq 0x77e0
movb %al, -0x1b1(%rbp)
movsbl -0x1b1(%rbp), %eax
cmpl $0x77, %eax
jne 0x26091
movl $0x2, -0x1b8(%rbp)
jmp 0x260cd
movsbl -0x1b1(%rbp), %eax
cmpl $0x62, %eax
jne 0x260a9
movl $0x1, -0x1b8(%rbp)
jmp 0x260cb
leaq 0x86b13(%rip), %rdi     # 0xacbc3
movl $0x1, %esi
callq 0x27f30
jmp 0x260bc
movl $0x1, -0x1d0(%rbp)
jmp 0x262a4
jmp 0x260cd
movl -0x1b8(%rbp), %eax
movl %eax, 0xc14b7(%rip)     # 0xe7590
movq 0xc2440(%rip), %rdi     # 0xe8520
movl -0x1b8(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x89370
movl %eax, -0x2dc(%rbp)
jmp 0x260f8
movl -0x2dc(%rbp), %eax
movl %eax, -0x1bc(%rbp)
cmpl $-0x1, -0x1bc(%rbp)
je 0x26129
movq 0xc240c(%rip), %rdi     # 0xe8520
movl -0x1bc(%rbp), %esi
movl -0x1b8(%rbp), %edx
callq 0x9dbc0
jmp 0x26127
jmp 0x26129
callq 0x88e30
movq %rax, -0x2e8(%rbp)
jmp 0x26137
movq -0x2e8(%rbp), %rsi
movl -0x1b8(%rbp), %edx
leaq -0x278(%rbp), %rdi
callq 0x28370
jmp 0x26152
leaq -0x298(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x28700
jmp 0x26167
leaq -0x198(%rbp), %rdi
leaq -0x298(%rbp), %rsi
movq %rsi, -0x2f0(%rbp)
callq 0x76b0
movq -0x2f0(%rbp), %rdi
callq 0x7ae8
movl -0x1bc(%rbp), %edi
leaq -0x1a2(%rbp), %rsi
callq 0x9ef70
jmp 0x261a1
leaq 0x8955d(%rip), %rsi     # 0xaf705
leaq -0x178(%rbp), %rdi
callq 0x7530
jmp 0x261b6
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x7480
movq %rax, -0x2f8(%rbp)
jmp 0x261d2
movq -0x2f8(%rbp), %rdi
leaq 0x89525(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x261e7
leaq 0x867fe(%rip), %rsi     # 0xac9ec
leaq -0x178(%rbp), %rdi
callq 0x7530
movq %rax, -0x300(%rbp)
jmp 0x26203
movq -0x300(%rbp), %rdi
leaq -0x1a2(%rbp), %rsi
callq 0x7530
jmp 0x26218
leaq -0x2b8(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x7580
jmp 0x2622d
leaq -0x2b8(%rbp), %rdi
callq 0x71d0
movq %rax, %rdi
movl $0x1, %esi
callq 0x27f30
jmp 0x26248
leaq -0x2b8(%rbp), %rdi
callq 0x7ae8
movq 0xc22c5(%rip), %rax     # 0xe8520
movq %rax, -0x310(%rbp)
movl -0x1b8(%rbp), %edi
callq 0x25810
movl %eax, -0x304(%rbp)
jmp 0x26275
movl -0x304(%rbp), %esi
movq -0x310(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x8a080
jmp 0x2628e
leaq -0x278(%rbp), %rdi
callq 0x28b00
movl $0x0, -0x1d0(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x7ae8
leaq -0x178(%rbp), %rdi
callq 0x7110
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x262f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x7ae8
leaq -0x278(%rbp), %rdi
callq 0x28b00
leaq -0x198(%rbp), %rdi
callq 0x7ae8
leaq -0x178(%rbp), %rdi
callq 0x7110
movq -0x1c8(%rbp), %rdi
callq 0x79b0
nopw (%rax,%rax)