// File: /workspace/github_cpp_makefile_star2_O3/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 0x543a6
movq %rax, 0x5714b(%rip)     # 0x77390
movq %rax, %rdi
callq 0x543d1
movq 0x55d24(%rip), %r12     # 0x75f78
movq (%r12), %rdx
leaq 0x56f21(%rip), %rbx     # 0x77180
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x6660
testq %rax, %rax
je 0x203e2
leaq 0x55074(%rip), %r14     # 0x752f0
movq 0x55d25(%rip), %r13     # 0x75fa8
movl $0xffffffff, 0x570fb(%rip) # imm = 0xFFFFFFFF
movsbl 0x56eec(%rip), %eax     # 0x77180
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x202ee
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6390
movq %r15, %rdi
leaq 0x3d14e(%rip), %rbp     # 0x5d402
movq %rbp, %rsi
callq 0x6640
movq %rax, %rdi
callq 0x6630
movl %eax, 0x570be(%rip)     # 0x77388
xorl %edi, %edi
movq %rbp, %rsi
callq 0x6640
movq %rax, %rbp
subl %r15d, %eax
movslq %eax, %rsi
addq %rbx, %rsi
leaq 0x56f99(%rip), %rdi     # 0x77280
callq 0x6390
jmp 0x2030f
leaq 0x56f8b(%rip), %rdi     # 0x77280
movq %rbx, %rsi
callq 0x6390
movq %rbx, %rdi
leaq 0x3d0fb(%rip), %rsi     # 0x5d402
callq 0x6640
movq %rax, %rbp
movq %rbp, %rdi
callq 0x6160
cmpb $0xa, -0x1(%rax,%rbp)
jne 0x20323
movb $0x0, -0x1(%rbp,%rax)
xorl %r15d, %r15d
leaq (%r14,%r15), %rsi
movq %rbp, %rdi
callq 0x6580
testl %eax, %eax
je 0x203ab
addq $0x48, %r15
cmpq $0x708, %r15            # imm = 0x708
jne 0x20326
movl $0x11, %edx
movq %r13, %rdi
leaq 0x3d09e(%rip), %rsi     # 0x5d3f0
callq 0x6490
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x203b0
callq *0x40(%r15,%r14)
movq (%r12), %rdi
callq 0x64c0
movq 0x55b70(%rip), %rax     # 0x75f30
movq (%rax), %rdi
callq 0x64c0
movq (%r12), %rdx
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x6660
testq %rax, %rax
jne 0x20283
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq