// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_venus_nav()
void parse_venus_nav()
{
double jd;
u08 fix_mode;

   log_packet_id("venus_nav");
   if(saw_venus_raw & 0x02) return;  //rnx2

   fix_mode = tsip_byte();  // fix mode
   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_ACQUIRE;
   else if(fix_mode == 1)          rcvr_mode = RCVR_MODE_2D;
   else if(fix_mode == 2)          rcvr_mode = RCVR_MODE_3D;
   else if(fix_mode == 3)          rcvr_mode = RCVR_MODE_3D;
   else                            rcvr_mode = RCVR_MODE_UNKNOWN;

   tsip_byte();  // sat count
   gps_week = tsip_word();  // week
   faked_tow = 0;
   pri_tow = this_tow = tow = survey_tow = tsip_dword(); // tow

   lat = ((double) (S32) tsip_dword()) * 1.0E-7 * PI / 180.0; // lat
   lon = ((double) (S32) tsip_dword()) * 1.0E-7 * PI / 180.0; // lon
   alt = ((double) (S32) tsip_dword()) / 100.0; // lon
   tsip_dword(); // msl alt

   gdop = ((float) (s16) tsip_word()) / 100.0F;  // GDOP
   pdop = ((float) (s16) tsip_word()) / 100.0F;  // PDOP
   hdop = ((float) (s16) tsip_word()) / 100.0F;  // HDOP
   vdop = ((float) (s16) tsip_word()) / 100.0F;  // VDOP
   tdop = ((float) (s16) tsip_word()) / 100.0F;  // TDOP
   have_dops |= (GDOP | PDOP | HDOP | VDOP | TDOP);

   ecef_x = tsip_dword(); // ecefx
   ecef_y = tsip_dword(); // ecefy
   ecef_z = tsip_dword(); // ecefz
   tsip_dword(); // ecefvx
   tsip_dword(); // ecefvy
   tsip_dword(); // ecefvz

   if(have_tow == 0) need_redraw = 2029;
   have_tow = 5;

   if(have_week == 0) need_redraw = 2030;
   have_week = 5;

   jd = (double) (u32) pri_tow;
   jd /= 100.0;
   jd += 0.01;  // adjust for possible roundoff

   if(timing_mode != TMODE_GPS) {  // we want UTC time - convert gps to utc
      jd -= (double) utc_offset;
   }
   
   jd /= (24.0*60.0*60.0);
   jd += GPS_EPOCH;
   jd += ((double) gps_week) * 7.0;
   set_gregorian_time(jd);

   pri_tow /= 100;
   this_tow /= 100;
   survey_tow /= 100;

   query_venus_msg(QUERY_VENUS_LEAP);  // get UTC offset

   level_type = "dBc";
   update_gps_screen(1002); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0xba313(%rip), %rdi     # 0x187c12
callq 0x7add0
leaq 0x2cf6c9(%rip), %rax    # 0x39cfd4
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xcd91a
jmp 0xcdd57
callq 0x7a510
movb %al, -0x9(%rbp)
leaq 0x29ea8f(%rip), %rax    # 0x36c3b8
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xcd942
leaq 0x29e976(%rip), %rax    # 0x36c2b0
movb $0xb, (%rax)
jmp 0xcd9c2
leaq 0x29e96a(%rip), %rax    # 0x36c2b3
cmpb $0x0, (%rax)
je 0xcd95a
leaq 0x29e95b(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
jmp 0xcd9c0
movzbl -0x9(%rbp), %eax
cmpl $0x0, %eax
jne 0xcd96f
leaq 0x29e946(%rip), %rax    # 0x36c2b0
movb $0x9, (%rax)
jmp 0xcd9be
movzbl -0x9(%rbp), %eax
cmpl $0x1, %eax
jne 0xcd984
leaq 0x29e931(%rip), %rax    # 0x36c2b0
movb $0x3, (%rax)
jmp 0xcd9bc
movzbl -0x9(%rbp), %eax
cmpl $0x2, %eax
jne 0xcd999
leaq 0x29e91c(%rip), %rax    # 0x36c2b0
movb $0x4, (%rax)
jmp 0xcd9ba
movzbl -0x9(%rbp), %eax
cmpl $0x3, %eax
jne 0xcd9ae
leaq 0x29e907(%rip), %rax    # 0x36c2b0
movb $0x4, (%rax)
jmp 0xcd9b8
leaq 0x29e8fb(%rip), %rax    # 0x36c2b0
movb $0x63, (%rax)
jmp 0xcd9ba
jmp 0xcd9bc
jmp 0xcd9be
jmp 0xcd9c0
jmp 0xcd9c2
callq 0x7a510
callq 0x7a560
movw %ax, %cx
leaq 0x29ef42(%rip), %rax    # 0x36c918
movw %cx, (%rax)
leaq 0x29ef48(%rip), %rax    # 0x36c928
movl $0x0, (%rax)
callq 0x7a680
movl %eax, %ecx
movl %ecx, %eax
movl %eax, %edx
leaq 0x29ef38(%rip), %rax    # 0x36c930
movq %rdx, (%rax)
leaq 0x29ef1a(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x29ef15(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x29ef10(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
callq 0x7a680
cvtsi2sd %eax, %xmm0
movsd 0xa1781(%rip), %xmm1    # 0x16f1a8
movsd %xmm1, -0x28(%rbp)
mulsd %xmm1, %xmm0
movsd 0xa3b90(%rip), %xmm1    # 0x1715c8
movsd %xmm1, -0x20(%rbp)
mulsd %xmm1, %xmm0
movsd 0xa162f(%rip), %xmm1    # 0x16f078
movsd %xmm1, -0x18(%rbp)
divsd %xmm1, %xmm0
leaq 0x29e757(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
callq 0x7a680
movsd -0x28(%rbp), %xmm3
movsd -0x20(%rbp), %xmm2
movsd -0x18(%rbp), %xmm1
cvtsi2sd %eax, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
leaq 0x29e730(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
callq 0x7a680
cvtsi2sd %eax, %xmm0
movsd 0xa15b3(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
leaq 0x29e718(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
callq 0x7a680
callq 0x7a560
cwtl
cvtsi2ss %eax, %xmm0
movss 0xb5861(%rip), %xmm1    # 0x183324
movss %xmm1, -0x10(%rbp)
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1b4c09(%rip), %rax    # 0x2826e0
movsd %xmm0, (%rax)
callq 0x7a560
movss -0x10(%rbp), %xmm1
cwtl
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1b4bcf(%rip), %rax    # 0x2826c8
movsd %xmm0, (%rax)
callq 0x7a560
movss -0x10(%rbp), %xmm1
cwtl
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1b4bb5(%rip), %rax    # 0x2826d0
movsd %xmm0, (%rax)
callq 0x7a560
movss -0x10(%rbp), %xmm1
cwtl
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1b4b9b(%rip), %rax    # 0x2826d8
movsd %xmm0, (%rax)
callq 0x7a560
movss -0x10(%rbp), %xmm1
cwtl
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1b4b89(%rip), %rax    # 0x2826e8
movsd %xmm0, (%rax)
leaq 0x1b4b5a(%rip), %rax    # 0x2826c4
movb (%rax), %cl
orb $0x1f, %cl
movb %cl, (%rax)
callq 0x7a680
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x29e644(%rip), %rax    # 0x36c1c8
movsd %xmm0, (%rax)
callq 0x7a680
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x29e635(%rip), %rax    # 0x36c1d0
movsd %xmm0, (%rax)
callq 0x7a680
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x29e626(%rip), %rax    # 0x36c1d8
movsd %xmm0, (%rax)
callq 0x7a680
callq 0x7a680
callq 0x7a680
leaq 0x29e93c(%rip), %rax    # 0x36c508
cmpl $0x0, (%rax)
jne 0xcdbde
leaq 0x1a9e4c(%rip), %rax    # 0x277a24
movl $0x7ed, (%rax)          # imm = 0x7ED
leaq 0x29e923(%rip), %rax    # 0x36c508
movl $0x5, (%rax)
leaq 0x29e91a(%rip), %rax    # 0x36c50c
cmpl $0x0, (%rax)
jne 0xcdc04
leaq 0x1a9e26(%rip), %rax    # 0x277a24
movl $0x7ee, (%rax)          # imm = 0x7EE
leaq 0x29e901(%rip), %rax    # 0x36c50c
movl $0x5, (%rax)
leaq 0x29ed0c(%rip), %rax    # 0x36c924
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0xa141f(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd 0xa14de(%rip), %xmm0    # 0x16f120
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x29ea4a(%rip), %rax    # 0x36c69d
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xcdc74
leaq 0x29eca6(%rip), %rax    # 0x36c908
cvtsi2sdl (%rax), %xmm1
movsd -0x8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0xa1387(%rip), %xmm1    # 0x16f008
divsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0xa3981(%rip), %xmm1    # 0x171618
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x29ec71(%rip), %rax    # 0x36c918
movzwl (%rax), %eax
cvtsi2sd %eax, %xmm0
movsd -0x8(%rbp), %xmm1
movsd 0xa39cd(%rip), %xmm2    # 0x171688
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
callq 0x7fb00
leaq 0x29ec4b(%rip), %rax    # 0x36c924
movl (%rax), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
leaq 0x29ec37(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
leaq 0x29ec2a(%rip), %rax    # 0x36c920
movl (%rax), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
leaq 0x29ec16(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x29ec1d(%rip), %rax    # 0x36c930
movq (%rax), %rax
movl $0x64, %ecx
cqto
idivq %rcx
movq %rax, %rcx
leaq 0x29ec06(%rip), %rax    # 0x36c930
movq %rcx, (%rax)
movl $0x64, %edi
movl $0x20, %esi
callq 0x8b800
leaq 0x1d0395(%rip), %rax    # 0x29e0d8
leaq 0xb7220(%rip), %rcx     # 0x184f6a
movq %rcx, (%rax)
movl $0x3ea, %edi            # imm = 0x3EA
callq 0x9d790
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)