// File: /workspace/github_cpp_makefile_star2_O3/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 0x9d9b7(%rip), %rdi     # 0x122ff9
callq 0x58dc2
leaq 0x1b8d42(%rip), %rax    # 0x23e390
movq (%rax), %rdi
leaq 0x19326c(%rip), %r15    # 0x2188c4
testq %rdi, %rdi
je 0x85685
cmpb $0x0, (%r15)
je 0x85685
leaq 0x2b2bea(%rip), %rax    # 0x338254
movzwl (%rax), %edx
leaq 0x2b2bde(%rip), %rax    # 0x338252
movzwl (%rax), %ecx
leaq 0x9d983(%rip), %rsi     # 0x123001
xorl %eax, %eax
callq 0x9560
movl $0x1, 0x2ec79d(%rip)    # 0x371e2c
leaq 0x2b2bbe(%rip), %rax    # 0x338254
movw $0xa, (%rax)
callq 0x588d2
cmpl $0x0, 0x2ec7ad(%rip)    # 0x371e54
jne 0x856cf
movl $0x218, %eax            # imm = 0x218
leaq 0x1b98fb(%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 0x856b7
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x856e5
leaq 0x1b988e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x2ec766(%rip)    # 0x371e54
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85704
leaq 0x1b986f(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r14d
imulq $0x348, %r14, %r12      # imm = 0x348
leaq 0x1b989a(%rip), %rbx    # 0x23efb0
movl $0x1, 0x218(%rbx,%r12)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85738
leaq 0x1b983b(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r13d
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85752
leaq 0x1b9821(%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 0x5ace1
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85781
leaq 0x1b97f2(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
addq %r12, %rbx
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x8579a
leaq 0x1b97d9(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, -0x40(%rbp)
movl %eax, 0x68(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x857b9
leaq 0x1b97ba(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x857cf
leaq 0x1b97a4(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x857e5
leaq 0x1b978e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %edx
leaq 0x9c4eb(%rip), %rax     # 0x121cda
leaq 0x1b9702(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
movl %edx, -0x3c(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
divss 0x99251(%rip), %xmm0    # 0x11ea5c
movss %xmm0, 0x20(%rbx)
movl $0x12, 0x1c(%rbx)
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287b26(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movl %r14d, %edi
callq 0x5cdab
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85846
leaq 0x1b972d(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b08
movsd %xmm0, 0x28(%rbx)
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8585b
jnp 0x8586c
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287ada(%rip), %rcx    # 0x30d344
orl %eax, (%rcx)
callq 0x58b08
mulsd 0x85ff7(%rip), %xmm0    # 0x10b870
leaq 0x1b8b10(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x858c5
cmpb $0x0, (%r15)
je 0x858c5
ucomisd 0x83792(%rip), %xmm0    # 0x109028
ja 0x858a2
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x858c5
leaq 0x287cc7(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d76c(%rip), %rsi     # 0x123020
movb $0x2, %al
movsd %xmm0, -0x30(%rbp)
callq 0x9560
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x38(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x858d6
jnp 0x858e7
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287a63(%rip), %rcx    # 0x30d348
orl %eax, (%rcx)
callq 0x58964
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x837dd(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0x30(%rbx)
ucomisd 0x83810(%rip), %xmm0    # 0x109118
jne 0x8590c
jnp 0x8591d
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287a25(%rip), %rcx    # 0x30d340
orl %eax, (%rcx)
callq 0x58964
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85938
leaq 0x1b963b(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, -0x38(%rbp)
xorl $0x20, %eax
movl %eax, 0xa8(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x8595d
leaq 0x1b9616(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85973
leaq 0x1b9600(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85989
leaq 0x1b95ea(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r12d
movl %r14d, %edi
callq 0xdc1dd
leaq 0x2879c0(%rip), %rcx    # 0x30d35c
orl %eax, (%rcx)
movl %r12d, -0x34(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x990aa(%rip), %xmm0    # 0x11ea5c
movss %xmm0, 0x70(%rbx)
movl %r14d, %edi
callq 0xdc1dd
orl %eax, 0x6c(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x859d8
leaq 0x1b959b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b08
movsd %xmm0, 0x78(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x859ee
jnp 0x859ff
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287957(%rip), %rcx    # 0x30d354
orl %eax, (%rcx)
callq 0x58b08
mulsd 0x85e64(%rip), %xmm0    # 0x10b870
leaq 0x1b897d(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85a58
cmpb $0x0, (%r15)
je 0x85a58
ucomisd 0x835ff(%rip), %xmm0    # 0x109028
ja 0x85a35
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x85a58
leaq 0x287b34(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d5f4(%rip), %rsi     # 0x12303b
movb $0x2, %al
movsd %xmm0, -0x30(%rbp)
callq 0x9560
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x88(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85a6c
jnp 0x85a7d
movl %r14d, %edi
callq 0xdc1dd
leaq 0x2878dd(%rip), %rcx    # 0x30d358
orl %eax, (%rcx)
callq 0x58964
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x83647(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0x80(%rbx)
ucomisd 0x83677(%rip), %xmm0    # 0x109118
jne 0x85aa5
jnp 0x85ab6
movl %r14d, %edi
callq 0xdc1dd
leaq 0x28789c(%rip), %rcx    # 0x30d350
orl %eax, (%rcx)
movl %r13d, -0x30(%rbp)
callq 0x58964
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85ad5
leaq 0x1b949e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r13d
movl %r13d, %eax
xorl $0x20, %eax
movl %eax, 0xe8(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85afb
leaq 0x1b9478(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85b11
leaq 0x1b9462(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85b27
leaq 0x1b944c(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r12d
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x98f21(%rip), %xmm0    # 0x11ea5c
movss %xmm0, 0xb0(%rbx)
movl $0x12, 0xac(%rbx)
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287810(%rip), %rcx    # 0x30d36c
orl %eax, (%rcx)
leaq 0x1b882b(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85b97
cmpb $0x0, (%r15)
je 0x85b97
xorps %xmm0, %xmm0
cvtss2sd 0x70(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0xb0(%rbx), %xmm1
leaq 0x9d4ca(%rip), %rsi     # 0x123057
movl %r14d, %edx
movb $0x2, %al
callq 0x9560
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85bad
leaq 0x1b93c6(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x58b08
movsd %xmm0, 0xb8(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85bc6
jnp 0x85bd7
movl %r14d, %edi
callq 0xdc1dd
leaq 0x28778f(%rip), %rcx    # 0x30d364
orl %eax, (%rcx)
callq 0x58b08
mulsd 0x85c8c(%rip), %xmm0    # 0x10b870
leaq 0x1b87a5(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85c30
cmpb $0x0, (%r15)
je 0x85c30
ucomisd 0x83427(%rip), %xmm0    # 0x109028
ja 0x85c0d
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x85c30
leaq 0x28795c(%rip), %rax    # 0x30d570
movsd (%rax), %xmm1
leaq 0x9d451(%rip), %rsi     # 0x123070
movb $0x2, %al
movsd %xmm0, -0x50(%rbp)
callq 0x9560
movsd -0x50(%rbp), %xmm0
movsd %xmm0, 0xc8(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x85c44
jnp 0x85c55
movl %r14d, %edi
callq 0xdc1dd
leaq 0x287715(%rip), %rcx    # 0x30d368
orl %eax, (%rcx)
callq 0x58964
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8346f(%rip), %xmm0    # 0x1090d8
movsd %xmm0, 0xc0(%rbx)
ucomisd 0x8349f(%rip), %xmm0    # 0x109118
jne 0x85c7d
jnp 0x85c8e
movl %r14d, %edi
callq 0xdc1dd
leaq 0x2876d4(%rip), %rcx    # 0x30d360
orl %eax, (%rcx)
callq 0x58964
leaq 0x1b86f6(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85d69
cmpb $0x0, (%r15)
je 0x85d69
movsd 0x38(%rbx), %xmm1
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm2
leaq 0x9d3c6(%rip), %rsi     # 0x12308c
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
leaq 0x1b86b9(%rip), %r15    # 0x23e390
movq (%r15), %rdi
movsd 0x88(%rbx), %xmm1
movsd 0x78(%rbx), %xmm0
movsd 0x80(%rbx), %xmm2
leaq 0x9d3c2(%rip), %rsi     # 0x1230b8
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
movq (%r15), %rdi
movsd 0xc8(%rbx), %xmm1
movsd 0xb8(%rbx), %xmm0
movsd 0xc0(%rbx), %xmm2
leaq 0x9d3c2(%rip), %rsi     # 0x1230e4
movl %r14d, %edx
movb $0x3, %al
callq 0x9560
movq (%r15), %rdi
leaq 0x9d3da(%rip), %rsi     # 0x123110
movl -0x40(%rbp), %edx
movl -0x38(%rbp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x9560
movq (%r15), %rdi
movl %r12d, (%rsp)
leaq 0x9d3df(%rip), %rsi     # 0x123133
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