// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Parser.cpp
// Function: Parser::ParseTime(char*, char**, bool)
void Parser::ParseTime(char *msg, char **end_ptr, bool is_new_cycle) {
  while (!isspace(*msg))
    msg++;
  *end_ptr = msg;
  int time = parser::get_int(end_ptr);

  RealTime real_time = GetRealTimeParser();

  /* if (mpObserver->IsPlanned()) { // -- 决策完了，才收到信息
          std::cerr << "# " << mpObserver->SelfUnum() << " @ " <<
  mpObserver->CurrentTime() << " got a deprecated message" << std::endl;
  }*/

  if (is_new_cycle == true) {
    /** player: sense msg & hear msg */
    /** coach:  sight msg & hear msg */
    if (time > mpObserver->CurrentTime().T()) // new cycle
    {
      mpObserver->SetCurrentTime(Time(time, 0));
      mpObserver->SetLastCycleBeginRealTime(real_time);
    } else {
      if (real_time - mpObserver->GetLastCycleBeginRealTime() >
          ServerParam::instance().simStep() *
              0.7) // stoppage time, add some buffer
      {
        mpObserver->SetCurrentTime(
            Time(time, mpObserver->CurrentTime().S() + 1));
        mpObserver->SetLastCycleBeginRealTime(real_time);
      } else {
        // the current time has been set by another msg just now
      }
    }
  } else {
    /** player: sight msg */
    if (time != mpObserver->CurrentTime().T()) // new cycle -- miss a sense
    {
      mpObserver->SetCurrentTime(Time(time, 0));
      mpObserver->SetLastCycleBeginRealTime(
          real_time - ServerParam::instance().synchOffset());

      PRINT_ERROR("Player " << mpObserver->SelfUnum() << " miss a sense at "
                            << mpObserver->CurrentTime());
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %ecx, %r14d
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movsbl (%r12), %edi
callq 0x90c0
incq %r12
testl %eax, %eax
je 0x3f47d
leaq -0x1(%r12), %rdi
movq %rdi, (%r15)
movb -0x1(%r12), %al
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x3f4d8
movabsq $0x680000000001, %rcx   # imm = 0x680000000001
cmpb $0x2e, %al
ja 0x3f4bd
movzbl %al, %eax
btq %rax, %rcx
jb 0x3f4d2
movq %r12, (%r15)
movb (%r12), %al
movsbl %al, %edx
addl $-0x30, %edx
incq %r12
cmpl $0x9, %edx
ja 0x3f4b0
decq %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x9680
movq %rax, %r15
callq 0x55bfd
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq 0x10(%rbx), %rcx
movl 0xc(%rcx), %edx
testb %r14b, %r14b
je 0x3f52c
cmpl %r15d, %edx
jge 0x3f62b
movl %r15d, %edx
movq %rdx, 0xc(%rcx)
movq 0x10(%rbx), %rcx
movq -0x28(%rbp), %rdx
movq %rax, 0x3360(%rcx)
movq %rdx, 0x3368(%rcx)
jmp 0x3f699
cmpl %r15d, %edx
je 0x3f699
movl %r15d, %eax
movq %rax, 0xc(%rcx)
movq 0x10(%rbx), %r14
callq 0x4a75c
movl 0x32cc(%rax), %esi
leaq -0x30(%rbp), %rdi
callq 0x55da0
movq %rax, 0x3360(%r14)
movq %rdx, 0x3368(%r14)
movq 0x47a87(%rip), %r14     # 0x86ff0
leaq 0x2de36(%rip), %rsi     # 0x6d3a6
movl $0x11, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x2fc3e(%rip), %rsi     # 0x6f1c2
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x247, %esi            # imm = 0x247
callq 0x9880
movq %rax, %r14
leaq 0x2ded7(%rip), %rsi     # 0x6d47f
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x2de4e(%rip), %rsi     # 0x6d40a
movl $0x7, %edx
movq %r14, %rdi
callq 0x9560
movq 0x10(%rbx), %rax
movl 0x2c(%rax), %esi
movq %r14, %rdi
callq 0x9880
movq %rax, %r14
leaq 0x2de30(%rip), %rsi     # 0x6d412
movl $0x11, %edx
movq %rax, %rdi
callq 0x9560
movq 0x10(%rbx), %rsi
addq $0xc, %rsi
movq %r14, %rdi
callq 0xea74
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %rbx, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
jmp 0x3f699
movups 0x3360(%rcx), %xmm0
leaq -0x48(%rbp), %rsi
movups %xmm0, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x55de4
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x4a75c
xorps %xmm0, %xmm0
cvtsi2sdl 0x3284(%rax), %xmm0
mulsd 0x2c36a(%rip), %xmm0    # 0x6b9d0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3f699
movq 0x10(%rbx), %rax
movl 0x10(%rax), %ecx
incl %ecx
shlq $0x20, %rcx
movl %r15d, %edx
orq %rcx, %rdx
movq %rdx, 0xc(%rax)
movq 0x10(%rbx), %rax
movupd -0x30(%rbp), %xmm0
movupd %xmm0, 0x3360(%rax)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq