// File: /workspace/github_cpp_makefile_star2_O3/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 0x93b53(%rip), %rdi     # 0x12417f
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x90685
leaq 0x2ab3ff(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27d0eb(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x27d0f1(%rip), %rcx    # 0x30d748
movl $0x0, (%rcx)
testw %ax, %ax
je 0x908f1
leaq 0x27ccbf(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0x9067f
leaq 0x1881cb(%rip), %rcx    # 0x218844
movl $0x1102, (%rcx)         # imm = 0x1102
movl $0x12b, (%rax)          # imm = 0x12B
callq 0x810b1
xorl %eax, %eax
movl %eax, -0x18(%rbp)
movl %eax, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl %eax, -0xc(%rbp)
movl %eax, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x810b1
testl %eax, %eax
je 0x906d3
leaq -0x18(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2ab38a(%rip), %rdi    # 0x33ba40
leaq 0x8da0f(%rip), %rsi     # 0x11e0cc
leaq -0x24(%rbp), %rdx
leaq -0x20(%rbp), %r8
leaq -0x1a(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9360
callq 0x810b1
testl %eax, %eax
je 0x90708
leaq -0xc(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2ab355(%rip), %rdi    # 0x33ba40
leaq 0x8d9da(%rip), %rsi     # 0x11e0cc
leaq -0x14(%rbp), %rdx
leaq -0x10(%rbp), %r8
leaq -0x1a(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
callq 0x9360
callq 0x810b1
testl %eax, %eax
je 0x9087a
leaq 0x27d01c(%rip), %rax    # 0x30d738
cmpw $0x0, (%rax)
je 0x9087a
leaq 0x2ab313(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27ca9f(%rip), %rcx    # 0x30d1d8
movl (%rcx), %edx
testl %eax, %eax
je 0x90843
orl $0x80, %edx
movl %edx, (%rcx)
leaq 0x27cd52(%rip), %rax    # 0x30d4a4
testb $0x8, (%rax)
jne 0x9084b
leaq 0x1ae77a(%rip), %rax    # 0x23eedc
cmpb $0x0, (%rax)
je 0x9086d
movl -0x18(%rbp), %edi
movl -0x24(%rbp), %edx
movl -0x20(%rbp), %esi
testl %edi, %edi
jne 0x90796
testl %edx, %edx
jne 0x90796
testl %esi, %esi
jne 0x90796
cmpl $0x0, -0x14(%rbp)
jne 0x90796
cmpl $0x0, -0x10(%rbp)
jne 0x90796
cmpl $0x0, -0xc(%rbp)
je 0x9086d
testl %edi, %edi
sete %al
cmpl $0x64, %edi
setge %cl
orb %al, %cl
jne 0x907ae
addl $0x7d0, %edi            # imm = 0x7D0
movl %edi, -0x18(%rbp)
callq 0xd485e
movsd %xmm0, -0x30(%rbp)
movl -0x14(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
xorpd %xmm0, %xmm0
callq 0xd492e
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0xd492e
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
leaq 0x27cd68(%rip), %rax    # 0x30d560
movsd %xmm1, (%rax)
leaq 0x27cd2d(%rip), %rax    # 0x30d530
subsd (%rax), %xmm1
xorl %eax, %eax
ucomisd 0x8d977(%rip), %xmm1    # 0x11e188
setb %al
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
leal (%rax,%rax,4), %eax
cmoval %ebx, %eax
leaq 0x27c9c7(%rip), %rcx    # 0x30d1f0
movl %eax, (%rcx)
leaq 0x27cd36(%rip), %rcx    # 0x30d568
movl %eax, (%rcx)
cvttsd2si %xmm1, %eax
leaq 0x27c9ad(%rip), %rcx    # 0x30d1ec
movl %eax, (%rcx)
jmp 0x9086d
andl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
movl %edx, (%rcx)
leaq 0x27cd0e(%rip), %rax    # 0x30d560
movq $0x0, (%rax)
leaq 0x27cd08(%rip), %rax    # 0x30d568
xorl %ecx, %ecx
movl %ecx, (%rax)
leaq 0x27c985(%rip), %rax    # 0x30d1f0
movl %ecx, (%rax)
leaq 0x27ca24(%rip), %rax    # 0x30d298
movl $0x20, (%rax)
callq 0x810b1
testl %eax, %eax
je 0x908f1
leaq 0x27ceaa(%rip), %rax    # 0x30d734
cmpl $0x0, (%rax)
jne 0x908a4
leaq 0x2ab1aa(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x27ce86(%rip), %rcx    # 0x30d728
movl %eax, (%rcx)
leaq 0x27ca71(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x908f1
leaq 0x27cc5d(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x27ce61(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x908f1
leaq 0x187f5f(%rip), %rcx    # 0x218844
movl $0x7f7, (%rcx)          # imm = 0x7F7
movl $0x27, (%rax)
addq $0x38, %rsp
popq %rbx
popq %rbp
retq