// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x8db7f(%rip), %rdi     # 0x124846
callq 0x58e77
leaq 0x2a7121(%rip), %rax    # 0x33ddf4
testb $0x2, (%rax)
jne 0x9704f
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x96cf2
leaq 0x1a8281(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2764df(%rip), %rcx    # 0x30d1d8
movb $0xb, %dl
testb $0x20, (%rcx)
jne 0x96d20
leaq 0x2763cc(%rip), %rcx    # 0x30d0d3
movb $0x7, %dl
cmpb $0x0, (%rcx)
jne 0x96d20
movb $0x63, %dl
testb $-0x4, %al
jne 0x96d20
shll $0x3, %eax
movl $0x4040309, %edx        # imm = 0x4040309
movl %eax, %ecx
shrl %cl, %edx
leaq 0x2763a9(%rip), %rax    # 0x30d0d0
movb %dl, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x96d3f
leaq 0x1a8234(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588f0
leaq 0x2769ed(%rip), %r12    # 0x30d738
movw %ax, (%r12)
leaq 0x2769f1(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
callq 0x589b0
movl %eax, %ecx
leaq 0x2769e5(%rip), %rbx    # 0x30d750
movq %rcx, (%rbx)
leaq 0x2769c7(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x2769c2(%rip), %r14    # 0x30d740
movl %eax, (%r14)
leaq 0x2769bc(%rip), %r15    # 0x30d744
movl %eax, (%r15)
callq 0x589b0
cvtsi2sd %eax, %xmm0
mulsd 0x87414(%rip), %xmm0    # 0x11e1b0
mulsd 0x74a74(%rip), %xmm0    # 0x10b818
divsd 0x74a74(%rip), %xmm0    # 0x10b820
leaq 0x27621d(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x873e5(%rip), %xmm0    # 0x11e1b0
mulsd 0x74a45(%rip), %xmm0    # 0x10b818
divsd 0x74a45(%rip), %xmm0    # 0x10b820
leaq 0x2761f6(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x72266(%rip), %xmm0    # 0x109060
leaq 0x2761df(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x589b0
callq 0x588f0
cwtl
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x761b9(%rip), %xmm0    # 0x10cfd8
cvtss2sd %xmm0, %xmm0
leaq 0x18c6d6(%rip), %rax    # 0x223500
movsd %xmm0, (%rax)
callq 0x588f0
cwtl
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x76195(%rip), %xmm0    # 0x10cfd8
cvtss2sd %xmm0, %xmm0
leaq 0x18c69a(%rip), %rax    # 0x2234e8
movsd %xmm0, (%rax)
callq 0x588f0
cwtl
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x76171(%rip), %xmm0    # 0x10cfd8
cvtss2sd %xmm0, %xmm0
leaq 0x18c67e(%rip), %rax    # 0x2234f0
movsd %xmm0, (%rax)
callq 0x588f0
cwtl
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x7614d(%rip), %xmm0    # 0x10cfd8
cvtss2sd %xmm0, %xmm0
leaq 0x18c662(%rip), %rax    # 0x2234f8
movsd %xmm0, (%rax)
callq 0x588f0
cwtl
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x76129(%rip), %xmm0    # 0x10cfd8
cvtss2sd %xmm0, %xmm0
leaq 0x18c64e(%rip), %rax    # 0x223508
movsd %xmm0, (%rax)
leaq 0x18c61f(%rip), %rax    # 0x2234e4
orb $0x1f, (%rax)
callq 0x589b0
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x27610a(%rip), %rax    # 0x30cfe8
movsd %xmm0, (%rax)
callq 0x589b0
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x2760f8(%rip), %rax    # 0x30cff0
movsd %xmm0, (%rax)
callq 0x589b0
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
leaq 0x2760e6(%rip), %rax    # 0x30cff8
movsd %xmm0, (%rax)
callq 0x589b0
callq 0x589b0
callq 0x589b0
leaq 0x2763fc(%rip), %rax    # 0x30d328
cmpl $0x0, (%rax)
jne 0x96f3e
leaq 0x18190c(%rip), %rcx    # 0x218844
movl $0x7ed, (%rcx)          # imm = 0x7ED
movl $0x5, (%rax)
leaq 0x2763e1(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0x96f5d
leaq 0x1818ed(%rip), %rcx    # 0x218844
movl $0x7ee, (%rcx)          # imm = 0x7EE
movl $0x5, (%rax)
movl (%r15), %eax
cvtsi2sd %rax, %xmm1
divsd 0x720ed(%rip), %xmm1    # 0x109060
addsd 0x72185(%rip), %xmm1    # 0x109100
leaq 0x27653b(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
xorpd %xmm0, %xmm0
je 0x96f99
leaq 0x276796(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
subsd %xmm0, %xmm1
divsd 0x72073(%rip), %xmm1    # 0x109018
addsd 0x748db(%rip), %xmm1    # 0x10b888
movzwl (%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x7493f(%rip), %xmm0    # 0x10b900
addsd %xmm1, %xmm0
callq 0x5c837
movq (%rbx), %rcx
movabsq $-0x5c28f5c28f5c28f5, %rdx # imm = 0xA3D70A3D70A3D70B
movq %rcx, %rax
imulq %rdx
movl (%r15), %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
movl %eax, (%r15)
movl (%r14), %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
movl %eax, (%r14)
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
movq %rdx, (%rbx)
movl $0x64, %edi
movl $0x2, %esi
callq 0x5fbb4
movl $0x20, %edi
callq 0x591af
callq 0x61bc3
leaq 0x8abc2(%rip), %rax     # 0x121bfa
leaq 0x1a7eb9(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7327e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq