// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_star_gps_time()
void parse_star_gps_time()   
{
int ls;
int dd,mm,yy;
int hrs,mins,secs;
char c[2];

   // gps time / leapsecond info
   log_packet_id("Star gps time");

   if(get_msg_field()) {  // GPS week
      gps_week = atoi(msg_field);
      faked_tow = 0;
      if(gps_week == 0) return;   // bogus 0 values will be in the message
      if(have_week == 0) need_redraw = 4354;
      have_week = 299;
   }

   if(get_msg_field()) {  // GPS TOW
      if(0) {   // !!!! we fake the GPS week and tow since this message only comes in every 10+ seconds
         pri_tow = atoi(msg_field);
         tow = pri_tow; 
         this_tow = tow;
         survey_tow = tow;

         if(have_tow == 0) need_redraw = 4029;
         have_tow = 59;
      }
   }

   dd = mm = yy = 0;
   hrs = mins = secs = 0;
   if(get_msg_field()) { // leap dd/mm/yy
      sscanf(msg_field, "%d%c%d%c%d", &dd,&c[0],&mm,&c[0],&yy);
   }
   if(get_msg_field()) { // leap hh/mm/ss
      sscanf(msg_field, "%d%c%d%c%d", &hrs,&c[0],&mins,&c[0],&secs);
   }

   if(get_msg_field()) { // leap pending
      if(gps_week) {  // if week is 0, the message was invalid
         ls = atoi(msg_field);
         if(ls) {
            minor_alarms |= MINOR_LEAP_PEND;

            if(time_flags & TFLAGS_NO_UTC_OFS) {
               jd_leap = 0.0;
               have_jd_leap = 0;
               have_leap_days = 0;
            }
            else if(have_time && (yy || dd || mm || hrs || mins || secs)) {
               if(yy && (yy < 100)) yy += 2000;
               jd_leap = jdate(yy,mm,dd) + jtime(hrs,mins,secs,0.0) - jtime(0,0,1,0.0);
               calc_jd_leap(5);
            }
         }
         else {
            minor_alarms &= (~MINOR_LEAP_PEND);
            jd_leap = 0.0;
            have_jd_leap = 0;
            have_leap_days = 0;
         }
         have_leap_info = 32;
      }
   }

   if(get_msg_field()) {  // leap second count
      ls = atoi(msg_field);
      if(!user_set_utc_ofs) utc_offset = ls;
      check_utc_ofs(39);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0x8a7ec(%rip), %rdi     # 0x10e0c7
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x83931
leaq 0x2a2150(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x273e3c(%rip), %rcx    # 0x2f7738
movw %ax, (%rcx)
leaq 0x273e42(%rip), %rcx    # 0x2f7748
andl $0x0, (%rcx)
testw %ax, %ax
je 0x83b18
leaq 0x273a13(%rip), %rax    # 0x2f732c
cmpl $0x0, (%rax)
jne 0x8392b
leaq 0x17ef1f(%rip), %rcx    # 0x202844
movl $0x1102, (%rcx)         # imm = 0x1102
movl $0x12b, (%rax)          # imm = 0x12B
callq 0x75767
andl $0x0, -0x10(%rbp)
andl $0x0, -0x18(%rbp)
andl $0x0, -0x1c(%rbp)
andl $0x0, -0x4(%rbp)
andl $0x0, -0x8(%rbp)
andl $0x0, -0xc(%rbp)
callq 0x75767
testl %eax, %eax
je 0x83983
leaq -0x10(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2a20da(%rip), %rdi    # 0x325a40
leaq 0x847da(%rip), %rsi     # 0x108147
leaq -0x1c(%rbp), %rdx
leaq -0x18(%rbp), %r8
leaq -0x12(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9350
callq 0x75767
testl %eax, %eax
je 0x839b8
leaq -0x4(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2a20a5(%rip), %rdi    # 0x325a40
leaq 0x847a5(%rip), %rsi     # 0x108147
leaq -0xc(%rbp), %rdx
leaq -0x8(%rbp), %r8
leaq -0x12(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9350
callq 0x75767
testl %eax, %eax
je 0x83ae6
leaq 0x273d6c(%rip), %rax    # 0x2f7738
cmpw $0x0, (%rax)
je 0x83ae6
leaq 0x2a2063(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x2737ef(%rip), %rcx    # 0x2f71d8
movl (%rcx), %edx
testl %eax, %eax
je 0x83ab2
orl $0x80, %edx
movl %edx, (%rcx)
leaq 0x273aa2(%rip), %rax    # 0x2f74a4
testb $0x8, (%rax)
jne 0x83aba
leaq 0x1a54ca(%rip), %rax    # 0x228edc
cmpb $0x0, (%rax)
je 0x83ad9
movl -0x10(%rbp), %edi
movl -0x1c(%rbp), %edx
movl -0x18(%rbp), %esi
testl %edi, %edi
jne 0x83a46
testl %edx, %edx
jne 0x83a46
testl %esi, %esi
jne 0x83a46
cmpl $0x0, -0xc(%rbp)
jne 0x83a46
cmpl $0x0, -0x8(%rbp)
jne 0x83a46
cmpl $0x0, -0x4(%rbp)
je 0x83ad9
testl %edi, %edi
sete %al
cmpl $0x64, %edi
setge %cl
orb %al, %cl
jne 0x83a5e
addl $0x7d0, %edi            # imm = 0x7D0
movl %edi, -0x10(%rbp)
callq 0xc2f07
movsd %xmm0, -0x28(%rbp)
movl -0xc(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0x4(%rbp), %edx
xorpd %xmm0, %xmm0
callq 0xc2faf
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
pushq $0x1
popq %rdx
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
callq 0xc2faf
movsd -0x28(%rbp), %xmm1
subsd %xmm0, %xmm1
leaq 0x273abc(%rip), %rax    # 0x2f7560
movsd %xmm1, (%rax)
pushq $0x5
popq %rdi
callq 0x557cf
jmp 0x83ad9
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movl %edx, (%rcx)
leaq 0x273a9f(%rip), %rax    # 0x2f7560
andq $0x0, (%rax)
leaq 0x273a9c(%rip), %rax    # 0x2f7568
andl $0x0, (%rax)
leaq 0x27371a(%rip), %rax    # 0x2f71f0
andl $0x0, (%rax)
leaq 0x2737b8(%rip), %rax    # 0x2f7298
movl $0x20, (%rax)
callq 0x75767
testl %eax, %eax
je 0x83b18
leaq 0x273c3e(%rip), %rax    # 0x2f7734
cmpl $0x0, (%rax)
jne 0x83b10
leaq 0x2a1f3e(%rip), %rdi    # 0x325a40
callq 0x95e0
leaq 0x273c1a(%rip), %rcx    # 0x2f7728
movl %eax, (%rcx)
pushq $0x27
popq %rdi
callq 0x51a91
addq $0x30, %rsp
popq %rbp
retq