// File: /workspace/github_cpp_makefile_star2_O1/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 0x811da
movl $0x4, %edi
callq 0x83e83
movl $0x2, %edi
callq 0x83e83
movl $0x2, %edi
callq 0x83e83
callq 0x811da
callq 0x811da
testl %eax, %eax
je 0x83c8e
leaq 0x2b7dec(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x289844(%rip), %rcx    # 0x30d4a4
movl $0xfffffeca, %edx       # imm = 0xFFFFFECA
andl (%rcx), %edx
movl %edx, (%rcx)
testl %eax, %eax
je 0x83c7e
cmpl $0x1, %eax
je 0x83c8e
cmpl $0x2, %eax
jne 0x83c85
movl $0x1, %eax
jmp 0x83c8a
movl $0x100, %eax            # imm = 0x100
jmp 0x83c8a
movl $0x4, %eax
orl %eax, %edx
movl %edx, (%rcx)
movl $0x4, %edi
callq 0x83e83
leaq 0x2b7da1(%rip), %r15    # 0x33ba40
movq %r15, %rdi
callq 0x95e0
movl %eax, %ebx
movl $0x2, %edi
callq 0x83e83
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
movl $0x2, %edi
callq 0x83e83
movq %r15, %rdi
callq 0x95e0
movl %eax, %r15d
callq 0x811da
callq 0x811da
xorl %r12d, %r12d
movl $0x0, %r13d
testl %eax, %eax
je 0x83d5f
leaq 0x2b7d4f(%rip), %rdi    # 0x33ba40
callq 0x95e0
testl %eax, %eax
je 0x83d5f
leaq 0x289a33(%rip), %rcx    # 0x30d734
cmpl $0x0, (%rcx)
jne 0x83d0f
leaq 0x289a1b(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x289606(%rip), %rcx    # 0x30d31c
cmpl $0x0, (%rcx)
jne 0x83d5c
leaq 0x2897f2(%rip), %rdx    # 0x30d514
cmpl $0x7e1, (%rdx)          # imm = 0x7E1
setge %dl
leaq 0x2899f6(%rip), %rsi    # 0x30d728
movl (%rsi), %esi
cmpl $0x12, %esi
setl %dil
andb %dl, %dil
cmpl $0x11, %esi
setl %dl
orb %dil, %dl
jne 0x83d5c
leaq 0x194af4(%rip), %rdx    # 0x218844
movl $0x7f1, (%rdx)          # imm = 0x7F1
movl $0x21, (%rcx)
movl %eax, %r13d
callq 0x811da
testl %eax, %eax
je 0x83d77
leaq 0x2b7cd1(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r12d
leaq 0x28945a(%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 0x83e49
orl $0x80, %ecx
movl %ecx, (%rax)
movl %ebx, %edi
movl %r14d, %esi
movl %r15d, %edx
callq 0xd4110
movsd %xmm0, -0x30(%rbp)
xorl %ebx, %ebx
movsd 0x8530f(%rip), %xmm0    # 0x1090f8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
leaq 0x289760(%rip), %rax    # 0x30d560
movsd %xmm0, (%rax)
leaq 0x289725(%rip), %rax    # 0x30d530
subsd (%rax), %xmm0
ucomisd 0x9a2c9(%rip), %xmm0    # 0x11e0e0
movl $0x57, %eax
cmovael %ebx, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmoval %ebx, %eax
leaq 0x289737(%rip), %rcx    # 0x30d568
leaq 0x2893b8(%rip), %rdx    # 0x30d1f0
movl %eax, (%rdx)
movl %eax, (%rcx)
cvttsd2si %xmm0, %eax
leaq 0x2893a5(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
leaq 0x289448(%rip), %rax    # 0x30d298
movl $0x57, (%rax)
callq 0x811da
testl %eax, %eax
je 0x83e74
leaq 0x2b7bda(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x289f12(%rip), %rcx    # 0x30dd84
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq