// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_z12_mpc()
void parse_z12_mpc()
{
int prn;
int az, el;
int snr,l1_snr,l2_snr;
int warn_ca,warn_l1,warn_l2;
double prange;
double phase;
static int last_msg = 0;
double val;

   // binary format message
   log_packet_id("z12_mpc");

if(debug_file && show_debug_info) {
   fprintf(debug_file, "decoding MPC: rptr:%d wptr:%d\n", tsip_rptr, tsip_wptr);
}

in_mpc = 1;
   tsip_rptr = 10;

   tsip_word();      // sequence tag

   if(last_msg == 0) {
      reset_sat_tracking();
   }
   last_msg = tsip_byte();

   prn = tsip_byte();
   if(prn < 0) prn = 0;
   else if(prn > MAX_PRN) prn = 0;
   sat[prn].tracking = 1;

   el = tsip_byte();
   az = tsip_byte() * 2;
   set_sat_azel(prn, (float) az, (float) el);

   tsip_byte();  // channel

   // start of C/A code raw measuement data
   warn_ca = tsip_byte();  // warn flag
   sat[prn].ca_lli = warn_ca;
   tsip_byte();  // good bad flag
   tsip_byte();  // space

   snr = tsip_byte();
   level_type = "dBc";
   sat[prn].sig_level = ((float) snr) / (float) Z12_SNR_SCALE;
   sat[prn].level_msg = 0x12;
   have_snr |= rinex_gnss(prn);
   record_sig_levels(prn);

   tsip_byte();  // spare

   phase = tsip_double();
   sat[prn].code_phase = phase;
   if(phase) {
      have_phase |= rinex_gnss(prn);
   }

   prange = tsip_double();
   prange *= (LIGHTSPEED*1000.0);
if(debug_file && show_debug_info) {
   if((prange > 1.0E9) || (prange < 0.0)) fprintf(debug_file, "range err:%f  jd_obs:%.9f\n", prange, jd_obs);
}
   sat[prn].range = prange;
   if(prange) {
      have_range |= rinex_gnss(prn);
   }

   val = ((double) (int) tsip_dword()) / 10000.0;
   sat[prn].doppler = val;
   if(val) {
      have_doppler |= rinex_gnss(prn);
   }

   tsip_dword();  // smoothing


   // start of L1 code raw measuement data
   warn_l1 = tsip_byte();  // warn flag
   sat[prn].l1_lli = warn_l1 ^ Z_LOSS;
   tsip_byte();  // good bad flag
   tsip_byte();  // space

   l1_snr = tsip_byte();
   have_l1_snr |= rinex_gnss(prn);
   sat[prn].l1_sig_level = ((float) l1_snr) / (float) Z12_SNR_SCALE;
   sat[prn].l1_level_msg |= rinex_gnss(prn);

   tsip_byte();  // spare

   phase = tsip_double();
   sat[prn].l1_code_phase = phase;
   if(phase) {
      have_l1_phase |= rinex_gnss(prn);
   }

   prange = tsip_double();
   prange *= (LIGHTSPEED*1000.0);
if(debug_file && show_debug_info) {
   if((prange > 1.0E9) || (prange < 0.0)) fprintf(debug_file, "range1 err:%f  jd_obs:%.9f\n", prange, jd_obs);
}
   sat[prn].l1_range = prange;
   if(prange) {
      have_l1_range |= rinex_gnss(prn);
   }

   val = ((double) (int) tsip_dword()) / 10000.0;
   sat[prn].l1_doppler = val;
   if(val) {
      have_l1_doppler |= rinex_gnss(prn);
   }

   tsip_dword();  // smoothing


   // start of L2 code raw measuement data
   warn_l2 = tsip_byte();  // warn flag
   sat[prn].l2_lli = warn_l2 ^ Z_LOSS;
   tsip_byte();  // good bad flag
   tsip_byte();  // space

   l2_snr = tsip_byte();
   sat[prn].l2_sig_level = ((float) l2_snr) / (float) Z12_SNR_SCALE;
   sat[prn].l2_level_msg = 0x12;
   have_l2_snr |= rinex_gnss(prn);
if(debug_file && show_debug_info) fprintf(debug_file, "PRN:%d  SNR L1:%f L2:%f\n", prn, sat[prn].l1_sig_level, sat[prn].l2_sig_level);

   tsip_byte();  // spare

   phase = tsip_double();
   sat[prn].l2_code_phase = phase;
   if(phase) {
      have_l2_phase |= rinex_gnss(prn);
   }

   prange = tsip_double();
   prange *= (LIGHTSPEED*1000.0);
if(debug_file && show_debug_info) {
   if((prange > 1.0E9) || (prange < 0.0)) fprintf(debug_file, "range2 err:%f  jd_obs:%.9f\n", prange, jd_obs);
}
   sat[prn].l2_range = prange;
   if(prange) {
      have_l2_range |= rinex_gnss(prn);
   }

   val = ((double) (int) tsip_dword()) / 10000.0;
   sat[prn].l2_doppler = val;
   if(val) {
      have_l2_doppler |= rinex_gnss(prn);
   }

   tsip_dword();  // smoothing

if(debug_file && show_debug_info) {
   fprintf(debug_file, "CA%02d: phase:%-14f range:%-14f  dop:%-14f\n", prn,sat[prn].code_phase, sat[prn].range, sat[prn].doppler);
   fprintf(debug_file, "L1%02d: phase:%-14f range:%-14f  dop:%-14f\n", prn,sat[prn].l1_code_phase, sat[prn].l1_range, sat[prn].l1_doppler);
   fprintf(debug_file, "L2%02d: phase:%-14f range:%-14f  dop:%-14f\n", prn,sat[prn].l2_code_phase, sat[prn].l2_range, sat[prn].l2_doppler);
   fprintf(debug_file, "WARN    CA:%02X  L1:%02X  L2:%02X\n", warn_ca,warn_l1,warn_l2);
   fprintf(debug_file, "az:%d  el:%d  ca_snr:%d  l1_snr:%d  l2_snr:%d\n", az,el,snr,l1_snr,l2_snr);
}

// poll_z12_time(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x9d848(%rip), %rdi     # 0x122f19
callq 0x58e77
leaq 0x1b8cb3(%rip), %rax    # 0x23e390
movq (%rax), %rdi
leaq 0x1931dd(%rip), %r15    # 0x2188c4
testq %rdi, %rdi
je 0x85714
cmpb $0x0, (%r15)
je 0x85714
leaq 0x2b2b5b(%rip), %rax    # 0x338254
movzwl (%rax), %edx
leaq 0x2b2b4f(%rip), %rax    # 0x338252
movzwl (%rax), %ecx
leaq 0x9d814(%rip), %rsi     # 0x122f21
xorl %eax, %eax
callq 0x9560
movl $0x1, 0x2ec70e(%rip)    # 0x371e2c
leaq 0x2b2b2f(%rip), %rax    # 0x338254
movw $0xa, (%rax)
callq 0x588f0
cmpl $0x0, 0x2ec71e(%rip)    # 0x371e54
jne 0x8575e
movl $0x218, %eax            # imm = 0x218
leaq 0x1b986c(%rip), %rcx    # 0x23efb0
xorl %edx, %edx
movl %edx, (%rcx,%rax)
movl %edx, -0x1fc(%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd358, %rax          # imm = 0xCD358
jne 0x85746
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85774
leaq 0x1b97ff(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x2ec6d7(%rip)    # 0x371e54
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85793
leaq 0x1b97e0(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r14d
imulq $0x348, %r14, %r12      # imm = 0x348
leaq 0x1b980b(%rip), %rbx    # 0x23efb0
movl $0x1, 0x218(%rbx,%r12)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x857c7
leaq 0x1b97ac(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r13d
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x857e1
leaq 0x1b9792(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
addl %eax, %eax
movl %eax, -0x44(%rbp)
cvtsi2ss %eax, %xmm0
cvtsi2ss %r13d, %xmm1
movl %r14d, %edi
callq 0x5ad98
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85810
leaq 0x1b9763(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
addq %r12, %rbx
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85829
leaq 0x1b974a(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, -0x40(%rbp)
movl %eax, 0x68(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85848
leaq 0x1b972b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x8585e
leaq 0x1b9715(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85874
leaq 0x1b96ff(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %edx
leaq 0x9c37c(%rip), %rax     # 0x121bfa
leaq 0x1b9673(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
movl %edx, -0x3c(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
divss 0x99112(%rip), %xmm0    # 0x11e9ac
movss %xmm0, 0x20(%rbx)
movl $0x12, 0x1c(%rbx)
movl %r14d, %edi
callq 0xdbb74
leaq 0x287a97(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movl %r14d, %edi
callq 0x5ced3
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x858d5
leaq 0x1b969e(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b86
movsd %xmm0, 0x28(%rbx)
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x858ea
jnp 0x858fb
movl %r14d, %edi
callq 0xdbb74
leaq 0x287a4b(%rip), %rcx    # 0x30d344
orl %eax, (%rcx)
callq 0x58b86
mulsd 0x85f58(%rip), %xmm0    # 0x10b860
leaq 0x1b8a81(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85954
cmpb $0x0, (%r15)
je 0x85954
ucomisd 0x83703(%rip), %xmm0    # 0x109028
ja 0x85931
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x85954
leaq 0x287c38(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d5fd(%rip), %rsi     # 0x122f40
movb $0x2, %al
movsd %xmm0, -0x30(%rbp)
callq 0x9560
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x38(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85965
jnp 0x85976
movl %r14d, %edi
callq 0xdbb74
leaq 0x2879d4(%rip), %rcx    # 0x30d348
orl %eax, (%rcx)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8374e(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0x30(%rbx)
ucomisd 0x83781(%rip), %xmm0    # 0x109118
jne 0x8599b
jnp 0x859ac
movl %r14d, %edi
callq 0xdbb74
leaq 0x287996(%rip), %rcx    # 0x30d340
orl %eax, (%rcx)
callq 0x589b0
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x859c7
leaq 0x1b95ac(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, -0x38(%rbp)
xorl $0x20, %eax
movl %eax, 0xa8(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x859ec
leaq 0x1b9587(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85a02
leaq 0x1b9571(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85a18
leaq 0x1b955b(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r12d
movl %r14d, %edi
callq 0xdbb74
leaq 0x287931(%rip), %rcx    # 0x30d35c
orl %eax, (%rcx)
movl %r12d, -0x34(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x98f6b(%rip), %xmm0    # 0x11e9ac
movss %xmm0, 0x70(%rbx)
movl %r14d, %edi
callq 0xdbb74
orl %eax, 0x6c(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85a67
leaq 0x1b950c(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b86
movsd %xmm0, 0x78(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85a7d
jnp 0x85a8e
movl %r14d, %edi
callq 0xdbb74
leaq 0x2878c8(%rip), %rcx    # 0x30d354
orl %eax, (%rcx)
callq 0x58b86
mulsd 0x85dc5(%rip), %xmm0    # 0x10b860
leaq 0x1b88ee(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85ae7
cmpb $0x0, (%r15)
je 0x85ae7
ucomisd 0x83570(%rip), %xmm0    # 0x109028
ja 0x85ac4
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x85ae7
leaq 0x287aa5(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d485(%rip), %rsi     # 0x122f5b
movb $0x2, %al
movsd %xmm0, -0x30(%rbp)
callq 0x9560
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x88(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85afb
jnp 0x85b0c
movl %r14d, %edi
callq 0xdbb74
leaq 0x28784e(%rip), %rcx    # 0x30d358
orl %eax, (%rcx)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x835b8(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0x80(%rbx)
ucomisd 0x835e8(%rip), %xmm0    # 0x109118
jne 0x85b34
jnp 0x85b45
movl %r14d, %edi
callq 0xdbb74
leaq 0x28780d(%rip), %rcx    # 0x30d350
orl %eax, (%rcx)
movl %r13d, -0x30(%rbp)
callq 0x589b0
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85b64
leaq 0x1b940f(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r13d
movl %r13d, %eax
xorl $0x20, %eax
movl %eax, 0xe8(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85b8a
leaq 0x1b93e9(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85ba0
leaq 0x1b93d3(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85bb6
leaq 0x1b93bd(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r12d
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x98de2(%rip), %xmm0    # 0x11e9ac
movss %xmm0, 0xb0(%rbx)
movl $0x12, 0xac(%rbx)
movl %r14d, %edi
callq 0xdbb74
leaq 0x287781(%rip), %rcx    # 0x30d36c
orl %eax, (%rcx)
leaq 0x1b879c(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85c26
cmpb $0x0, (%r15)
je 0x85c26
xorps %xmm0, %xmm0
cvtss2sd 0x70(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0xb0(%rbx), %xmm1
leaq 0x9d35b(%rip), %rsi     # 0x122f77
movl %r14d, %edx
movb $0x2, %al
callq 0x9560
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85c3c
leaq 0x1b9337(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b86
movsd %xmm0, 0xb8(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85c55
jnp 0x85c66
movl %r14d, %edi
callq 0xdbb74
leaq 0x287700(%rip), %rcx    # 0x30d364
orl %eax, (%rcx)
callq 0x58b86
mulsd 0x85bed(%rip), %xmm0    # 0x10b860
leaq 0x1b8716(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85cbf
cmpb $0x0, (%r15)
je 0x85cbf
ucomisd 0x83398(%rip), %xmm0    # 0x109028
ja 0x85c9c
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x85cbf
leaq 0x2878cd(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d2e2(%rip), %rsi     # 0x122f90
movb $0x2, %al
movsd %xmm0, -0x50(%rbp)
callq 0x9560
movsd -0x50(%rbp), %xmm0
movsd %xmm0, 0xc8(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85cd3
jnp 0x85ce4
movl %r14d, %edi
callq 0xdbb74
leaq 0x287686(%rip), %rcx    # 0x30d368
orl %eax, (%rcx)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x833e0(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0xc0(%rbx)
ucomisd 0x83410(%rip), %xmm0    # 0x109118
jne 0x85d0c
jnp 0x85d1d
movl %r14d, %edi
callq 0xdbb74
leaq 0x287645(%rip), %rcx    # 0x30d360
orl %eax, (%rcx)
callq 0x589b0
leaq 0x1b8667(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85df8
cmpb $0x0, (%r15)
je 0x85df8
movsd 0x38(%rbx), %xmm1
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm2
leaq 0x9d257(%rip), %rsi     # 0x122fac
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
leaq 0x1b862a(%rip), %r15    # 0x23e390
movq (%r15), %rdi
movsd 0x88(%rbx), %xmm1
movsd 0x78(%rbx), %xmm0
movsd 0x80(%rbx), %xmm2
leaq 0x9d253(%rip), %rsi     # 0x122fd8
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
movq (%r15), %rdi
movsd 0xc8(%rbx), %xmm1
movsd 0xb8(%rbx), %xmm0
movsd 0xc0(%rbx), %xmm2
leaq 0x9d253(%rip), %rsi     # 0x123004
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
movq (%r15), %rdi
leaq 0x9d26b(%rip), %rsi     # 0x123030
movl -0x40(%rbp), %edx
movl -0x38(%rbp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x9560
movq (%r15), %rdi
movl %r12d, (%rsp)
leaq 0x9d270(%rip), %rsi     # 0x123053
movl -0x44(%rbp), %edx
movl -0x30(%rbp), %ecx
movl -0x3c(%rbp), %r8d
movl -0x34(%rbp), %r9d
xorl %eax, %eax
callq 0x9560
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq