// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_pvt()
void parse_nvs_pvt()
{
u08 status;
double msecs;
int week;
double lat_speed;
double lon_speed;
double alt_speed;
double gen_dev;
double jd;

   // 0x88 packet
   log_packet_id("nvs_pvt");

   lat = tsip_double();
   lon = tsip_double();
   alt = tsip_double();

   tsip_single(); // RMS posn err
   msecs = tsip_fp80();       // time stamp msecs
   week = tsip_word();        // gps week
   lat_speed = tsip_double(); // lat speed
   lon_speed = tsip_double(); // lon speed
   alt_speed = tsip_double(); // alt speed
   gen_dev = (double) tsip_single(); // ref gen deviation (msecs/sec)
   status = tsip_byte();  // !!!! has 2D flag qqqqqq

   pps_offset = gen_dev * 1.0E6; 
   have_pps_offset = 2;
   have_rcvr_pps = 2;
   faked_tow = 0;
//adadad   if(jitter_adev == 0) do_pps_adev(pps_offset);

   if(week >= 0) {
      gps_week = fix_nvs_week(week);
      if(have_week == 0) need_redraw = 2007;
      have_week = 222;
   }

   pri_tow = tow = this_tow = (int) (msecs / 1000.0);
   if(have_tow == 0) need_redraw = 2008;
   have_tow = 222;
   survey_tow = tow;


   jd = msecs / 1000.0;
   
   jd /= (24.0*60.0*60.0);
   jd += jdate(1999,8,22);
   jd += (week * 7.0);

   set_gregorian_time(jd);

   if(timing_mode == TMODE_GPS) {  // we want UTC time - convert gps time to utc
      utc_to_gps();
   }

   update_gps_screen(1222); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0x7d478(%rip), %rdi     # 0x125f0e
callq 0x58e77
callq 0x58b86
leaq 0x264529(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x58b86
leaq 0x264521(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x58b86
leaq 0x264519(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58aae
callq 0x58c1e
movsd %xmm0, -0x10(%rbp)
callq 0x588f0
movl %eax, %ebx
callq 0x58b86
callq 0x58b86
callq 0x58b86
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8b14
leaq 0x19645f(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
movsd -0x18(%rbp), %xmm0
mulsd 0x6052f(%rip), %xmm0    # 0x109050
leaq 0x263c90(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x264705(%rip), %rax    # 0x30d238
movl $0x2, %ecx
movl %ecx, (%rax)
leaq 0x264703(%rip), %rax    # 0x30d244
movl %ecx, (%rax)
leaq 0x264bfe(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
movzwl %bx, %ebx
movl %ebx, %edi
callq 0xa8a2e
leaq 0x264bd7(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x2647c1(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0xa8b7d
leaq 0x16fccd(%rip), %rcx    # 0x218844
movl $0x7d7, (%rcx)          # imm = 0x7D7
movsd -0x10(%rbp), %xmm0
divsd 0x604ae(%rip), %xmm0    # 0x109038
movl $0xde, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x264ba5(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x264b98(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x264b97(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x264772(%rip), %rcx    # 0x30d328
cmpl $0x0, (%rcx)
jne 0xa8bc8
leaq 0x16fc82(%rip), %rdx    # 0x218844
movl $0x7d8, (%rdx)          # imm = 0x7D8
movl $0xde, (%rcx)
movl %eax, %eax
leaq 0x264b79(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
divsd 0x60436(%rip), %xmm0    # 0x109018
movsd %xmm0, -0x10(%rbp)
movl $0x7cf, %edi            # imm = 0x7CF
movl $0x8, %esi
movl $0x16, %edx
callq 0xd4110
cvtsi2sd %ebx, %xmm1
addsd -0x10(%rbp), %xmm0
mulsd 0x62cf4(%rip), %xmm1    # 0x10b900
addsd %xmm1, %xmm0
callq 0x5c837
leaq 0x2648a1(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
jne 0xa8c4b
leaq 0x264b00(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c907
leaq 0x264869(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x264787(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x7327e