// File: /workspace/github_cpp_makefile_star2_O2/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 0x9349f(%rip), %rdi     # 0x10cf41
callq 0x520bf
leaq 0x1ae8e2(%rip), %rax    # 0x228390
movq (%rax), %rdi
leaq 0x188e0c(%rip), %rax    # 0x2028c4
testq %rdi, %rdi
je 0x79ae4
cmpb $0x0, (%rax)
je 0x79ae4
leaq 0x2a878b(%rip), %rax    # 0x322254
movzwl (%rax), %edx
leaq 0x2a877f(%rip), %rax    # 0x322252
movzwl (%rax), %ecx
leaq 0x9346c(%rip), %rsi     # 0x10cf49
xorl %eax, %eax
callq 0x9560
movl $0x1, 0x2e233e(%rip)    # 0x35be2c
leaq 0x2a875f(%rip), %rax    # 0x322254
movw $0xa, (%rax)
callq 0x51c63
cmpl $0x0, 0x2e234e(%rip)    # 0x35be54
jne 0x79b0d
callq 0x56b1c
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x2e2339(%rip)    # 0x35be54
callq 0x51c47
movzbl %al, %r15d
imulq $0x348, %r15, %rbx      # imm = 0x348
leaq 0x1af47e(%rip), %r12    # 0x228fb0
movl $0x1, 0x218(%r12,%rbx)
callq 0x51c47
movzbl %al, %r14d
callq 0x51c47
movzbl %al, %r13d
addl %r13d, %r13d
cvtsi2ss %r13d, %xmm0
movl %r14d, -0x48(%rbp)
cvtsi2ss %r14d, %xmm1
movl %r15d, %edi
callq 0x53b74
callq 0x51c47
callq 0x51c47
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movl %eax, 0x68(%r12,%rbx)
callq 0x51c47
callq 0x51c47
callq 0x51c47
movzbl %al, %edx
leaq 0x9208b(%rip), %rax     # 0x10bc22
leaq 0x1af35a(%rip), %rcx    # 0x228ef8
movq %rax, (%rcx)
movl %edx, -0x40(%rbp)
cvtsi2ss %edx, %xmm0
divss 0x8ee24(%rip), %xmm0    # 0x1089d4
movss %xmm0, 0x20(%r12,%rbx)
movl $0x12, 0x1c(%r12,%rbx)
movl %r15d, %edi
callq 0xca4da
leaq 0x27d77d(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
movl %r15d, %edi
callq 0x559ba
callq 0x51c47
callq 0x51e6f
movsd %xmm0, 0x28(%r12,%rbx)
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79bf5
jnp 0x79c06
movl %r15d, %edi
callq 0xca4da
leaq 0x27d740(%rip), %rcx    # 0x2f7344
orl %eax, (%rcx)
addq %rbx, %r12
callq 0x51e6f
mulsd 0x7bcd2(%rip), %xmm0    # 0xf58e8
leaq 0x1ae773(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
leaq 0x188c9a(%rip), %rbx    # 0x2028c4
je 0x79c68
cmpb $0x0, (%rbx)
je 0x79c68
ucomisd 0x793ef(%rip), %xmm0    # 0xf3028
ja 0x79c45
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x79c68
leaq 0x27d924(%rip), %rax    # 0x2f7570
movsd (%rax), %xmm1
leaq 0x93311(%rip), %rsi     # 0x10cf68
movb $0x2, %al
movsd %xmm0, -0x38(%rbp)
callq 0x9560
movsd -0x38(%rbp), %xmm0
movsd %xmm0, 0x38(%r12)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79c7b
jnp 0x79c8c
movl %r15d, %edi
callq 0xca4da
leaq 0x27d6be(%rip), %rcx    # 0x2f7348
orl %eax, (%rcx)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
divsd 0x7943b(%rip), %xmm0    # 0xf30d8
movsd %xmm0, 0x30(%r12)
ucomisd 0x7946c(%rip), %xmm0    # 0xf3118
jne 0x79cb0
jnp 0x79cc1
movl %r15d, %edi
callq 0xca4da
leaq 0x27d681(%rip), %rcx    # 0x2f7340
orl %eax, (%rcx)
callq 0x51cf3
callq 0x51c47
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
xorl $0x20, %eax
movl %eax, 0xa8(%r12)
callq 0x51c47
callq 0x51c47
callq 0x51c47
movzbl %al, %r14d
movl %r15d, %edi
callq 0xca4da
leaq 0x27d65e(%rip), %rcx    # 0x2f735c
orl %eax, (%rcx)
movl %r14d, -0x38(%rbp)
cvtsi2ss %r14d, %xmm0
divss 0x8ecc3(%rip), %xmm0    # 0x1089d4
movss %xmm0, 0x70(%r12)
movl %r15d, %edi
callq 0xca4da
orl %eax, 0x6c(%r12)
callq 0x51c47
callq 0x51e6f
movsd %xmm0, 0x78(%r12)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79d42
jnp 0x79d53
movl %r15d, %edi
callq 0xca4da
leaq 0x27d603(%rip), %rcx    # 0x2f7354
orl %eax, (%rcx)
callq 0x51e6f
mulsd 0x7bb88(%rip), %xmm0    # 0xf58e8
leaq 0x1ae629(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x79dab
cmpb $0x0, (%rbx)
je 0x79dab
ucomisd 0x792ac(%rip), %xmm0    # 0xf3028
ja 0x79d88
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x79dab
leaq 0x27d7e1(%rip), %rax    # 0x2f7570
movsd (%rax), %xmm1
leaq 0x931e9(%rip), %rsi     # 0x10cf83
movb $0x2, %al
movsd %xmm0, -0x30(%rbp)
callq 0x9560
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x88(%r12)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79dc1
jnp 0x79dd2
movl %r15d, %edi
callq 0xca4da
leaq 0x27d588(%rip), %rcx    # 0x2f7358
orl %eax, (%rcx)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
divsd 0x792f5(%rip), %xmm0    # 0xf30d8
movsd %xmm0, 0x80(%r12)
ucomisd 0x79323(%rip), %xmm0    # 0xf3118
jne 0x79df9
jnp 0x79e0a
movl %r15d, %edi
callq 0xca4da
leaq 0x27d548(%rip), %rcx    # 0x2f7350
orl %eax, (%rcx)
callq 0x51cf3
callq 0x51c47
movzbl %al, %r14d
movl %r14d, %eax
xorl $0x20, %eax
movl %eax, 0xe8(%r12)
callq 0x51c47
callq 0x51c47
callq 0x51c47
movzbl %al, %eax
movl %eax, -0x30(%rbp)
cvtsi2ss %eax, %xmm0
divss 0x8eb8d(%rip), %xmm0    # 0x1089d4
movss %xmm0, 0xb0(%r12)
movl $0x12, 0xac(%r12)
movl %r15d, %edi
callq 0xca4da
leaq 0x27d500(%rip), %rcx    # 0x2f736c
orl %eax, (%rcx)
leaq 0x1ae51b(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x79ea4
cmpb $0x0, (%rbx)
je 0x79ea4
cvtss2sd 0x70(%r12), %xmm0
cvtss2sd 0xb0(%r12), %xmm1
leaq 0x93105(%rip), %rsi     # 0x10cf9f
movl %r15d, %edx
movb $0x2, %al
callq 0x9560
callq 0x51c47
callq 0x51e6f
movsd %xmm0, 0xb8(%r12)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79ec4
jnp 0x79ed5
movl %r15d, %edi
callq 0xca4da
leaq 0x27d491(%rip), %rcx    # 0x2f7364
orl %eax, (%rcx)
callq 0x51e6f
mulsd 0x7ba06(%rip), %xmm0    # 0xf58e8
leaq 0x1ae4a7(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x79f2d
cmpb $0x0, (%rbx)
je 0x79f2d
ucomisd 0x7912a(%rip), %xmm0    # 0xf3028
ja 0x79f0a
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x79f2d
leaq 0x27d65f(%rip), %rax    # 0x2f7570
movsd (%rax), %xmm1
leaq 0x9309c(%rip), %rsi     # 0x10cfb8
movb $0x2, %al
movsd %xmm0, -0x50(%rbp)
callq 0x9560
movsd -0x50(%rbp), %xmm0
movsd %xmm0, 0xc8(%r12)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x79f43
jnp 0x79f54
movl %r15d, %edi
callq 0xca4da
leaq 0x27d416(%rip), %rcx    # 0x2f7368
orl %eax, (%rcx)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
divsd 0x79173(%rip), %xmm0    # 0xf30d8
movsd %xmm0, 0xc0(%r12)
ucomisd 0x791a1(%rip), %xmm0    # 0xf3118
jne 0x79f7b
jnp 0x79f8c
movl %r15d, %edi
callq 0xca4da
leaq 0x27d3d6(%rip), %rcx    # 0x2f7360
orl %eax, (%rcx)
callq 0x51cf3
leaq 0x1ae3f8(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x7a07f
cmpb $0x0, (%rbx)
je 0x7a07f
movsd 0x38(%r12), %xmm1
movsd 0x28(%r12), %xmm0
movsd 0x30(%r12), %xmm2
leaq 0x9300b(%rip), %rsi     # 0x10cfd4
movl %r15d, %edx
movb $0x3, %al
callq 0x9560
movl %r13d, %ebx
movl %r14d, %r13d
leaq 0x1ae3b0(%rip), %r14    # 0x228390
movq (%r14), %rdi
movsd 0x88(%r12), %xmm1
movsd 0x78(%r12), %xmm0
movsd 0x80(%r12), %xmm2
leaq 0x92ffb(%rip), %rsi     # 0x10d000
movl %r15d, %edx
movb $0x3, %al
callq 0x9560
movq (%r14), %rdi
movsd 0xc8(%r12), %xmm1
movsd 0xb8(%r12), %xmm0
movsd 0xc0(%r12), %xmm2
leaq 0x92ff5(%rip), %rsi     # 0x10d02c
movl %r15d, %edx
movb $0x3, %al
callq 0x9560
movq (%r14), %rdi
leaq 0x9300d(%rip), %rsi     # 0x10d058
movl -0x44(%rbp), %edx
movl -0x3c(%rbp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x9560
movq (%r14), %rdi
movl -0x30(%rbp), %eax
movl %eax, (%rsp)
leaq 0x93010(%rip), %rsi     # 0x10d07b
movl %ebx, %edx
movl -0x48(%rbp), %ecx
movl -0x40(%rbp), %r8d
movl -0x38(%rbp), %r9d
xorl %eax, %eax
callq 0x9560
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq