// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: update_gps_screen(int)
void update_gps_screen(int why)
{
double jd0;

   // this routine handles the primary_timing() function for non-TSIP receivers
   // It drives the main screen update cycle

   // once a Venus receiver has NMEA messages enabled, it stops sending the
   // NAV message, so we need to fake the tow and gps week numbers from the
   // NMEA date/time
//if(debug_file) fprintf(debug_file, "ugs(%d)  msg:%d  line:%d\n", why, star_msg, star_line);

   if(TOW_AND_WEEK) {  // synthesize the GPS week and time-of-week
      tow = fake_tow(jd_utc);
      if(timing_mode != TMODE_GPS) tow += utc_offset;
      tow %= (7L*24L*60L*60L);
      this_tow = survey_tow = pri_tow = tow;
      have_tow = 999;

      jd0 = jd_utc;
      if(timing_mode != TMODE_GPS) jd0 += jtime(0,0,utc_offset,0.0);  // we are in UTC time, convert to GPS time

      jd0 -= GPS_EPOCH;
      gps_week = (int) (jd0 / 7.0);
      if(have_week == 0) need_redraw = 2054;
      have_week = 999;
      faked_tow = 1;
//sprintf(plot_title, "fake week:%d  jd0:%f  tmode:%d  ofs:%d", gps_week,jd0, timing_mode, utc_offset);
   }
   else if(!have_tow) {
      tow = this_tow = survey_tow = pri_tow = fake_tow(jd_utc) % (7L*24L*60L*60L);
      faked_tow = 2;
   }
   else faked_tow = 0;

   if(RCVR_SENDS_ID) ;
   else { // force log header dump
      have_info |= ALL_ID_INFO;
   }

   primary_timing(0);     // show time and lla info
   secondary_timing(0);   // validate receiver time, etc values and update screen
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x28de24(%rip), %rbx    # 0x2f732c
movl (%rbx), %eax
cmpl $0x3e7, %eax            # imm = 0x3E7
je 0x69519
testl %eax, %eax
jne 0x695ed
leaq 0x28e010(%rip), %r14    # 0x2f7530
movsd (%r14), %xmm0
callq 0xbdecf
leaq 0x28df8c(%rip), %rcx    # 0x2f74bd
movb (%rcx), %cl
leaq 0x28e1ee(%rip), %rsi    # 0x2f7728
movl $0x0, %edx
testb %cl, %cl
je 0x69545
movl (%rsi), %edx
addl %edx, %eax
movl $0x93a80, %edi          # imm = 0x93A80
xorl %edx, %edx
divl %edi
leaq 0x28e1e5(%rip), %rax    # 0x2f773c
movl %edx, (%rax)
leaq 0x28e1e4(%rip), %rax    # 0x2f7744
movl %edx, (%rax)
leaq 0x28e1e7(%rip), %rax    # 0x2f7750
movq %rdx, (%rax)
leaq 0x28e1cd(%rip), %rax    # 0x2f7740
movl %edx, (%rax)
leaq 0x28ddac(%rip), %rax    # 0x2f7328
movl $0x3e7, (%rax)          # imm = 0x3E7
movsd (%r14), %xmm0
testb %cl, %cl
je 0x695b2
movl (%rsi), %edx
movsd %xmm0, -0x18(%rbp)
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
callq 0xc2faf
movsd -0x18(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
addsd 0x8c34e(%rip), %xmm0    # 0xf5908
divsd 0x8c3be(%rip), %xmm0    # 0xf5980
cvttsd2si %xmm0, %eax
leaq 0x28e16b(%rip), %rcx    # 0x2f7738
movw %ax, (%rcx)
cmpl $0x0, (%rbx)
jne 0x695e2
leaq 0x199268(%rip), %rax    # 0x202844
movl $0x806, (%rax)          # imm = 0x806
movl $0x3e7, (%rbx)          # imm = 0x3E7
pushq $0x1
popq %rax
jmp 0x695fb
leaq 0x28dd34(%rip), %rcx    # 0x2f7328
xorl %eax, %eax
cmpl $0x0, (%rcx)
je 0x6963a
leaq 0x28e146(%rip), %rcx    # 0x2f7748
movl %eax, (%rcx)
leaq 0x1992c5(%rip), %rax    # 0x2028d0
movabsq $0x19bb7b9bfc, %rcx     # imm = 0x19BB7B9BFC
testq %rcx, (%rax)
jne 0x69624
leaq 0x28e353(%rip), %rax    # 0x2f7974
orb $0xf, (%rax)
xorl %edi, %edi
callq 0x6c10a
xorl %edi, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x6caa5
leaq 0x28deef(%rip), %rax    # 0x2f7530
movsd (%rax), %xmm0
callq 0xbdecf
movl $0x93a80, %ecx          # imm = 0x93A80
xorl %edx, %edx
divl %ecx
leaq 0x28e0ea(%rip), %rax    # 0x2f7744
movl %edx, (%rax)
leaq 0x28e0ed(%rip), %rax    # 0x2f7750
movq %rdx, (%rax)
leaq 0x28e0d3(%rip), %rax    # 0x2f7740
movl %edx, (%rax)
leaq 0x28e0c6(%rip), %rax    # 0x2f773c
movl %edx, (%rax)
pushq $0x2
jmp 0x695ea