// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_venus_xnav()
void parse_venus_xnav()
{
int fix_mode;
int week;
double vtow;
double bias;
float drift;
double jd;

   log_packet_id("venus_xnav");
   saw_venus_raw |= 0x02;
   minor_alarms &= (~MINOR_NO_TRACK);

   tsip_byte();  // iod
   fix_mode = tsip_byte();
   week = tsip_word();
   vtow = tsip_double();
   ecef_x = tsip_double();
   ecef_y = tsip_double();
   ecef_z = tsip_double();
   tsip_single();  // velocity
   tsip_single();
   tsip_single();
   bias = tsip_double();   // meters
   drift = tsip_single();  // meters/sec
   gdop = tsip_single();
   pdop = tsip_single();
   hdop = tsip_single();
   vdop = tsip_single();
   tdop = tsip_single();
   have_dops |= (GDOP | PDOP | HDOP | VDOP | TDOP);

   if(1) ;
   else if(minor_alarms & MINOR_SURVEY) rcvr_mode = RCVR_MODE_SURVEY;
   else if(venus_hold_mode)             rcvr_mode = RCVR_MODE_HOLD;
   else if(fix_mode == 0)               rcvr_mode = RCVR_MODE_NO_SATS;
   else if(fix_mode == 1)               rcvr_mode = RCVR_MODE_ACQUIRE;
   else if(fix_mode == 2)               rcvr_mode = RCVR_MODE_2D;
   else if(fix_mode == 3)               rcvr_mode = RCVR_MODE_3D;
   else if(fix_mode == 4)               rcvr_mode = RCVR_MODE_DGPS;
   else                                 rcvr_mode = RCVR_MODE_UNKNOWN;

   pri_tow = this_tow = tow = survey_tow = (long) vtow; // tow

   ecef_to_lla(ecef_x,ecef_y,ecef_z);
   lat = elat;
   lon = elon;
   alt = ealt;

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

   pri_tow = tow = this_tow = (int) vtow;
   if(have_tow == 0) need_redraw = 2008;
   have_tow = 222;
   survey_tow = tow;

   jd = vtow;
   jd /= (24.0*60.0*60.0);
   jd += (week * 7.0);
   jd += GPS_EPOCH;

   set_gregorian_time(jd);

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

   if(TICC_USED == 0) {
      pps_offset = bias;
      have_pps_offset = 1;
      plot[PPS].plot_id = "Bias";
      plot[PPS].units = "m";
      if(user_set_pps_plot == 0) {
         user_set_pps_plot = 1;
         plot[PPS].show_plot = 1;
      }

      osc_offset = drift;
      have_osc_offset = 1;
      plot[OSC].plot_id = "Drift";
      plot[OSC].units = "m/s";
      plot[OSC].ref_scale = 1.0F;
      if(user_set_osc_plot == 0) {
         plot[OSC].show_plot = 1;
         user_set_osc_plot = 1;
      }
      if(plot[OSC].user_set_float == 0) plot[OSC].float_center = 1;

      if(user_set_lla_plots == 0) {
         if(plot[ONE].user_set_show == 0)   plot[ONE].show_plot = 0;
         if(plot[TWO].user_set_show == 0)   plot[TWO].show_plot = 0;
         if(plot[THREE].user_set_show == 0) plot[THREE].show_plot = 0;
         user_set_lla_plots = 1;
      }
   }

   update_gps_screen(1223); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0xb9509(%rip), %rdi     # 0x187d98
callq 0x7add0
leaq 0x2ce739(%rip), %rax    # 0x39cfd4
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2ce72d(%rip), %rax    # 0x39cfd4
movl %ecx, (%rax)
leaq 0x29db08(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x29dafc(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
callq 0x7a510
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x4(%rbp)
callq 0x7a560
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
callq 0x7a9d0
movsd %xmm0, -0x10(%rbp)
callq 0x7a9d0
leaq 0x29d8d9(%rip), %rax    # 0x36c1c8
movsd %xmm0, (%rax)
callq 0x7a9d0
leaq 0x29d8d1(%rip), %rax    # 0x36c1d0
movsd %xmm0, (%rax)
callq 0x7a9d0
leaq 0x29d8c9(%rip), %rax    # 0x36c1d8
movsd %xmm0, (%rax)
callq 0x7a860
callq 0x7a860
callq 0x7a860
callq 0x7a9d0
movsd %xmm0, -0x18(%rbp)
callq 0x7a860
movss %xmm0, -0x1c(%rbp)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1b3d9a(%rip), %rax    # 0x2826e0
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1b3d6e(%rip), %rax    # 0x2826c8
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1b3d62(%rip), %rax    # 0x2826d0
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1b3d56(%rip), %rax    # 0x2826d8
movsd %xmm0, (%rax)
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x1b3d52(%rip), %rax    # 0x2826e8
movsd %xmm0, (%rax)
leaq 0x1b3d23(%rip), %rax    # 0x2826c4
movl (%rax), %ecx
orl $0x1f, %ecx
leaq 0x1b3d17(%rip), %rax    # 0x2826c4
movl %ecx, (%rax)
cvttsd2si -0x10(%rbp), %rax
leaq 0x29df74(%rip), %rcx    # 0x36c930
movq %rax, (%rcx)
movl %eax, %ecx
leaq 0x29df54(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x29df4f(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x29df4a(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
leaq 0x29d7e5(%rip), %rax    # 0x36c1c8
movsd (%rax), %xmm0
leaq 0x29d7e2(%rip), %rax    # 0x36c1d0
movsd (%rax), %xmm1
leaq 0x29d7df(%rip), %rax    # 0x36c1d8
movsd (%rax), %xmm2
callq 0x7fe10
movsd 0x2fd26e(%rip), %xmm0   # 0x3cbc78
leaq 0x29d79f(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
movsd 0x2fd263(%rip), %xmm0   # 0x3cbc80
leaq 0x29d794(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
movsd 0x2fd258(%rip), %xmm0   # 0x3cbc88
leaq 0x29d789(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
cmpl $0x0, -0x8(%rbp)
jl 0xcea84
movl -0x8(%rbp), %eax
movw %ax, %cx
leaq 0x29deca(%rip), %rax    # 0x36c918
movw %cx, (%rax)
leaq 0x29ded0(%rip), %rax    # 0x36c928
movl $0x0, (%rax)
leaq 0x29daa7(%rip), %rax    # 0x36c50c
cmpl $0x0, (%rax)
jne 0xcea77
leaq 0x1a8fb3(%rip), %rax    # 0x277a24
movl $0x7d7, (%rax)          # imm = 0x7D7
leaq 0x29da8e(%rip), %rax    # 0x36c50c
movl $0xde, (%rax)
cvttsd2si -0x10(%rbp), %ecx
leaq 0x29de90(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x29de83(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x29de82(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
leaq 0x29da5d(%rip), %rax    # 0x36c508
cmpl $0x0, (%rax)
jne 0xceabd
leaq 0x1a8f6d(%rip), %rax    # 0x277a24
movl $0x7d8, (%rax)          # imm = 0x7D8
leaq 0x29da44(%rip), %rax    # 0x36c508
movl $0xde, (%rax)
leaq 0x29de4b(%rip), %rax    # 0x36c91c
movl (%rax), %eax
movl %eax, %ecx
leaq 0x29de54(%rip), %rax    # 0x36c930
movq %rcx, (%rax)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0xa0512(%rip), %xmm1    # 0x16f008
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
cvtsi2sdl -0x8(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd 0xa2b77(%rip), %xmm2    # 0x171688
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0xa2af2(%rip), %xmm0    # 0x171618
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x7fb00
leaq 0x29db5c(%rip), %rax    # 0x36c69d
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xceb4e
callq 0x7fcb0
movb $0x1, %al
leaq 0x1a8f59(%rip), %rcx    # 0x277ab0
cmpq $0x10000, (%rcx)        # imm = 0x10000
movb %al, -0x29(%rbp)
je 0xceb71
callq 0x992e0
cmpl $0x0, %eax
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xced14
movsd -0x18(%rbp), %xmm0
leaq 0x29ce0a(%rip), %rax    # 0x36b998
movsd %xmm0, (%rax)
leaq 0x29d87f(%rip), %rax    # 0x36c418
movl $0x1, (%rax)
leaq 0xee17a(%rip), %rax     # 0x1bcd20
leaq 0xb3c13(%rip), %rcx     # 0x1827c0
movq %rcx, (%rax)
leaq 0xee169(%rip), %rax     # 0x1bcd20
leaq 0xad3d5(%rip), %rcx     # 0x17bf93
movq %rcx, 0x8(%rax)
leaq 0x29e476(%rip), %rax    # 0x36d03f
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xcebe9
leaq 0x29e467(%rip), %rax    # 0x36d03f
movb $0x1, (%rax)
leaq 0xee13e(%rip), %rax     # 0x1bcd20
movl $0x1, 0x18(%rax)
movss -0x1c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x29cda7(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
leaq 0x29d810(%rip), %rax    # 0x36c414
movl $0x1, (%rax)
leaq 0xee10f(%rip), %rax     # 0x1bcd20
leaq 0xb918b(%rip), %rcx     # 0x187da3
movq %rcx, 0xe8(%rax)
leaq 0xee0fa(%rip), %rax     # 0x1bcd20
leaq 0xbefcc(%rip), %rcx     # 0x18dbf9
movq %rcx, 0xf0(%rax)
leaq 0xee0e5(%rip), %rax     # 0x1bcd20
movsd 0xa0425(%rip), %xmm0    # 0x16f068
movsd %xmm0, 0xf8(%rax)
leaq 0x29e3ee(%rip), %rax    # 0x36d040
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xcec75
leaq 0xee0bf(%rip), %rax     # 0x1bcd20
movl $0x1, 0x100(%rax)
leaq 0x29e3ce(%rip), %rax    # 0x36d040
movb $0x1, (%rax)
leaq 0xee0a4(%rip), %rax     # 0x1bcd20
cmpl $0x0, 0x1c4(%rax)
jne 0xcec96
leaq 0xee094(%rip), %rax     # 0x1bcd20
movl $0x1, 0x104(%rax)
leaq 0x29e3ab(%rip), %rax    # 0x36d048
cmpl $0x0, (%rax)
jne 0xced12
leaq 0xee077(%rip), %rax     # 0x1bcd20
cmpl $0x0, 0x480(%rax)
jne 0xcecc3
leaq 0xee067(%rip), %rax     # 0x1bcd20
movl $0x0, 0x3b8(%rax)
leaq 0xee056(%rip), %rax     # 0x1bcd20
cmpl $0x0, 0x568(%rax)
jne 0xcece4
leaq 0xee046(%rip), %rax     # 0x1bcd20
movl $0x0, 0x4a0(%rax)
leaq 0xee035(%rip), %rax     # 0x1bcd20
cmpl $0x0, 0x650(%rax)
jne 0xced05
leaq 0xee025(%rip), %rax     # 0x1bcd20
movl $0x0, 0x588(%rax)
leaq 0x29e33c(%rip), %rax    # 0x36d048
movl $0x1, (%rax)
jmp 0xced14
movl $0x4c7, %edi            # imm = 0x4C7
callq 0x9d790
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)