// File: /workspace/github_cpp_makefile_star2_O3/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 0x29a232(%rip), %rbx    # 0x30d32c
movl (%rbx), %eax
cmpl $0x3e7, %eax            # imm = 0x3E7
je 0x7310b
testl %eax, %eax
jne 0x731e8
leaq 0x29a41e(%rip), %r14    # 0x30d530
movsd (%r14), %xmm0
callq 0xcf6e3
leaq 0x29a39a(%rip), %rcx    # 0x30d4bd
movb (%rcx), %cl
xorl %esi, %esi
leaq 0x29a5fa(%rip), %rdx    # 0x30d728
testb %cl, %cl
je 0x73134
movl (%rdx), %esi
addl %esi, %eax
imulq $0x6ef5de4d, %rax, %rsi # imm = 0x6EF5DE4D
shrq $0x32, %rsi
imull $0x93a80, %esi, %esi    # imm = 0x93A80
subl %esi, %eax
leaq 0x29a5ec(%rip), %rsi    # 0x30d73c
movl %eax, (%rsi)
leaq 0x29a5eb(%rip), %rsi    # 0x30d744
movl %eax, (%rsi)
leaq 0x29a5ee(%rip), %rsi    # 0x30d750
movq %rax, (%rsi)
leaq 0x29a5d4(%rip), %rsi    # 0x30d740
movl %eax, (%rsi)
leaq 0x29a1b3(%rip), %rax    # 0x30d328
movl $0x3e7, (%rax)          # imm = 0x3E7
movsd (%r14), %xmm0
testb %cl, %cl
je 0x731ab
movl (%rdx), %edx
movsd %xmm0, -0x18(%rbp)
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
callq 0xd492e
movsd -0x18(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
addsd 0x986dd(%rip), %xmm0    # 0x10b890
divsd 0x9874d(%rip), %xmm0    # 0x10b908
cvttsd2si %xmm0, %eax
leaq 0x29a572(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
cmpl $0x0, (%rbx)
jne 0x731db
leaq 0x1a566f(%rip), %rax    # 0x218844
movl $0x806, (%rax)          # imm = 0x806
movl $0x3e7, (%rbx)          # imm = 0x3E7
movl $0x1, %eax
jmp 0x73245
leaq 0x29a139(%rip), %rcx    # 0x30d328
xorl %eax, %eax
cmpl $0x0, (%rcx)
jne 0x73245
leaq 0x29a333(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
callq 0xcf6e3
movl %eax, %ecx
imulq $0x6ef5de4d, %rcx, %rcx # imm = 0x6EF5DE4D
shrq $0x32, %rcx
imull $0x93a80, %ecx, %ecx    # imm = 0x93A80
subl %ecx, %eax
leaq 0x29a522(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x29a525(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
leaq 0x29a50b(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x29a4fe(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
movl $0x2, %eax
leaq 0x29a4fc(%rip), %rcx    # 0x30d748
movl %eax, (%rcx)
leaq 0x1a567b(%rip), %rax    # 0x2188d0
movabsq $0x19bb7b9bfc, %rcx     # imm = 0x19BB7B9BFC
testq %rcx, (%rax)
jne 0x7326e
leaq 0x29a709(%rip), %rax    # 0x30d974
orb $0xf, (%rax)
xorl %edi, %edi
callq 0x763a8
xorl %edi, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x76e69