// File: /workspace/github_cpp_makefile_star2_O1/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 0x29a09c(%rip), %rbx    # 0x30d32c
movl (%rbx), %eax
cmpl $0x3e7, %eax            # imm = 0x3E7
je 0x732a1
testl %eax, %eax
jne 0x73387
leaq 0x29a288(%rip), %r14    # 0x30d530
movsd (%r14), %xmm0
callq 0xcf04f
leaq 0x29a483(%rip), %rdx    # 0x30d73c
movl %eax, (%rdx)
leaq 0x29a1fb(%rip), %rcx    # 0x30d4bd
movb (%rcx), %cl
testb %cl, %cl
je 0x732d3
leaq 0x29a459(%rip), %rsi    # 0x30d728
addl (%rsi), %eax
movl %eax, (%rdx)
movl (%rdx), %eax
imulq $0x6ef5de4d, %rax, %rsi # imm = 0x6EF5DE4D
shrq $0x32, %rsi
imull $0x93a80, %esi, %esi    # imm = 0x93A80
subl %esi, %eax
movl %eax, (%rdx)
leaq 0x29a453(%rip), %rdx    # 0x30d744
movl %eax, (%rdx)
leaq 0x29a456(%rip), %rdx    # 0x30d750
movq %rax, (%rdx)
leaq 0x29a43c(%rip), %rdx    # 0x30d740
movl %eax, (%rdx)
leaq 0x29a01b(%rip), %rax    # 0x30d328
movl $0x3e7, (%rax)          # imm = 0x3E7
movsd (%r14), %xmm0
testb %cl, %cl
je 0x7334a
leaq 0x29a405(%rip), %rax    # 0x30d728
movl (%rax), %edx
movsd %xmm0, -0x18(%rbp)
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
callq 0xd41e0
movsd -0x18(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
addsd 0x9852e(%rip), %xmm0    # 0x10b880
divsd 0x985a6(%rip), %xmm0    # 0x10b900
cvttsd2si %xmm0, %eax
leaq 0x29a3d3(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
cmpl $0x0, (%rbx)
jne 0x7337a
leaq 0x1a54d0(%rip), %rax    # 0x218844
movl $0x806, (%rax)          # imm = 0x806
movl $0x3e7, (%rbx)          # imm = 0x3E7
movl $0x1, %eax
jmp 0x733e4
leaq 0x299f9a(%rip), %rcx    # 0x30d328
xorl %eax, %eax
cmpl $0x0, (%rcx)
jne 0x733e4
leaq 0x29a194(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
callq 0xcf04f
movl %eax, %ecx
imulq $0x6ef5de4d, %rcx, %rcx # imm = 0x6EF5DE4D
shrq $0x32, %rcx
imull $0x93a80, %ecx, %ecx    # imm = 0x93A80
subl %ecx, %eax
leaq 0x29a383(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x29a386(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
leaq 0x29a36c(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x29a35f(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
movl $0x2, %eax
leaq 0x29a35d(%rip), %rcx    # 0x30d748
movl %eax, (%rcx)
leaq 0x1a54dc(%rip), %rax    # 0x2188d0
movabsq $0x19bb7b9bfc, %rcx     # imm = 0x19BB7B9BFC
testq %rcx, (%rax)
jne 0x7340d
leaq 0x29a56a(%rip), %rax    # 0x30d974
orb $0xf, (%rax)
xorl %edi, %edi
callq 0x76535
xorl %edi, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x77054