// File: /workspace/github_cpp_makefile_star2_O2/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 0x856ca(%rip), %rdi     # 0x10e86e
callq 0x520bf
leaq 0x29ec44(%rip), %rax    # 0x327df4
testb $0x2, (%rax)
jne 0x894a9
callq 0x51c47
leaq 0x26e013(%rip), %rcx    # 0x2f71d8
movb $0xb, %dl
testb $0x20, (%rcx)
jne 0x891ec
leaq 0x26df00(%rip), %rcx    # 0x2f70d3
movb $0x7, %dl
cmpb $0x0, (%rcx)
jne 0x891ec
movb $0x63, %dl
cmpb $0x3, %al
ja 0x891ec
shlb $0x3, %al
movl $0x4040309, %edx        # imm = 0x4040309
movl %eax, %ecx
shrl %cl, %edx
leaq 0x26dedd(%rip), %rax    # 0x2f70d0
movb %dl, (%rax)
callq 0x51c47
callq 0x51c63
leaq 0x26e532(%rip), %r12    # 0x2f7738
movw %ax, (%r12)
leaq 0x26e536(%rip), %rax    # 0x2f7748
andl $0x0, (%rax)
callq 0x51cf3
movl %eax, %ecx
leaq 0x26e52d(%rip), %rbx    # 0x2f7750
movq %rcx, (%rbx)
leaq 0x26e50f(%rip), %rcx    # 0x2f773c
movl %eax, (%rcx)
leaq 0x26e50a(%rip), %r14    # 0x2f7740
movl %eax, (%r14)
leaq 0x26e504(%rip), %r15    # 0x2f7744
movl %eax, (%r15)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
mulsd 0x7f07c(%rip), %xmm0    # 0x1082d0
mulsd 0x6c644(%rip), %xmm0    # 0xf58a0
divsd 0x6c644(%rip), %xmm0    # 0xf58a8
leaq 0x26dd65(%rip), %rax    # 0x2f6fd0
movsd %xmm0, (%rax)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
mulsd 0x7f050(%rip), %xmm0    # 0x1082d0
mulsd 0x6c618(%rip), %xmm0    # 0xf58a0
divsd 0x6c618(%rip), %xmm0    # 0xf58a8
leaq 0x26dd41(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
divsd 0x69db4(%rip), %xmm0    # 0xf3060
leaq 0x26dd2d(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
callq 0x51cf3
callq 0x51c63
cwtl
cvtsi2ss %eax, %xmm0
divss 0x6de22(%rip), %xmm0    # 0xf70f0
cvtss2sd %xmm0, %xmm0
leaq 0x184227(%rip), %rax    # 0x20d500
movsd %xmm0, (%rax)
callq 0x51c63
cwtl
cvtsi2ss %eax, %xmm0
divss 0x6de01(%rip), %xmm0    # 0xf70f0
cvtss2sd %xmm0, %xmm0
leaq 0x1841ee(%rip), %rax    # 0x20d4e8
movsd %xmm0, (%rax)
callq 0x51c63
cwtl
cvtsi2ss %eax, %xmm0
divss 0x6dde0(%rip), %xmm0    # 0xf70f0
cvtss2sd %xmm0, %xmm0
leaq 0x1841d5(%rip), %rax    # 0x20d4f0
movsd %xmm0, (%rax)
callq 0x51c63
cwtl
cvtsi2ss %eax, %xmm0
divss 0x6ddbf(%rip), %xmm0    # 0xf70f0
cvtss2sd %xmm0, %xmm0
leaq 0x1841bc(%rip), %rax    # 0x20d4f8
movsd %xmm0, (%rax)
callq 0x51c63
cwtl
cvtsi2ss %eax, %xmm0
divss 0x6dd9e(%rip), %xmm0    # 0xf70f0
cvtss2sd %xmm0, %xmm0
leaq 0x1841ab(%rip), %rax    # 0x20d508
movsd %xmm0, (%rax)
leaq 0x18417c(%rip), %rax    # 0x20d4e4
orb $0x1f, (%rax)
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x26dc6a(%rip), %rax    # 0x2f6fe8
movsd %xmm0, (%rax)
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x26dc5b(%rip), %rax    # 0x2f6ff0
movsd %xmm0, (%rax)
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x26dc4c(%rip), %rax    # 0x2f6ff8
movsd %xmm0, (%rax)
callq 0x51cf3
callq 0x51cf3
callq 0x51cf3
leaq 0x26df62(%rip), %rax    # 0x2f7328
cmpl $0x0, (%rax)
jne 0x893d8
leaq 0x179472(%rip), %rcx    # 0x202844
movl $0x7ed, (%rcx)          # imm = 0x7ED
movl $0x5, (%rax)
leaq 0x26df47(%rip), %rax    # 0x2f732c
cmpl $0x0, (%rax)
jne 0x893f7
leaq 0x179453(%rip), %rcx    # 0x202844
movl $0x7ee, (%rcx)          # imm = 0x7EE
movl $0x5, (%rax)
movl (%r15), %eax
cvtsi2sd %rax, %xmm1
divsd 0x69c53(%rip), %xmm1    # 0xf3060
addsd 0x69ceb(%rip), %xmm1    # 0xf3100
leaq 0x26e0a1(%rip), %rax    # 0x2f74bd
cmpb $0x0, (%rax)
xorpd %xmm0, %xmm0
je 0x89430
leaq 0x26e2fc(%rip), %rax    # 0x2f7728
cvtsi2sdl (%rax), %xmm0
subsd %xmm0, %xmm1
divsd 0x69bdc(%rip), %xmm1    # 0xf3018
addsd 0x6c4cc(%rip), %xmm1    # 0xf5910
movzwl (%r12), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x6c52b(%rip), %xmm0    # 0xf5980
addsd %xmm1, %xmm0
callq 0x55392
movl (%r15), %eax
pushq $0x64
popq %rdi
xorl %edx, %edx
divl %edi
movl %eax, (%r15)
movl (%r14), %eax
xorl %edx, %edx
divl %edi
movl %eax, (%r14)
movq (%rbx), %rax
pushq $0x64
popq %rcx
cqto
idivq %rcx
movq %rax, (%rbx)
pushq $0x20
popq %rsi
callq 0x5da8c
leaq 0x82790(%rip), %rax     # 0x10bc22
leaq 0x19fa5f(%rip), %rcx    # 0x228ef8
movq %rax, (%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x694f6
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq