// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_crw()
void parse_crw()
{
int i;
int tls, fls;
int pps;
int yy;
int mm;
int dd;

   // leapsecond info

   if(get_msg_field()) {  // eat the TPS1
   }

   i = 0;
   fls = tls = 0;

   get_fixed_field(4);
   yy = atoi(msg_field);
   get_fixed_field(2);
   mm = atoi(msg_field);
   get_fixed_field(2);
   dd = atoi(msg_field);
   if(get_msg_field()) {  // hour/min/sec
   }

   if(get_msg_field()) {  // time validity
      i = atoi(msg_field);
      time_flags &= (~(TFLAGS_USER_TIME | TFLAGS_GNSS_MASK | TFLAGS_UTC | TFLAGS_INVALID | TFLAGS_RTC));
      if     (i == 0) time_flags |= TFLAGS_RTC;  // time from rtc chip
      else if(i == 1) ;  // GPS time
      else if(i == 2) time_flags |= TFLAGS_UTC;
//    else if(i == 3) time_flags |= TFLAGS_GLONASS;
      else            time_flags |= TFLAGS_INVALID;
   }

   get_fixed_field(4);
   yy = atoi(msg_field);
   get_fixed_field(2);
   mm = atoi(msg_field);
   get_fixed_field(2);
   dd = atoi(msg_field);
   if(get_msg_field()) {  // hour/min/sec - should be 000000
   }

   if(get_msg_field()) {  // utc offset
      tls = atoi(msg_field);
      if(tls) {
         if(!user_set_utc_ofs) utc_offset = tls;
         check_utc_ofs(33);
      }
   }

   if(get_msg_field()) {  // future utc offset
      fls = atoi(msg_field);
   }

   minor_alarms &= (~MINOR_LEAP_PEND);
   if(yy && mm && dd && fls && tls && (fls != tls)) {
      minor_alarms |= MINOR_LEAP_PEND;
      jd_leap = jdate(yy,mm,dd) + jtime(0,0,0,-1.0);  // -1 since says 2017/1/1
      have_jd_leap = 87;
      calc_jd_leap(87);
   }
   have_leap_info = 87;

   if(get_msg_field()) {  // pps source
      pps = atoi(msg_field);
      esip_time_source = pps;
      if(0) {
         time_flags &= (~(TFLAGS_USER_TIME | TFLAGS_GNSS_MASK | TFLAGS_UTC | TFLAGS_INVALID | TFLAGS_RTC));
         if     (pps == 0) time_flags |= TFLAGS_USER_TIME;  // time from rtc chip
         else if(pps == 1) ;  // GPS time
         else if(pps == 2) time_flags |= TFLAGS_UTC;
         else if(pps == 3) time_flags |= TFLAGS_GLONASS;
         else              time_flags |= TFLAGS_INVALID;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x810b1
movl $0x4, %edi
callq 0x83d8c
movl $0x2, %edi
callq 0x83d8c
movl $0x2, %edi
callq 0x83d8c
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x83b97
leaq 0x2b7ee3(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28993b(%rip), %rcx    # 0x30d4a4
movl $0xfffffeca, %edx       # imm = 0xFFFFFECA
andl (%rcx), %edx
movl %edx, (%rcx)
testl %eax, %eax
je 0x83b87
cmpl $0x1, %eax
je 0x83b97
cmpl $0x2, %eax
jne 0x83b8e
movl $0x1, %eax
jmp 0x83b93
movl $0x100, %eax            # imm = 0x100
jmp 0x83b93
movl $0x4, %eax
orl %eax, %edx
movl %edx, (%rcx)
movl $0x4, %edi
callq 0x83d8c
leaq 0x2b7e98(%rip), %r15    # 0x33ba40
movq %r15, %rdi
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83d8c
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
movl $0x2, %edi
callq 0x83d8c
movq %r15, %rdi
callq 0x95e0
movl %eax, %r15d
callq 0x810b1
callq 0x810b1
xorl %r12d, %r12d
movl $0x0, %r13d
testl %eax, %eax
je 0x83c68
leaq 0x2b7e46(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x83c68
leaq 0x289b2a(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x83c18
leaq 0x289b12(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x2896fd(%rip), %rcx    # 0x30d31c
cmpl $0x0, (%rcx)
jne 0x83c65
leaq 0x2898e9(%rip), %rdx    # 0x30d514
cmpl $0x7e1, (%rdx)          # imm = 0x7E1
setge %dl
leaq 0x289aed(%rip), %rsi    # 0x30d728
movl (%rsi), %esi
cmpl $0x12, %esi
setl %dil
andb %dl, %dil
cmpl $0x11, %esi
setl %dl
orb %dil, %dl
jne 0x83c65
leaq 0x194beb(%rip), %rdx    # 0x218844
movl $0x7f1, (%rdx)          # imm = 0x7F1
movl $0x21, (%rcx)
movl %eax, %r13d
callq 0x810b1
testl %eax, %eax
je 0x83c80
leaq 0x2b7dc8(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r12d
leaq 0x289551(%rip), %rax    # 0x30d1d8
movl (%rax), %ecx
movl %ecx, %edx
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movl %edx, (%rax)
testl %ebx, %ebx
sete %dl
testl %r14d, %r14d
sete %sil
orb %dl, %sil
testl %r15d, %r15d
sete %dl
testl %r12d, %r12d
sete %dil
orb %dl, %dil
orb %sil, %dil
testl %r13d, %r13d
sete %dl
cmpl %r13d, %r12d
sete %sil
orb %dl, %sil
orb %dil, %sil
jne 0x83d52
orl $0x80, %ecx
movl %ecx, (%rax)
movl %ebx, %edi
movl %r14d, %esi
movl %r15d, %edx
callq 0xd485e
movsd %xmm0, -0x30(%rbp)
xorl %ebx, %ebx
movsd 0x85406(%rip), %xmm0    # 0x1090f8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd492e
addsd -0x30(%rbp), %xmm0
leaq 0x289857(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x28981c(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
ucomisd 0x9a468(%rip), %xmm0    # 0x11e188
movl $0x57, %eax
cmovael %ebx, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmoval %ebx, %eax
leaq 0x2894b6(%rip), %rcx    # 0x30d1f0
movl %eax, (%rcx)
leaq 0x289825(%rip), %rcx    # 0x30d568
movl %eax, (%rcx)
cvttsd2si %xmm0, %eax
leaq 0x28949c(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x28953f(%rip), %rax    # 0x30d298
movl $0x57, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x83d7d
leaq 0x2b7cd1(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x28a009(%rip), %rcx    # 0x30dd84
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq