// File: /workspace/github_cpp_makefile_star2_O2/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, %r15d
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
decq %r12
movsbl 0x1(%r12), %edi
incq %r12
callq 0x90b0
testl %eax, %eax
je 0x35270
movq %r12, (%r14)
movq %r14, %rdi
callq 0x38103
movl %eax, %r14d
callq 0x4746d
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq 0x10(%rbx), %rcx
movl 0xc(%rcx), %edx
testb %r15b, %r15b
je 0x352d4
cmpl %edx, %r14d
jle 0x3538f
movl %r14d, %edx
movq %rdx, 0xc(%rcx)
movq 0x10(%rbx), %rcx
movq -0x28(%rbp), %rdx
movq %rax, 0x3360(%rcx)
movq %rdx, 0x3368(%rcx)
jmp 0x353f7
cmpl %edx, %r14d
je 0x353f7
movl %r14d, %eax
movq %rax, 0xc(%rcx)
movq 0x10(%rbx), %r14
callq 0x3db2c
movl 0x32cc(%rax), %esi
leaq -0x30(%rbp), %rdi
callq 0x475ca
movq %rax, 0x3360(%r14)
movq %rdx, 0x3368(%r14)
movq 0x41cdf(%rip), %rdi     # 0x76ff0
leaq 0x2402e(%rip), %rsi     # 0x59346
callq 0x94b0
leaq 0x25e4e(%rip), %rsi     # 0x5b172
movq %rax, %rdi
callq 0x94b0
movq %rax, %rdi
movl $0x247, %esi            # imm = 0x247
callq 0x9890
leaq 0x240df(%rip), %rsi     # 0x5941f
movq %rax, %rdi
callq 0x94b0
leaq 0x2405b(%rip), %rsi     # 0x593aa
movq %rax, %rdi
callq 0x94b0
movq 0x10(%rbx), %rcx
movl 0x2c(%rcx), %esi
movq %rax, %rdi
callq 0x9890
leaq 0x24045(%rip), %rsi     # 0x593b2
movq %rax, %rdi
callq 0x94b0
movq 0x10(%rbx), %rsi
addq $0xc, %rsi
movq %rax, %rdi
callq 0xd465
movq %rax, %rdi
callq 0x99e8
jmp 0x353f7
movups 0x3360(%rcx), %xmm0
leaq -0x48(%rbp), %rsi
movups %xmm0, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x475fc
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x3db2c
cvtsi2sdl 0x3284(%rax), %xmm0
mulsd 0x23f54(%rip), %xmm0    # 0x59318
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x353f7
movq 0x10(%rbx), %rax
movl 0x10(%rax), %ecx
incl %ecx
shlq $0x20, %rcx
movl %r14d, %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