// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Parser.cpp
// Function: Parser::ParsePlayer(char*)
Parser::ObjType Parser::ParsePlayer(char *msg) {
  ObjType result;
  const char *team_name = PlayerParam::instance().teamName().c_str();
  int team_name_len = PlayerParam::instance().teamNameLen();

  result.type = OBJ_Player;
  msg += 1;          // 'p'
  if (*msg == ' ') { /* there's a team */
    msg += 2;        // skip space and "
    if (msg[team_name_len] == '"' && !strncmp(msg, team_name, team_name_len)) {
      /* 一定要比较到双引号("),防止出现一个队名包含另一个的问题 */
      result.side = mpObserver->OurSide();
    } else {
      if (PlayerParam::instance().opponentTeamName().empty()) {
        int a = 0;
        char tmp[256];
        while (*msg != '"') {
          tmp[a++] = *msg++;
        }
        tmp[a] = '\0';
        PlayerParam::instance().setOpponentTeamName(tmp);
      }
      result.side = mpObserver->OppSide();
    }
    while (*msg != ' ' && *msg != ')') {
      msg++;
    }                  /* advance past team name */
    if (*msg == ' ') { /* there's a number */
      result.num = parser::get_int(&msg);
    }

    if (*msg == ' ') { // will be goalie
      msg += 1;
      if (!strncmp(msg, "goalie", 6)) { // there's goalie
        if (result.side == mpObserver->OurInitSide()) {
          // our goalie unum is no need to set
        } else {
          mpObserver->SeeOppGoalie(result.num);
        }
      }
      while (*msg != ' ' && *msg != ')') {
        msg++;
      } /* advance past goalie */
    }
  }
  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movabsq $0x500000038, %rax      # imm = 0x500000038
movq %rax, 0x4(%rdi)
movb $0x3f, 0xc(%rdi)
andq $0x0, 0x10(%rdi)
callq 0x38d94
movq 0x3138(%rax), %r13
callq 0x38d94
movslq 0x3158(%rax), %rdx
movl $0x4, (%rbx)
cmpb $0x20, 0x1(%r12)
jne 0x37edd
leaq 0x3(%r12), %r15
movq %r15, -0x30(%rbp)
cmpb $0x22, 0x3(%r12,%rdx)
jne 0x37df0
movq %r15, %rdi
movq %r13, %rsi
callq 0x9260
testl %eax, %eax
je 0x37e51
callq 0x38d94
pushq $0x2a
popq %r12
cmpq $0x0, 0x3168(%rax)
jne 0x37e55
movq -0x30(%rbp), %rax
xorl %r13d, %r13d
movq %r15, %rcx
movb (%r15,%r13), %dl
cmpb $0x22, %dl
je 0x37e29
incq %rcx
movb %dl, -0x130(%rbp,%r13)
incq %r13
movq %rcx, %rax
jmp 0x37e0d
movq %rax, -0x30(%rbp)
movl %r13d, %eax
movb $0x0, -0x130(%rbp,%rax)
callq 0x38d94
leaq -0x130(%rbp), %rsi
movq %rax, %rdi
callq 0x3840c
addq %r13, %r15
jmp 0x37e55
pushq $0x29
popq %r12
movq 0x10(%r14), %rax
movb (%rax,%r12), %r13b
movb %r13b, 0xc(%rbx)
incq %r15
movzbl -0x1(%r15), %eax
cmpl $0x20, %eax
je 0x37e79
cmpl $0x29, %eax
je 0x37edd
movq %r15, -0x30(%rbp)
jmp 0x37e61
leaq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x38103
movl %eax, 0x10(%rbx)
movq (%r12), %r12
cmpb $0x20, (%r12)
jne 0x37edd
movl %eax, %r15d
leaq 0x1(%r12), %rdi
movq %rdi, -0x30(%rbp)
leaq 0x2152a(%rip), %rsi     # 0x593d0
pushq $0x6
popq %rdx
callq 0x9260
testl %eax, %eax
jne 0x37ec0
movq 0x10(%r14), %rax
cmpb 0x28(%rax), %r13b
je 0x37ec0
movl %r15d, 0x30(%rax)
addq $0x2, %r12
movzbl -0x1(%r12), %eax
cmpl $0x20, %eax
je 0x37edd
cmpl $0x29, %eax
je 0x37edd
movq %r12, -0x30(%rbp)
incq %r12
jmp 0x37ec4
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq