// File: antoniogarro[P]Hara/gtp.cpp
// Function: GTP::char_to_coordinate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int GTP::char_to_coordinate(std::string &coordinate)
{
  int coord;
  transform(coordinate.begin(), coordinate.end(), coordinate.begin(), ::toupper);
  
  if (!coordinate.compare("PASS")) return 0;
  
  std::stringstream auxstream(coordinate.substr(1,2));
  if (auxstream >> coord && coord <= main_goban.get_size()) {
    coord = (coord - 1)*main_goban.get_size();
  } else {
      return -1;
  }
  
  for (int i = 0; i < main_goban.get_size(); i++) {
    if (coordinate[0] == COORDINATES[i]) {
      coord += i+1;
      return coord;
    }
  }
  return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3220
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3130
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3220
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x10f90(%rip), %rcx     # 0x1afd8
callq 0xac70
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xa5da(%rip), %rsi      # 0x14636
callq 0x30b0
cmpl $0x0, %eax
jne 0xa072
movl $0x0, -0x4(%rbp)
jmp 0xa2a9
movq -0x18(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x32a0
movl $0x10, %edi
movl $0x8, %esi
callq 0xa720
movl %eax, -0x20c(%rbp)
jmp 0xa0a3
movl -0x20c(%rbp), %edx
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x33b0
jmp 0xa0be
leaq -0x1e8(%rbp), %rdi
callq 0x3160
leaq -0x1c8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x3150
movq %rax, -0x218(%rbp)
jmp 0xa0e3
movq -0x218(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3340
movb %al, -0x219(%rbp)
jmp 0xa101
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0xa110
jmp 0xa1c8
movq -0x208(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x224(%rbp)
addq $0xb8, %rdi
callq 0x4530
movl %eax, -0x220(%rbp)
jmp 0xa134
movl -0x224(%rbp), %eax
movl -0x220(%rbp), %ecx
cmpl %ecx, %eax
jg 0xa1c8
movq -0x208(%rbp), %rdi
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, -0x22c(%rbp)
addq $0xb8, %rdi
callq 0x4530
movl %eax, -0x228(%rbp)
jmp 0xa16e
movl -0x228(%rbp), %ecx
movl -0x22c(%rbp), %eax
imull %ecx, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x3160
jmp 0xa2b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x31c0
jmp 0xa2b5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x1f8(%rbp)
jmp 0xa29d
movl $0x0, -0x1fc(%rbp)
movq -0x208(%rbp), %rdi
movl -0x1fc(%rbp), %eax
movl %eax, -0x234(%rbp)
addq $0xb8, %rdi
callq 0x4530
movl %eax, -0x230(%rbp)
jmp 0xa20f
movl -0x234(%rbp), %eax
movl -0x230(%rbp), %ecx
cmpl %ecx, %eax
jge 0xa28c
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x34a0
movq %rax, -0x240(%rbp)
jmp 0xa235
movq -0x240(%rbp), %rax
movsbl (%rax), %eax
movslq -0x1fc(%rbp), %rdx
leaq 0xa303(%rip), %rcx      # 0x14550
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0xa276
movl -0x1fc(%rbp), %eax
addl $0x1, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0xa29d
jmp 0xa278
movl -0x1fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1fc(%rbp)
jmp 0xa1e8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x1f8(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x31c0
movl -0x4(%rbp), %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x1f0(%rbp), %rdi
callq 0x3410
nopw %cs:(%rax,%rax)