// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rbx
subq $0x38, %rsp
leaq 0x93ae7(%rip), %rdi     # 0x12409f
callq 0x58e77
callq 0x811da
testl %eax, %eax
je 0x90611
leaq 0x2ab473(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27d15f(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x27d165(%rip), %rcx    # 0x30d748
movl $0x0, (%rcx)
testw %ax, %ax
je 0x90881
leaq 0x27cd33(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0x9060b
leaq 0x18823f(%rip), %rcx    # 0x218844
movl $0x1102, (%rcx)         # imm = 0x1102
movl $0x12b, (%rax)          # imm = 0x12B
callq 0x811da
xorl %eax, %eax
movl %eax, -0xc(%rbp)
movl %eax, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl %eax, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl %eax, -0x18(%rbp)
callq 0x811da
testl %eax, %eax
je 0x9065f
leaq -0xc(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2ab3fe(%rip), %rdi    # 0x33ba40
leaq 0x8d9f8(%rip), %rsi     # 0x11e041
leaq -0x24(%rbp), %rdx
leaq -0x20(%rbp), %r8
leaq -0x1a(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9360
callq 0x811da
testl %eax, %eax
je 0x90694
leaq -0x10(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2ab3c9(%rip), %rdi    # 0x33ba40
leaq 0x8d9c3(%rip), %rsi     # 0x11e041
leaq -0x18(%rbp), %rdx
leaq -0x14(%rbp), %r8
leaq -0x1a(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9360
callq 0x811da
testl %eax, %eax
je 0x9080a
leaq 0x27d090(%rip), %rax    # 0x30d738
cmpw $0x0, (%rax)
je 0x9080a
leaq 0x2ab387(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27cb13(%rip), %rcx    # 0x30d1d8
movl (%rcx), %edx
testl %eax, %eax
je 0x907d3
orl $0x80, %edx
movl %edx, (%rcx)
leaq 0x27cdc6(%rip), %rax    # 0x30d4a4
testb $0x8, (%rax)
jne 0x907db
leaq 0x1ae7ee(%rip), %rax    # 0x23eedc
cmpb $0x0, (%rax)
je 0x907fd
movl -0xc(%rbp), %eax
movl -0x24(%rbp), %edx
movl -0x20(%rbp), %esi
testl %eax, %eax
jne 0x90722
testl %edx, %edx
jne 0x90722
testl %esi, %esi
jne 0x90722
cmpl $0x0, -0x18(%rbp)
jne 0x90722
cmpl $0x0, -0x14(%rbp)
jne 0x90722
cmpl $0x0, -0x10(%rbp)
je 0x907fd
testl %eax, %eax
sete %cl
cmpl $0x64, %eax
setge %dil
orb %cl, %dil
jne 0x9073b
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %edi
callq 0xd4110
movsd %xmm0, -0x30(%rbp)
movl -0x18(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x10(%rbp), %edx
xorpd %xmm0, %xmm0
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0xd41e0
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
leaq 0x27cdd8(%rip), %rax    # 0x30d560
movsd %xmm1, (%rax)
leaq 0x27cd9d(%rip), %rax    # 0x30d530
subsd (%rax), %xmm1
xorl %eax, %eax
ucomisd 0x8d93f(%rip), %xmm1    # 0x11e0e0
setb %al
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
leal (%rax,%rax,4), %eax
cmoval %ebx, %eax
leaq 0x27ca37(%rip), %rcx    # 0x30d1f0
movl %eax, (%rcx)
leaq 0x27cda6(%rip), %rcx    # 0x30d568
movl %eax, (%rcx)
cvttsd2si %xmm1, %eax
leaq 0x27ca1d(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
jmp 0x907fd
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movl %edx, (%rcx)
leaq 0x27cd7e(%rip), %rax    # 0x30d560
movq $0x0, (%rax)
leaq 0x27cd78(%rip), %rax    # 0x30d568
xorl %ecx, %ecx
movl %ecx, (%rax)
leaq 0x27c9f5(%rip), %rax    # 0x30d1f0
movl %ecx, (%rax)
leaq 0x27ca94(%rip), %rax    # 0x30d298
movl $0x20, (%rax)
callq 0x811da
testl %eax, %eax
je 0x90881
leaq 0x27cf1a(%rip), %rax    # 0x30d734
cmpl $0x0, (%rax)
jne 0x90834
leaq 0x2ab21a(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27cef6(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x27cae1(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x90881
leaq 0x27cccd(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x27ced1(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x90881
leaq 0x187fcf(%rip), %rcx    # 0x218844
movl $0x7f7, (%rcx)          # imm = 0x7F7
movl $0x27, (%rax)
addq $0x38, %rsp
popq %rbx
popq %rbp
retq