// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_crm()
void parse_crm()
{
int i;
int prn;
static int tow = 0;
double val;

   prn = 0;
   if(get_msg_field()) {  // tow
      tow = atoi(msg_field);
      if(raw_msg_rate) {  // receiver always outputs RAW data at 1 Hz
         if((tow % raw_msg_rate) != 0) return;  // drop unwanted messages
      }
      else return;

      if(0) {
         pri_tow = i;
         this_tow = i;
         survey_tow = i;

         if(have_tow == 0) need_redraw = 3087;
         have_tow = 87;
      }
   }

   if(get_msg_field()) {  // sentence number
      i = atoi(msg_field);
      if(i == 1) {
         obs_tow = tow;
         jd_obs = GPS_EPOCH + ((double) gps_week * 7.0) + jtime(0,0,0,tow);
      }
   }

   if(get_msg_field()) {  // max sentences
      i = atoi(msg_field);
   }

   if(get_msg_field()) {  // gps system
      i = atoi(msg_field);
   }

   if(get_msg_field()) {  // prn
      prn = atoi(msg_field);
      if(prn < 0) prn = 0;
      else if(prn > MAX_PRN) prn = 0;
   }

   if(get_msg_field()) {  // reserved
      i = atoi(msg_field);
   }

   if(get_msg_field()) {  // snr - we get this from NMEA messages
      i = atoi(msg_field);
   }

   if(get_msg_field()) {  // accumulated doppler range
      val = atof(msg_field);
      val /= (64.0);  // meters
      sat[prn].accum_range = val;
      have_accum_range = 87;
   }

   // Note: the GT87 can output "stuck" doppler and pseudorange values
   //       for sats that are supposed to be actively tracked.  We filter
   //       stuck values out when writinf RINEX file.
   if(get_msg_field()) {  // doppler freq
      val = atof(msg_field);  // meters/sec, scaled
      val /= (-4096.0);  // meters/sec
      val *= 1575.42E6 / (LIGHTSPEED*1000.0);   // !!!!!! need GLONASS freq
      sat[prn].doppler = val;
      if(val) {
         have_doppler |= rinex_gnss(prn);
      }
   }

   if(get_msg_field()) {  // pseudorange
      val = atof(msg_field);  // meters, scaled
      val /= (64.0);  // meters
      sat[prn].range = val;
      if(val) {
         have_range |= rinex_gnss(prn);
      }
   }

   sat[prn].ca_lli = 0;
   sat[prn].l1_lli = 0;
   sat[prn].l2_lli = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x8(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb544a
leaq 0x2e5810(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, 0x31bbdd(%rip)    # 0x3d0ff8
leaq 0x1c5136(%rip), %rax    # 0x27a558
cmpl $0x0, (%rax)
je 0xb5443
movl 0x31bbcb(%rip), %eax    # 0x3d0ff8
leaq 0x1c5124(%rip), %rcx    # 0x27a558
cltd
idivl (%rcx)
cmpl $0x0, %edx
je 0xb5441
jmp 0xb5740
jmp 0xb5448
jmp 0xb5740
jmp 0xb544a
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb54d3
leaq 0x2e57c5(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0xb54d1
cvtsi2sdl 0x31bb87(%rip), %xmm0 # 0x3d0ff8
leaq 0x2b72e0(%rip), %rax    # 0x36c758
movsd %xmm0, (%rax)
leaq 0x2b7495(%rip), %rax    # 0x36c918
movzwl (%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0xbc1f6(%rip), %xmm1    # 0x171688
mulsd %xmm1, %xmm0
movsd 0xbc17a(%rip), %xmm1    # 0x171618
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
cvtsi2sdl 0x31bb49(%rip), %xmm0 # 0x3d0ff8
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x18(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq 0x2b7283(%rip), %rax    # 0x36c750
movsd %xmm0, (%rax)
jmp 0xb54d3
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb54ec
leaq 0x2e573c(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5505
leaq 0x2e5723(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5541
leaq 0x2e570a(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jge 0xb552d
movl $0x0, -0x8(%rbp)
jmp 0xb553f
cmpl $0x3e7, -0x8(%rbp)      # imm = 0x3E7
jle 0xb553d
movl $0x0, -0x8(%rbp)
jmp 0xb553f
jmp 0xb5541
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb555a
leaq 0x2e56ce(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5573
leaq 0x2e56b5(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb55d0
leaq 0x2e569c(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0xcda35(%rip), %xmm1    # 0x182fd0
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1e8bdc(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
leaq 0x2b6fce(%rip), %rax    # 0x36c598
movl $0x57, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb5666
leaq 0x2e563b(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0xcd9e4(%rip), %xmm1    # 0x182fe0
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0xcd9cb(%rip), %xmm0    # 0x182fd8
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1e8b69(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd %xmm0, 0x30(%rax)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xb5648
jp 0xb5648
jmp 0xb5664
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2b6ec7(%rip), %rax    # 0x36c520
orl (%rax), %ecx
leaq 0x2b6ebe(%rip), %rax    # 0x36c520
movl %ecx, (%rax)
jmp 0xb5666
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb56e6
leaq 0x2e55a9(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0xcd942(%rip), %xmm1    # 0x182fd0
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1e8ae9(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xb56c8
jp 0xb56c8
jmp 0xb56e4
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2b6e4f(%rip), %rax    # 0x36c528
orl (%rax), %ecx
leaq 0x2b6e46(%rip), %rax    # 0x36c528
movl %ecx, (%rax)
jmp 0xb56e6
movslq -0x8(%rbp), %rcx
leaq 0x1e8a9f(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0x68(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1e8a83(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0xa8(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1e8a64(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0xe8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)