// File: /workspace/github_cpp_makefile_star2_O3/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 0x3e441
leaq -0x1(%r12), %rdi
movq %rdi, (%r15)
movb -0x1(%r12), %al
movsbl %al, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x3e49c
movabsq $0x680000000001, %rcx   # imm = 0x680000000001
cmpb $0x2e, %al
ja 0x3e481
movzbl %al, %eax
btq %rax, %rcx
jb 0x3e496
movq %r12, (%r15)
movb (%r12), %al
movsbl %al, %edx
addl $-0x30, %edx
incq %r12
cmpl $0x9, %edx
ja 0x3e474
decq %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x9680
movq %rax, %r15
callq 0x54409
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq 0x10(%rbx), %rcx
movl 0xc(%rcx), %edx
testb %r14b, %r14b
je 0x3e4f0
cmpl %r15d, %edx
jge 0x3e5ef
movl %r15d, %edx
movq %rdx, 0xc(%rcx)
movq 0x10(%rbx), %rcx
movq -0x28(%rbp), %rdx
movq %rax, 0x3360(%rcx)
movq %rdx, 0x3368(%rcx)
jmp 0x3e65d
cmpl %r15d, %edx
je 0x3e65d
movl %r15d, %eax
movq %rax, 0xc(%rcx)
movq 0x10(%rbx), %r14
callq 0x49360
movl 0x32cc(%rax), %esi
leaq -0x30(%rbp), %rdi
callq 0x54592
movq %rax, 0x3360(%r14)
movq %rdx, 0x3368(%r14)
movq 0x45ac3(%rip), %r14     # 0x83ff0
leaq 0x2ce4a(%rip), %rsi     # 0x6b37e
movl $0x11, %edx
movq %r14, %rdi
callq 0x9560
leaq 0x2ec4a(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %r14, %rdi
callq 0x9560
movq %r14, %rdi
movl $0x247, %esi            # imm = 0x247
callq 0x9880
movq %rax, %r14
leaq 0x2ceeb(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x2ce62(%rip), %rsi     # 0x6b3e2
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 0x2ce44(%rip), %rsi     # 0x6b3ea
movl $0x11, %edx
movq %rax, %rdi
callq 0x9560
movq 0x10(%rbx), %rsi
addq $0xc, %rsi
movq %r14, %rdi
callq 0xe974
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 0x3e65d
movups 0x3360(%rcx), %xmm0
leaq -0x48(%rbp), %rsi
movups %xmm0, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x545ce
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x49360
xorps %xmm0, %xmm0
cvtsi2sdl 0x3284(%rax), %xmm0
mulsd 0x2b3a6(%rip), %xmm0    # 0x699d0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3e65d
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