// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/gtp/Gtp.cpp
// Function: GTP_main()
void
GTP_main( void )
{
  game = AllocateGame();
  InitializeBoard(game);

  while (fgets(input, sizeof(input), stdin) != NULL) {
    char *command;
    bool nocommand = true;
    command_id = -1;

    if (isdigit(input[0])) {
      char buf[BUF_SIZE];
      STRCPY(buf, BUF_SIZE, input);
      char *strid = STRTOK(buf, DELIM, &next_token);
      command_id = atoi(strid);
      command = STRTOK(nullptr, DELIM, &next_token);
      int offset = command - buf;
      STRCPY(input_copy, BUF_SIZE, input + offset);
    } else {
      STRCPY(input_copy, BUF_SIZE, input);
      command = STRTOK(input, DELIM, &next_token);
    }
    CHOMP(command);

    for (const GTP_command_t& cmd : gtpcmd) {
      if (!strcmp(command, cmd.command)) {
        (*cmd.function)();
        nocommand = false;
        break;
      }
    }

    if (nocommand) {
      std::cout << err_command << std::endl << std::endl;
    }

    fflush(stdin);
    fflush(stdout);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
callq 0x53e60
movq %rax, 0x55f43(%rip)     # 0x76390
movq %rax, %rdi
callq 0x53e8b
movq 0x54b1c(%rip), %rax     # 0x74f78
movq (%rax), %rdx
leaq 0x55d1a(%rip), %rbx     # 0x76180
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x6670
testq %rax, %rax
je 0x20602
leaq 0x53e2d(%rip), %r15     # 0x742b0
movl $0xffffffff, 0x55efb(%rip) # imm = 0xFFFFFFFF
movsbl 0x55cec(%rip), %eax     # 0x76180
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x204ee
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x63a0
movq %r14, %rdi
leaq 0x3cf4e(%rip), %r12     # 0x5d402
movq %r12, %rsi
callq 0x6650
movq %rax, %rdi
callq 0x6640
movl %eax, 0x55ebe(%rip)     # 0x76388
xorl %edi, %edi
movq %r12, %rsi
callq 0x6650
movq %rax, %rbp
subl %r14d, %eax
movslq %eax, %rsi
addq %rbx, %rsi
leaq 0x55d99(%rip), %rdi     # 0x76280
callq 0x63a0
jmp 0x2050f
leaq 0x55d8b(%rip), %rdi     # 0x76280
movq %rbx, %rsi
callq 0x63a0
movq %rbx, %rdi
leaq 0x3cefb(%rip), %rsi     # 0x5d402
callq 0x6650
movq %rax, %rbp
movq %rbp, %rdi
callq 0x6160
cmpb $0xa, -0x1(%rax,%rbp)
jne 0x20523
movb $0x0, -0x1(%rbp,%rax)
movb $0x1, %r14b
xorl %r13d, %r13d
leaq (%r15,%r13), %rsi
movq %rbp, %rdi
callq 0x6590
movl %eax, %r12d
testl %eax, %eax
jne 0x20544
callq *0x40(%r13,%r15)
xorl %r14d, %r14d
testl %r12d, %r12d
je 0x20559
leaq 0x48(%r13), %rax
cmpq $0x6c0, %r13            # imm = 0x6C0
movq %rax, %r13
jne 0x20529
testb $0x1, %r14b
je 0x205cb
movl $0x11, %edx
movq 0x54a3d(%rip), %r14     # 0x74fa8
movq %r14, %rdi
leaq 0x3ce7b(%rip), %rsi     # 0x5d3f0
callq 0x64a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x549a6(%rip), %r14     # 0x74f78
movq (%r14), %rdi
callq 0x64d0
movq 0x5494f(%rip), %rax     # 0x74f30
movq (%rax), %rdi
callq 0x64d0
movq (%r14), %rdx
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x6670
testq %rax, %rax
jne 0x20483
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq