// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_ubx_raw()
void parse_ubx_raw()
{
int sats;
double carrier;
double range;
float doppler;
int prn;
int snr;
int lol;
int tow;
int week;
double meas_tow;
int xtow;

   // get doppler and code phase data (only on special receivers)
   log_packet_id("UBX_RAW");
   if(have_ubx_rawx) return;

   tow = tsip_dword();  // tow
   week = tsip_word();  // week
   sats = tsip_byte();

   meas_tow = ((double) tow) / 1000.0;
   if(1 || (nav_rate > 1.0)) {
      xtow = (int) (meas_tow*(double) nav_rate);  // raw Hz 
//sprintf(debug_text, "meas_tow:%.7ff  xtow=%d  ", meas_tow, xtow);  //rnx3
      if(xtow % (int) ((double)raw_msg_rate*nav_rate)) return;
   }

   obs_tow = meas_tow;
   jd_obs = GPS_EPOCH + ((double) week * 7.0) + jtime(0,0,0,meas_tow);
   if(first_obs == 1) return;

   while(sats--) {
      tsip_byte();
      carrier = tsip_double();
      range = tsip_double();
      doppler = tsip_single();
      prn = tsip_byte();  // !!!! SVN?
      snr = tsip_byte();
      lol = tsip_byte();  // lock quality

      if((prn >= 1) && (prn <= MAX_PRN)) { 
         sat[prn].doppler = doppler;
         sat[prn].code_phase = carrier;
         sat[prn].range = range;


         sat[prn].ca_lli = 0;
         sat[prn].l1_lli = 0;
         sat[prn].l2_lli = 0;
         if(lol < 6) sat[prn].ca_lli |= LOCK_LOST;
//       sat[prn].sig_level = (float) snr;
//       sat[prn].level_msg = 4;
//       record_sig_levels(prn);

         have_snr |= rinex_gnss(prn);
         if(doppler != 0.0F) {
            if(have_doppler == 0) need_redraw = 2018;
            have_doppler |= rinex_gnss(prn);
         }
         if(range != 0.0F) {
            have_range |= rinex_gnss(prn);
         }
         if(carrier != 0.0F) {
            have_phase |= rinex_gnss(prn);
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x878c9(%rip), %rdi     # 0x10e64b
callq 0x520bf
leaq 0x270622(%rip), %rax    # 0x2f73b0
cmpl $0x0, (%rax)
jne 0x86e3b
callq 0x51cf3
movl %eax, %ebx
callq 0x51c63
movl %eax, %r14d
callq 0x51c47
cvtsi2sd %ebx, %xmm0
divsd 0x6c281(%rip), %xmm0    # 0xf3038
leaq 0x17e59a(%rip), %rcx    # 0x205358
movsd (%rcx), %xmm1
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %ecx
movl %eax, %ebx
leaq 0x17e5a1(%rip), %rax    # 0x205378
cvtsi2sdl (%rax), %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %esi
movl %ecx, %eax
cltd
idivl %esi
testl %edx, %edx
jne 0x86e3b
leaq 0x270785(%rip), %rax    # 0x2f7578
movsd %xmm0, (%rax)
movzwl %r14w, %eax
cvtsi2sd %eax, %xmm1
mulsd 0x6eb79(%rip), %xmm1    # 0xf5980
addsd 0x6eb01(%rip), %xmm1    # 0xf5910
movsd %xmm1, -0x38(%rbp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xc2faf
addsd -0x38(%rbp), %xmm0
leaq 0x270745(%rip), %rax    # 0x2f7570
movsd %xmm0, (%rax)
leaq 0x27074a(%rip), %rax    # 0x2f7580
cmpl $0x1, (%rax)
jne 0x86e4a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %bl, %r14d
leaq 0x1a215b(%rip), %r15    # 0x228fb0
leaq 0x2704f0(%rip), %r12    # 0x2f734c
leaq 0x2704dd(%rip), %r13    # 0x2f7340
subl $0x1, %r14d
jb 0x86e3b
callq 0x51c47
callq 0x51e6f
movsd %xmm0, -0x38(%rbp)
callq 0x51e6f
movsd %xmm0, -0x40(%rbp)
callq 0x51dc3
movss %xmm0, -0x2c(%rbp)
callq 0x51c47
movl %eax, %ebx
callq 0x51c47
callq 0x51c47
testb %bl, %bl
je 0x86e63
movzbl %bl, %ebx
cvtss2sd -0x2c(%rbp), %xmm0
movl %ebx, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
movsd %xmm0, 0x30(%r15,%rcx)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, 0x28(%r15,%rcx)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x38(%r15,%rcx)
andl $0x0, 0x68(%r15,%rcx)
andl $0x0, 0xa8(%r15,%rcx)
andl $0x0, 0xe8(%r15,%rcx)
cmpb $0x5, %al
ja 0x86ef7
addq %r15, %rcx
movl $0x80, 0x68(%rcx)
movl %ebx, %edi
callq 0xca4da
orl %eax, (%r12)
movss -0x2c(%rbp), %xmm0
ucomiss 0x70202(%rip), %xmm0    # 0xf7110
jne 0x86f12
jnp 0x86f31
cmpl $0x0, (%r13)
jne 0x86f26
leaq 0x17b924(%rip), %rax    # 0x202844
movl $0x7e2, (%rax)          # imm = 0x7E2
movl %ebx, %edi
callq 0xca4da
orl %eax, (%r13)
movsd -0x40(%rbp), %xmm0
ucomisd 0x6c1da(%rip), %xmm0    # 0xf3118
jne 0x86f42
jnp 0x86f52
movl %ebx, %edi
callq 0xca4da
leaq 0x2703f8(%rip), %rcx    # 0x2f7348
orl %eax, (%rcx)
movsd -0x38(%rbp), %xmm0
ucomisd 0x6c1b9(%rip), %xmm0    # 0xf3118
jne 0x86f67
jnp 0x86e63
movl %ebx, %edi
callq 0xca4da
leaq 0x2703cf(%rip), %rcx    # 0x2f7344
orl %eax, (%rcx)
jmp 0x86e63