// File: /workspace/github_cpp_makefile_star2_O3/antoniogarro[P]Hara/gtp.cpp
// Function: GTP::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int GTP::parse(const std::string &command_str)
{  
  std::stringstream auxstream(command_str);
  std::string auxstring;
  float auxint;
  int id;
  cmd_args.clear();
  cmd_int_args.clear();
  
  //TODO: findfirstof(#) and eliminate
  //TODO: handle empty lines
  
  auxstream >> auxstring;
  std::stringstream tempstream(auxstring);
  
  if (tempstream >> id) {
    //TODO:handle negative IDs??
    cmd_id = auxstring;
    cmd_id.append(" ");
    auxstream >> cmd_name;
  } else {
    cmd_id = " ";
    cmd_name = auxstring;
  }
  
  cmd = string_to_cmd(cmd_name);
  
  while (auxstream.good()) {
    auxstream >> auxstring;
    cmd_args.insert(cmd_args.end(), auxstring);
    
    tempstream.clear(); //!!!!
    tempstream.str(auxstring);
    tempstream >> auxint;
    cmd_int_args.insert(cmd_int_args.end(), auxint);
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %rdi, %rbx
leaq 0x1c0(%rsp), %rdi
movl $0x18, %edx
callq 0x3290
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rbx), %rdi
movq 0x48(%rbx), %rsi
movq %rdi, 0x28(%rsp)
callq 0x71ce
movq 0x60(%rbx), %rax
cmpq %rax, 0x68(%rbx)
je 0x670a
movq %rax, 0x68(%rbx)
leaq 0x1c0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3210
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x18, %edx
callq 0x3290
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x30f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
leaq 0x8(%rbx), %r14
testb $0x5, 0x20(%rax,%rcx)
je 0x677c
movq 0x10(%rbx), %rdx
leaq 0x4d99(%rip), %rcx      # 0xb4f5
movl $0x1, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x3270
leaq 0x28(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x30d0
jmp 0x67a9
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x30d0
leaq 0x4d65(%rip), %rsi      # 0xb4f5
movq %r14, %rdi
callq 0x3340
leaq 0x28(%rbx), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x3210
leaq 0x60(%rbx), %r12
leaq 0x28(%rbx), %r14
leaq 0x1000c0(%rbx), %r15
xorl %r13d, %r13d
movq %r14, %rdi
movq %r15, %rsi
callq 0x3040
testl %eax, %eax
je 0x67dd
incq %r13
addq $0x20, %r15
cmpq $0x14, %r13
jne 0x67bb
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, 0x4(%rbx)
leaq 0x50(%rsp), %r13
leaq 0x1c0(%rsp), %rbp
leaq 0x8(%rsp), %r14
leaq 0x34(%rsp), %r15
movq 0x1c0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x1e0(%rsp,%rax)
jne 0x686b
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3210
movq 0x50(%rbx), %rsi
movq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x6fc2
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x38(%rsp), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x32e0
movq %r13, %rdi
movq %r14, %rsi
callq 0x3250
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x3350
movq 0x68(%rbx), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x709a
jmp 0x67f8
movq 0x973e(%rip), %rsi      # 0xffb0
leaq 0x38(%rsp), %rdi
callq 0x3140
leaq 0xb8(%rsp), %rdi
callq 0x3090
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x68a5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x31d0
movq 0x9704(%rip), %rsi      # 0xffb0
leaq 0x1c0(%rsp), %rdi
callq 0x3140
leaq 0x240(%rsp), %rdi
callq 0x3090
xorl %eax, %eax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x68dc
movq %rax, %rbx
jmp 0x690a
jmp 0x68e9
jmp 0x68e9
jmp 0x68e9
jmp 0x68e9
movq %rax, %rbx
movq 0x96bd(%rip), %rsi      # 0xffb0
leaq 0x38(%rsp), %rdi
callq 0x3140
leaq 0xb8(%rsp), %rdi
callq 0x3090
leaq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
je 0x6926
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x31d0
movq 0x9683(%rip), %rsi      # 0xffb0
leaq 0x1c0(%rsp), %rdi
callq 0x3140
leaq 0x240(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3300
nop