// File: /workspace/github_cpp_makefile_star2_O3/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 0x907ce(%rip), %rdi     # 0x124703
callq 0x58dc2
leaq 0x27946f(%rip), %rax    # 0x30d3b0
cmpl $0x0, (%rax)
jne 0x9419f
callq 0x58964
movl %eax, %r15d
callq 0x588d2
movl %eax, %r14d
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x93f72
leaq 0x1ab001(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
cvtsi2sd %r15d, %xmm0
divsd 0x750b9(%rip), %xmm0    # 0x109038
leaq 0x1873d2(%rip), %rax    # 0x21b358
movsd (%rax), %xmm1
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
leaq 0x1873db(%rip), %rcx    # 0x21b378
xorps %xmm2, %xmm2
cvtsi2sdl (%rcx), %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %ecx
cltd
idivl %ecx
testl %edx, %edx
jne 0x9419f
leaq 0x2795ba(%rip), %rax    # 0x30d578
movsd %xmm0, (%rax)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd492e
leaq 0x2795ac(%rip), %rax    # 0x30d580
cmpl $0x1, (%rax)
sete %al
movzwl %r14w, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd 0x7791b(%rip), %xmm1    # 0x10b908
andl $0xff, %ebx
addsd 0x7789d(%rip), %xmm1    # 0x10b898
addsd %xmm0, %xmm1
leaq 0x27956a(%rip), %rcx    # 0x30d570
movsd %xmm1, (%rcx)
sete %cl
orb %al, %cl
jne 0x9419f
leaq 0x1aaf94(%rip), %r12    # 0x23efb0
leaq 0x27931d(%rip), %rcx    # 0x30d340
leaq 0x1aaf46(%rip), %r13    # 0x23ef70
movq %rcx, %r15
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9403e
orb $0x8, (%r13)
callq 0x58b08
movsd %xmm0, -0x40(%rbp)
callq 0x58b08
movsd %xmm0, -0x38(%rbp)
callq 0x58a30
movss %xmm0, -0x2c(%rbp)
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x94070
orb $0x8, (%r13)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x94081
orb $0x8, (%r13)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x94092
orb $0x8, (%r13)
movzbl %r14b, %r14d
testl %r14d, %r14d
movq %r15, %rcx
je 0x94197
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
movl %r14d, %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 0x940f8
addq %r12, %rcx
movl $0x80, 0x68(%rcx)
movl %r14d, %edi
callq 0xdc1dd
leaq 0x279245(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movss -0x2c(%rbp), %xmm0
ucomiss 0x78f7b(%rip), %xmm0    # 0x10d090
movq %r15, %rcx
jne 0x9411c
jnp 0x9414d
movq %r13, %r12
cmpl $0x0, (%rcx)
movq %rcx, %r13
jne 0x94134
leaq 0x184716(%rip), %rax    # 0x218844
movl $0x7e2, (%rax)          # imm = 0x7E2
movl %r14d, %edi
callq 0xdc1dd
orl %eax, (%r13)
movq %r13, %rcx
movq %r12, %r13
leaq 0x1aae63(%rip), %r12    # 0x23efb0
movsd -0x38(%rbp), %xmm0
ucomisd 0x74fbe(%rip), %xmm0    # 0x109118
jne 0x9415e
jnp 0x94172
movl %r14d, %edi
callq 0xdc1dd
movq %r15, %rcx
leaq 0x2791d8(%rip), %rdx    # 0x30d348
orl %eax, (%rdx)
movsd -0x40(%rbp), %xmm0
ucomisd 0x74f99(%rip), %xmm0    # 0x109118
jne 0x94183
jnp 0x94197
movl %r14d, %edi
callq 0xdc1dd
movq %r15, %rcx
leaq 0x2791af(%rip), %rdx    # 0x30d344
orl %eax, (%rdx)
decl %ebx
jne 0x9402a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq