// File: /workspace/github_cpp_makefile_star2_O1/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 0x90779(%rip), %rdi     # 0x124623
callq 0x58e77
leaq 0x2794fa(%rip), %rax    # 0x30d3b0
cmpl $0x0, (%rax)
jne 0x94115
callq 0x589b0
movl %eax, %r15d
callq 0x588f0
movl %eax, %r14d
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ee7
leaq 0x1ab08c(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
cvtsi2sd %r15d, %xmm0
divsd 0x75144(%rip), %xmm0    # 0x109038
leaq 0x18745d(%rip), %rax    # 0x21b358
movsd (%rax), %xmm1
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
leaq 0x187466(%rip), %rcx    # 0x21b378
xorps %xmm2, %xmm2
cvtsi2sdl (%rcx), %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %ecx
cltd
idivl %ecx
testl %edx, %edx
jne 0x94115
leaq 0x279645(%rip), %rax    # 0x30d578
movsd %xmm0, (%rax)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd41e0
leaq 0x279637(%rip), %rax    # 0x30d580
cmpl $0x1, (%rax)
sete %al
movzwl %r14w, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd 0x7799e(%rip), %xmm1    # 0x10b900
andl $0xff, %ebx
addsd 0x77918(%rip), %xmm1    # 0x10b888
addsd %xmm0, %xmm1
leaq 0x2795f5(%rip), %rcx    # 0x30d570
movsd %xmm1, (%rcx)
sete %cl
orb %al, %cl
jne 0x94115
leaq 0x1ab01f(%rip), %r12    # 0x23efb0
leaq 0x2793a8(%rip), %rcx    # 0x30d340
leaq 0x1aafd1(%rip), %r13    # 0x23ef70
movq %rcx, %r15
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93fb3
orb $0x8, (%r13)
callq 0x58b86
movsd %xmm0, -0x40(%rbp)
callq 0x58b86
movsd %xmm0, -0x38(%rbp)
callq 0x58aae
movss %xmm0, -0x2c(%rbp)
callq 0x587d1
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93fe5
orb $0x8, (%r13)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ff6
orb $0x8, (%r13)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x94007
orb $0x8, (%r13)
testb %r14b, %r14b
movq %r15, %rcx
je 0x9410d
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
movzbl %r14b, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
movsd %xmm0, 0x30(%r12,%rcx)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x28(%r12,%rcx)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, 0x38(%r12,%rcx)
xorl %edx, %edx
movl %edx, 0x68(%r12,%rcx)
movl %edx, 0xa8(%r12,%rcx)
movl %edx, 0xe8(%r12,%rcx)
cmpb $0x5, %al
ja 0x9406a
addq %r12, %rcx
movl $0x80, 0x68(%rcx)
movzbl %r14b, %r14d
movl %r14d, %edi
callq 0xdbb74
leaq 0x2792cf(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movss -0x2c(%rbp), %xmm0
ucomiss 0x78f71(%rip), %xmm0    # 0x10cffc
movq %r15, %rcx
jne 0x94092
jnp 0x940c3
movq %r13, %r12
cmpl $0x0, (%rcx)
movq %rcx, %r13
jne 0x940aa
leaq 0x1847a0(%rip), %rax    # 0x218844
movl $0x7e2, (%rax)          # imm = 0x7E2
movl %r14d, %edi
callq 0xdbb74
orl %eax, (%r13)
movq %r13, %rcx
movq %r12, %r13
leaq 0x1aaeed(%rip), %r12    # 0x23efb0
movsd -0x38(%rbp), %xmm0
ucomisd 0x75048(%rip), %xmm0    # 0x109118
jne 0x940d4
jnp 0x940e8
movl %r14d, %edi
callq 0xdbb74
movq %r15, %rcx
leaq 0x279262(%rip), %rdx    # 0x30d348
orl %eax, (%rdx)
movsd -0x40(%rbp), %xmm0
ucomisd 0x75023(%rip), %xmm0    # 0x109118
jne 0x940f9
jnp 0x9410d
movl %r14d, %edi
callq 0xdbb74
movq %r15, %rcx
leaq 0x279239(%rip), %rdx    # 0x30d344
orl %eax, (%rdx)
decl %ebx
jne 0x93f9f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq