// File: /workspace/github_cpp_makefile_star2_O3/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 0x7d30b(%rip), %rdi     # 0x125fee
callq 0x58dc2
callq 0x58b08
leaq 0x2642dc(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x58b08
leaq 0x2642d4(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x58b08
leaq 0x2642cc(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58a30
callq 0x58ba0
movsd %xmm0, -0x10(%rbp)
callq 0x588d2
movl %eax, %ebx
callq 0x58b08
callq 0x58b08
callq 0x58b08
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8d61
leaq 0x196212(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
movsd -0x18(%rbp), %xmm0
mulsd 0x602e2(%rip), %xmm0    # 0x109050
leaq 0x263a43(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x2644b8(%rip), %rax    # 0x30d238
movl $0x2, %ecx
movl %ecx, (%rax)
leaq 0x2644b6(%rip), %rax    # 0x30d244
movl %ecx, (%rax)
leaq 0x2649b1(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
movzwl %bx, %ebx
movl %ebx, %edi
callq 0xa8c7b
leaq 0x26498a(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x264574(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0xa8dca
leaq 0x16fa80(%rip), %rcx    # 0x218844
movl $0x7d7, (%rcx)          # imm = 0x7D7
movsd -0x10(%rbp), %xmm0
divsd 0x60261(%rip), %xmm0    # 0x109038
movl $0xde, (%rax)
cvttsd2si %xmm0, %eax
leaq 0x264958(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x26494b(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x26494a(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x264525(%rip), %rcx    # 0x30d328
cmpl $0x0, (%rcx)
jne 0xa8e15
leaq 0x16fa35(%rip), %rdx    # 0x218844
movl $0x7d8, (%rdx)          # imm = 0x7D8
movl $0xde, (%rcx)
movl %eax, %eax
leaq 0x26492c(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
divsd 0x601e9(%rip), %xmm0    # 0x109018
movsd %xmm0, -0x10(%rbp)
movl $0x7cf, %edi            # imm = 0x7CF
movl $0x8, %esi
movl $0x16, %edx
callq 0xd485e
cvtsi2sd %ebx, %xmm1
addsd -0x10(%rbp), %xmm0
mulsd 0x62aaf(%rip), %xmm1    # 0x10b908
addsd %xmm1, %xmm0
callq 0x5c71d
leaq 0x264654(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
jne 0xa8e98
leaq 0x2648b3(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c7ed
leaq 0x26461c(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x26453a(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x730e8