// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Parser.cpp
// Function: Parser::ParseObjProperty(char*)
Parser::ObjProperty Parser::ParseObjProperty(char *msg) {
  ObjProperty result;

  /* 'high' quality only */
  result.dist = parser::get_double(&msg); /* 'high' quality     */
  result.dir = parser::get_double(&msg);

  if (*msg != ')') {
    if (*msg == ' ') {
      ++msg;
    }
    if (*msg == 't') {
      result.tackling = true;
      ++msg;
    } else if (*msg == 'k') {
      result.kicked = true;
      ++msg;
    } else if (*msg == 'f') {
      result.lying = true;
      ++msg;
    }
  }
  if (*msg != ')') {
    result.dist_chg = parser::get_double(&msg); // 也可能是pointdir
    if (*msg == ' ') {                          // 后面还有
      msg++;                                    // 跳过空格
      if (*msg == 't' || *msg == 'k' || *msg == 'f') {
        if (*msg == 't') {
          result.tackling = true;
        } else if (*msg == 'k') {
          result.kicked = true;
        } else
          result.lying = true;
        msg++;
        result.point_dir = result.dist_chg;
        result.pointing = true;
        result.dist_chg = INVALID_VALUE;
      } else {
        result.dir_chg = parser::get_double(&msg);
      }
    } else if (*msg == ')') {
      result.pointing = true;
      result.point_dir = result.dist_chg;
      result.dist_chg = INVALID_VALUE;
    }
  }

  if (*msg != ')') {
    result.body_dir = parser::get_double(&msg);
    result.head_dir = parser::get_double(&msg);
    if (*msg == ' ') { // 后面还有 pointdir and/or tackling/kicked flag
      msg++;
      if (*msg == 't' || *msg == 'k' ||
          *msg == 'f') { // 只有tackling/kicked flag
        if (*msg == 't') {
          result.tackling = true;
        } else if (*msg == 'k') {
          result.kicked = true;
        } else
          result.lying = true;
        msg++;
      } else { // 是数字
        result.pointing = true;
        result.point_dir = parser::get_double(&msg);
        if (*msg == ' ') {
          while (*msg == ' ')
            ++msg;
          if (*msg == 't' || *msg == 'k' || *msg == 'f') {
            if (*msg == 't') {
              result.tackling = true;
              ++msg;
            } else if (*msg == 'k') {
              result.kicked = true;
              ++msg;
            } else {
              result.lying = true;
              ++msg;
            }
            while (*msg == ' ')
              ++msg;
          }
          if (*msg == 'y') {
            result.card_type = CR_Yellow;
            ++msg;
          } else if (*msg == 'r') {
            result.card_type = CR_Red;
            ++msg;
          } else if (*msg != ')') {
            PARSE_ERROR("why come to this place");
          }
        }
      }
    }
  }

  if (*msg != ')') {
    PARSE_ERROR("Should be done with object info here");
  }

  Assert(result.card_type ==
         CR_None); // TODO: server 不会发card_type和foul_charged
  Assert(result.lying == false);

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq -0x18(%rbp), %r14
movq %rdx, (%r14)
callq 0x3844e
movq %r14, %rdi
callq 0x381af
movsd %xmm0, (%rbx)
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x8(%rbx)
movq (%r14), %rax
movzbl (%rax), %ecx
cmpl $0x29, %ecx
je 0x376f1
cmpl $0x20, %ecx
jne 0x37559
leaq 0x1(%rax), %rdx
movq %rdx, -0x18(%rbp)
movb 0x1(%rax), %cl
movq %rdx, %rax
cmpb $0x66, %cl
je 0x37577
movzbl %cl, %ecx
cmpl $0x6b, %ecx
je 0x37571
cmpl $0x74, %ecx
jne 0x37582
movb $0x1, 0x40(%rbx)
jmp 0x3757b
movb $0x1, 0x41(%rbx)
jmp 0x3757b
movb $0x1, 0x42(%rbx)
incq %rax
movq %rax, -0x18(%rbp)
cmpb $0x29, (%rax)
je 0x376f1
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x10(%rbx)
movq (%r14), %rax
movzbl (%rax), %ecx
cmpl $0x29, %ecx
je 0x375cd
cmpl $0x20, %ecx
jne 0x3760a
leaq 0x1(%rax), %rcx
movq %rcx, -0x18(%rbp)
movzbl 0x1(%rax), %ecx
cmpl $0x66, %ecx
je 0x375de
cmpl $0x6b, %ecx
je 0x375d8
cmpl $0x74, %ecx
jne 0x37654
movb $0x1, 0x40(%rbx)
jmp 0x375e2
movb $0x1, 0x30(%rbx)
movsd %xmm0, 0x38(%rbx)
jmp 0x375f3
movb $0x1, 0x41(%rbx)
jmp 0x375e2
movb $0x1, 0x42(%rbx)
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movsd %xmm0, 0x38(%rbx)
movb $0x1, 0x30(%rbx)
movabsq $0x7fefffffffffffff, %rcx # imm = 0x7FEFFFFFFFFFFFFF
movq %rcx, 0x10(%rbx)
cmpb $0x29, (%rax)
je 0x376f1
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x28(%rbx)
movq (%r14), %rax
cmpb $0x20, (%rax)
jne 0x376f1
leaq 0x1(%rax), %rcx
movq %rcx, -0x18(%rbp)
movzbl 0x1(%rax), %eax
cmpl $0x66, %eax
je 0x3766f
cmpl $0x6b, %eax
je 0x37666
cmpl $0x74, %eax
jne 0x37675
movb $0x1, 0x40(%rbx)
jmp 0x376f1
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x18(%rbx)
movq (%r14), %rax
jmp 0x37601
movb $0x1, 0x41(%rbx)
jmp 0x376f1
movb $0x1, 0x42(%rbx)
jmp 0x376f1
movb $0x1, 0x30(%rbx)
movq %r14, %rdi
callq 0x381af
movsd %xmm0, 0x38(%rbx)
movq (%r14), %rax
cmpb $0x20, (%rax)
jne 0x376f1
incq %rax
movb $0x20, %cl
cmpb $0x20, %cl
jne 0x376a3
movq %rax, -0x18(%rbp)
movb (%rax), %cl
incq %rax
jmp 0x37693
movzbl %cl, %edx
cmpl $0x66, %edx
je 0x376c1
cmpl $0x6b, %edx
je 0x376bb
cmpl $0x74, %edx
jne 0x376d4
movb $0x1, 0x40(%rbx)
jmp 0x376c5
movb $0x1, 0x41(%rbx)
jmp 0x376c5
movb $0x1, 0x42(%rbx)
movq %rax, -0x18(%rbp)
incq %rax
movb -0x1(%rax), %cl
cmpb $0x20, %cl
je 0x376c5
cmpb $0x72, %cl
je 0x376ea
movzbl %cl, %eax
cmpl $0x79, %eax
jne 0x376f1
movl $0x1, 0x44(%rbx)
jmp 0x376f1
movl $0x2, 0x44(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop