// File: 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
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x128(%rbp)
movq %rdi, %rax
movq %rax, -0x138(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
callq 0x783d0
callq 0x798a0
movq %rax, %rdi
callq 0x11db0
movq %rax, %rdi
callq 0xa240
movq %rax, -0x18(%rbp)
callq 0x798a0
movq %rax, %rdi
callq 0x78430
movq -0x128(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x4, (%rdi)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x77583
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x22, %eax
jne 0x773bf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0xa2c0
cmpl $0x0, %eax
jne 0x773bf
movq -0x130(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6e5b0
movq %rax, %rcx
movq -0x128(%rbp), %rax
movb (%rcx), %cl
movb %cl, 0xc(%rax)
jmp 0x77453
callq 0x798a0
movq %rax, %rdi
callq 0x5c590
movq %rax, %rdi
callq 0xa9f0
testb $0x1, %al
jne 0x773da
jmp 0x77434
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x77414
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %cl
movl -0x20(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
cltq
movb %cl, -0x120(%rbp,%rax)
jmp 0x773e1
movslq -0x20(%rbp), %rax
movb $0x0, -0x120(%rbp,%rax)
callq 0x798a0
movq %rax, %rdi
leaq -0x120(%rbp), %rsi
callq 0x78450
movq -0x130(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x784e0
movq %rax, %rcx
movq -0x128(%rbp), %rax
movb (%rcx), %cl
movb %cl, 0xc(%rax)
jmp 0x77455
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x139(%rbp)
je 0x7747c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
setne %al
movb %al, -0x139(%rbp)
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x77488
jmp 0x77496
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x77455
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x774b7
leaq -0x10(%rbp), %rdi
callq 0x77bf0
movl %eax, %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x77581
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x4c032(%rip), %rsi     # 0xc3510
movl $0x6, %edx
callq 0xa2c0
cmpl $0x0, %eax
jne 0x7753c
movq -0x130(%rbp), %rax
movq -0x128(%rbp), %rcx
movsbl 0xc(%rcx), %ecx
movl %ecx, -0x140(%rbp)
movq 0x10(%rax), %rdi
callq 0x6e590
movq %rax, %rcx
movl -0x140(%rbp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x77520
jmp 0x7753a
movq -0x128(%rbp), %rax
movq -0x130(%rbp), %rcx
movq 0x10(%rcx), %rdi
movl 0x10(%rax), %esi
callq 0x78410
jmp 0x7753c
jmp 0x7753e
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x141(%rbp)
je 0x77565
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
setne %al
movb %al, -0x141(%rbp)
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0x77571
jmp 0x7757f
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x7753e
jmp 0x77581
jmp 0x77583
movq -0x138(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)