// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rdx, -0x28(%rbp)
movabsq $0x7fefffffffffffff, %r12 # imm = 0x7FEFFFFFFFFFFFFF
movq %r12, (%rdi)
movq %r12, 0x8(%rdi)
movq %r12, 0x10(%rdi)
movq %r12, 0x18(%rdi)
movq %r12, 0x20(%rdi)
movq %r12, 0x28(%rdi)
xorl %eax, %eax
movb %al, 0x30(%rdi)
movq %r12, 0x38(%rdi)
movw $0x0, 0x40(%rdi)
movb %al, 0x42(%rdi)
movl $0x0, 0x44(%rdi)
movb (%rdx), %al
movsbl %al, %ecx
addl $-0x30, %ecx
movabsq $0x680000000001, %r15   # imm = 0x680000000001
cmpl $0xa, %ecx
jb 0x4238d
cmpb $0x2e, %al
ja 0x42378
movzbl %al, %eax
btq %rax, %r15
jb 0x42389
movb 0x1(%rdx), %al
incq %rdx
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x4236b
movq %rdx, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %rdx, %rdi
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, (%rbx)
movq (%r14), %rdi
movb (%rdi), %al
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x423d2
cmpb $0x2e, %al
ja 0x423bd
movzbl %al, %eax
btq %rax, %r15
jb 0x423ce
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x423b0
movq %rdi, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x8(%rbx)
movq (%r14), %rdi
movzbl (%rdi), %eax
cmpl $0x29, %eax
je 0x42429
cmpl $0x20, %eax
jne 0x42401
leaq 0x1(%rdi), %rcx
movq %rcx, -0x28(%rbp)
movb 0x1(%rdi), %al
movq %rcx, %rdi
cmpb $0x66, %al
je 0x4241e
movzbl %al, %eax
cmpl $0x6b, %eax
je 0x42418
cmpl $0x74, %eax
jne 0x42429
movb $0x1, 0x40(%rbx)
jmp 0x42422
movb $0x1, 0x41(%rbx)
jmp 0x42422
movb $0x1, 0x42(%rbx)
incq %rdi
movq %rdi, -0x28(%rbp)
movb (%rdi), %al
cmpb $0x29, %al
je 0x424d0
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x42460
cmpb $0x2e, %al
ja 0x4244b
movzbl %al, %eax
btq %rax, %r15
jb 0x4245c
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x4243e
movq %rdi, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x10(%rbx)
movq (%r14), %rdi
movzbl (%rdi), %eax
cmpl $0x29, %eax
je 0x424a6
cmpl $0x20, %eax
jne 0x424d0
leaq 0x1(%rdi), %rax
movq %rax, -0x28(%rbp)
movzbl 0x1(%rdi), %ecx
cmpl $0x66, %ecx
je 0x424b7
cmpl $0x6b, %ecx
je 0x424b1
cmpl $0x74, %ecx
jne 0x425fc
movb $0x1, 0x40(%rbx)
jmp 0x424bb
movb $0x1, 0x30(%rbx)
movsd %xmm0, 0x38(%rbx)
jmp 0x424cc
movb $0x1, 0x41(%rbx)
jmp 0x424bb
movb $0x1, 0x42(%rbx)
addq $0x2, %rdi
movq %rdi, -0x28(%rbp)
movsd %xmm0, 0x38(%rbx)
movb $0x1, 0x30(%rbx)
movq %r12, 0x10(%rbx)
movb (%rdi), %al
cmpb $0x29, %al
je 0x426a5
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x42507
cmpb $0x2e, %al
ja 0x424f2
movzbl %al, %eax
btq %rax, %r15
jb 0x42503
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x424e5
movq %rdi, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x20(%rbx)
movq (%r14), %rdi
movb (%rdi), %al
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x4254a
cmpb $0x2e, %al
ja 0x42535
movzbl %al, %eax
btq %rax, %r15
jb 0x42546
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x42528
movq %rdi, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x28(%rbx)
movq (%r14), %rax
cmpb $0x20, (%rax)
jne 0x426a5
leaq 0x1(%rax), %rdi
movq %rdi, -0x28(%rbp)
movzbl 0x1(%rax), %eax
cmpl $0x66, %eax
je 0x42594
cmpl $0x6b, %eax
je 0x4258b
cmpl $0x74, %eax
jne 0x4259d
movb $0x1, 0x40(%rbx)
jmp 0x426a5
movb $0x1, 0x41(%rbx)
jmp 0x426a5
movb $0x1, 0x42(%rbx)
jmp 0x426a5
movsbl %al, %ecx
movb $0x1, 0x30(%rbx)
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x425ce
cmpb $0x2e, %al
ja 0x425b9
movzbl %al, %eax
btq %rax, %r15
jb 0x425ca
movb 0x1(%rdi), %al
incq %rdi
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x425ac
movq %rdi, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x38(%rbx)
movq (%r14), %rax
cmpb $0x20, (%rax)
jne 0x426a5
incq %rax
movb $0x20, %cl
cmpb $0x20, %cl
jne 0x42646
movb (%rax), %cl
incq %rax
jmp 0x425f0
movsbl %cl, %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jb 0x4262a
cmpb $0x2e, %cl
ja 0x42615
movzbl %cl, %ecx
btq %rcx, %r15
jb 0x42626
movb 0x1(%rax), %cl
incq %rax
movsbl %cl, %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jae 0x42607
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x93a0
movsd %xmm0, 0x18(%rbx)
movq (%r14), %rdi
jmp 0x424d0
movzbl %cl, %ecx
cmpl $0x66, %ecx
je 0x4265e
cmpl $0x6b, %ecx
je 0x42664
cmpl $0x74, %ecx
jne 0x4267e
movb $0x1, 0x40(%rbx)
jmp 0x42668
movb $0x1, 0x42(%rbx)
jmp 0x42668
movb $0x1, 0x41(%rbx)
movq %rax, -0x28(%rbp)
decq %rax
leaq 0x1(%rax), %rcx
cmpb $0x20, 0x1(%rax)
movq %rcx, %rax
je 0x4266f
jmp 0x42684
decq %rax
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
movzbl (%rcx), %eax
cmpl $0x72, %eax
je 0x4269e
cmpl $0x79, %eax
jne 0x426a5
movl $0x1, 0x44(%rbx)
jmp 0x426a5
movl $0x2, 0x44(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop