// File: /workspace/github_cpp_makefile_star2_O2/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 0x75767
pushq $0x4
popq %rbx
movl %ebx, %edi
callq 0x78198
pushq $0x2
popq %r14
movl %r14d, %edi
callq 0x78198
movl %r14d, %edi
callq 0x78198
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x7801c
leaq 0x2ada55(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x27f4ad(%rip), %rcx    # 0x2f74a4
movl $0xfffffeca, %edx       # imm = 0xFFFFFECA
andl (%rcx), %edx
movl %edx, (%rcx)
testl %eax, %eax
je 0x78013
cmpl $0x1, %eax
je 0x7801c
cmpl $0x2, %eax
jne 0x78018
pushq $0x1
popq %rbx
jmp 0x78018
movl $0x100, %ebx            # imm = 0x100
orl %ebx, %edx
movl %edx, (%rcx)
pushq $0x4
popq %rdi
callq 0x78198
leaq 0x2ada15(%rip), %r15    # 0x325a40
movq %r15, %rdi
callq 0x95e0
movl %eax, -0x30(%rbp)
pushq $0x2
popq %r12
movl %r12d, %edi
callq 0x78198
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
movl %r12d, %edi
callq 0x78198
movq %r15, %rdi
callq 0x95e0
movl %eax, %r15d
callq 0x75767
callq 0x75767
xorl %r12d, %r12d
movl $0x0, %r13d
testl %eax, %eax
je 0x780a9
leaq 0x2ad9c2(%rip), %rdi    # 0x325a40
callq 0x95e0
testl %eax, %eax
je 0x780a9
movl %eax, %ebx
leaq 0x27f6a4(%rip), %rax    # 0x2f7734
cmpl $0x0, (%rax)
jne 0x7809e
leaq 0x27f68c(%rip), %rax    # 0x2f7728
movl %ebx, (%rax)
pushq $0x21
popq %rdi
callq 0x51a91
movl %ebx, %r13d
callq 0x75767
testl %eax, %eax
je 0x780c1
leaq 0x2ad987(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, %r12d
leaq 0x27f110(%rip), %rax    # 0x2f71d8
movl (%rax), %ecx
movl %ecx, %edx
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movl %edx, (%rax)
movl -0x30(%rbp), %edi
testl %edi, %edi
sete %dl
testl %r14d, %r14d
sete %sil
orb %dl, %sil
testl %r15d, %r15d
sete %dl
testl %r12d, %r12d
sete %r8b
orb %dl, %r8b
orb %sil, %r8b
testl %r13d, %r13d
sete %dl
cmpl %r13d, %r12d
sete %sil
orb %dl, %sil
orb %r8b, %sil
jne 0x7815e
orl $0x80, %ecx
movl %ecx, (%rax)
movl %r14d, %esi
movl %r15d, %edx
callq 0xc2f07
movsd %xmm0, -0x30(%rbp)
movsd 0x7afca(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xc2faf
addsd -0x30(%rbp), %xmm0
leaq 0x27f41b(%rip), %rax    # 0x2f7560
movsd %xmm0, (%rax)
leaq 0x27f418(%rip), %rax    # 0x2f7568
movl $0x57, (%rax)
pushq $0x57
popq %rdi
callq 0x557cf
leaq 0x27f133(%rip), %rax    # 0x2f7298
movl $0x57, (%rax)
callq 0x75767
testl %eax, %eax
je 0x78189
leaq 0x2ad8c5(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x27fbfd(%rip), %rcx    # 0x2f7d84
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq