// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, -0x28(%rbp)
movabsq $0x3800000005, %rax     # imm = 0x3800000005
movq %rax, (%rdi)
movl $0x5, 0x8(%rdi)
movb $0x3f, 0xc(%rdi)
movq $0x0, 0x10(%rdi)
callq 0x450ba
movq 0x3138(%rax), %r12
callq 0x450ba
movslq 0x3158(%rax), %rdx
movl $0x4, (%rbx)
leaq 0x1(%r15), %rax
movq %rax, -0x28(%rbp)
cmpb $0x20, 0x1(%r15)
jne 0x441bd
leaq 0x3(%r15), %rdi
movq %rdi, -0x28(%rbp)
cmpb $0x22, 0x3(%r15,%rdx)
jne 0x4408c
movq %r12, %rsi
callq 0x9230
testl %eax, %eax
je 0x440b0
callq 0x450ba
movl $0x2a, %r15d
cmpq $0x0, 0x3168(%rax)
jne 0x440f2
movq -0x28(%rbp), %rax
movb (%rax), %cl
cmpb $0x22, %cl
jne 0x440b8
xorl %ecx, %ecx
jmp 0x440d2
movl $0x29, %r15d
jmp 0x440f2
xorl %edx, %edx
movb %cl, -0x130(%rbp,%rdx)
movb 0x1(%rax,%rdx), %cl
incq %rdx
cmpb $0x22, %cl
jne 0x440ba
movl %edx, %ecx
addq %rdx, %rax
movq %rax, -0x28(%rbp)
movb $0x0, -0x130(%rbp,%rcx)
callq 0x450ba
leaq -0x130(%rbp), %rsi
movq %rax, %rdi
callq 0x44748
movq 0x10(%r14), %rax
movb (%rax,%r15), %al
movb %al, 0xc(%rbx)
movq -0x28(%rbp), %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0x44119
cmpl $0x29, %eax
je 0x44113
incq %rdi
jmp 0x44101
movq %rdi, -0x28(%rbp)
jmp 0x4416c
movsbl %al, %ecx
movq %rdi, -0x28(%rbp)
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x4415b
movq -0x28(%rbp), %rdx
movabsq $0x680000000001, %rcx   # imm = 0x680000000001
cmpb $0x2e, %al
ja 0x44143
movzbl %al, %eax
btq %rax, %rcx
jb 0x44157
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %esi
addl $-0x30, %esi
movq %rdi, %rdx
cmpl $0xa, %esi
jae 0x44136
movq %rdx, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
movl $0xa, %edx
callq 0x9680
movl %eax, 0x10(%rbx)
movq -0x28(%rbp), %rdi
cmpb $0x20, (%rdi)
jne 0x441bd
incq %rdi
movq %rdi, -0x28(%rbp)
leaq 0x292ad(%rip), %rsi     # 0x6d430
movl $0x6, %edx
callq 0x9230
testl %eax, %eax
jne 0x441a3
movb 0xc(%rbx), %cl
movq 0x10(%r14), %rax
cmpb 0x28(%rax), %cl
je 0x441a3
movl 0x10(%rbx), %ecx
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x441b9
cmpl $0x29, %ecx
je 0x441b9
incq %rax
jmp 0x441a7
movq %rax, -0x28(%rbp)
movq %rbx, %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq