// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_scpi_azel()
void parse_scpi_azel()
{
int n;
int prn, aaa,eee,sss;
char *s;

   // process the SYST:STAT? az/el info line
   log_packet_id("scpi azel");

   if(no_uccm_ref) {
      gps_status = GPS_NO_SATS;
      have_gps_status = 1;
      minor_alarms |= MINOR_NO_TRACK;
      have_tracking = 1;
   }
   else if(rcvr_type == UCCM_RCVR) {
      have_gps_status = 0;
      minor_alarms &= (~MINOR_NO_TRACK);
      have_tracking = 1;

      if(strstr(scpi_status_line, "MODE")) {
         s = strstr(scpi_status_line, "SURVEY");
         if(s) {
            rcvr_mode = RCVR_MODE_SURVEY;
            minor_alarms |= (MINOR_SURVEY);
            if(scpi_type == SAMSUNG_TYPE) {
               survey_progress = atoi(s+7);
               have_progress = 6;
            }
            else {
               survey_progress = atoi(s+9);
               have_progress = 7;
            }
         }
         else if(strstr(scpi_status_line, "HOLD")) {
            rcvr_mode = RCVR_MODE_HOLD;
            minor_alarms &= (~MINOR_SURVEY);
         }
         else if(strstr(scpi_status_line, "FIXED")) {  // samsung
            rcvr_mode = RCVR_MODE_HOLD;
            minor_alarms &= (~MINOR_SURVEY);
         }
         else {
            rcvr_mode = RCVR_MODE_UNKNOWN;
         }
      }
   }

   while(1) {  // convert '*' (attempting to track) to ' '
      s = strchr(scpi_status_line, '*');
      if(s == 0) break;
      *s = ' ';
   }
   scpi_status_line[17] = 0; // break line between TRACKED and NOT-TRACKED areas

   prn = aaa = eee = sss = (-1);
   n = sscanf(scpi_status_line, "%d %d %d %d", &prn, &eee,&aaa,&sss);
   if((n == 4) && (prn >= 1) && (prn <= MAX_PRN) && (sss >= 0)) {  // 32
      if((aaa >= 0) && (eee >= 0)) {
         set_sat_azel(prn, (float) aaa, (float) eee);
         have_sat_azel = 10;
      }

      sat[prn].sig_level = ((float) sss);
      if(adjust_scpi_ss) {  // scale sig strength level to 0..50
         if(sss > 0) {
            sat[prn].sig_level = (float) (20.0 * log10((double) sss) + 6.00);
         }
         level_type = "SIG";
      }
      else level_type = "C/N";

      sat[prn].level_msg = 15;
      have_snr |= rinex_gnss(prn);
      ++scpi_tracked;
if(rcvr_type == UCCM_RCVR) sat[prn].tracking = 1; // uuuuuu
      record_sig_levels(prn);
   }

   // get not-tracked info
   sss = 0; 
   prn = aaa = eee = (-1);
   n = sscanf(&scpi_status_line[17+1], "%d %d %d", &prn, &eee,&aaa);
   if((n == 3) && (prn >= 1) && (prn <= MAX_PRN) && (aaa >= 0) && (eee >= 0)) { // 32
      set_sat_azel(prn, (float) aaa, (float) eee);
      have_sat_azel = 11;

      sat[prn].sig_level = ((float) 0.001);  // sig levek >0 and <1 allows untracked sat to show in sat map
      sat[prn].level_msg = 16;
      sat[prn].tracking = (-1); // uuuuuu
      have_snr |= rinex_gnss(prn);
      ++scpi_not_tracked;
      record_sig_levels(prn);
   }

   if(0) {  // second column of untracked sats
      sss = 0;
      prn = aaa = eee = (-1);
      n = sscanf(&scpi_status_line[30+1], "%d %d %d", &prn, &eee,&aaa);
      if((n == 3) && (prn >= 1) && (prn <= MAX_PRN) && (aaa >= 0) && (eee >= 0)) { // 32
         set_sat_azel(prn, (float) aaa, (float) eee);
         have_sat_azel = 11;

         sat[prn].sig_level = ((float) 0.001);  // sig levek >0 and <1 allows untracked sat to show in sat map
         sat[prn].level_msg = 16;
         sat[prn].tracking = (-1); // uuuuuu
         have_snr |= rinex_gnss(prn);
         ++scpi_not_tracked;
         record_sig_levels(prn);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq 0x85ac5(%rip), %rdi     # 0x12543f
callq 0x58e77
cmpl $0x0, 0x2d0662(%rip)    # 0x36ffe8
je 0x9f9bb
leaq 0x26db0d(%rip), %rax    # 0x30d49c
movl $0x8, (%rax)
leaq 0x26d914(%rip), %rax    # 0x30d2b0
leaq 0x26d835(%rip), %rcx    # 0x30d1d8
orb $0x8, (%rcx)
movl $0x1, %ecx
movl %ecx, (%rax)
leaq 0x26d8dc(%rip), %rax    # 0x30d290
movl %ecx, (%rax)
jmp 0x9fad8
leaq 0x178f0e(%rip), %rax    # 0x2188d0
cmpq $0x8, (%rax)
jne 0x9fad8
leaq 0x26d8dd(%rip), %rax    # 0x30d2b0
movl $0x0, (%rax)
leaq 0x26d7f8(%rip), %rbx    # 0x30d1d8
movl (%rbx), %r14d
movl %r14d, %r15d
andl $-0x9, %r15d
movl %r15d, (%rbx)
leaq 0x26d89c(%rip), %rax    # 0x30d290
movl $0x1, (%rax)
leaq 0x2cd13f(%rip), %rdi    # 0x36cb40
leaq 0x88304(%rip), %rsi     # 0x127d0c
callq 0x9090
testq %rax, %rax
je 0x9fad8
leaq 0x2cd123(%rip), %rdi    # 0x36cb40
leaq 0x85a25(%rip), %rsi     # 0x125449
callq 0x9090
testq %rax, %rax
je 0x9fa6f
leaq 0x26d69b(%rip), %rcx    # 0x30d0d0
movb $0xb, (%rcx)
orl $0x20, %r15d
movl %r15d, (%rbx)
leaq 0x17b59a(%rip), %rcx    # 0x21afe0
cmpl $0x53, (%rcx)
jne 0x9fab6
addq $0x7, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26e42e(%rip), %rcx    # 0x30de8c
movl %eax, (%rcx)
leaq 0x26e429(%rip), %rax    # 0x30de90
movl $0x6, (%rax)
jmp 0x9fad8
leaq 0x2cd0ca(%rip), %rdi    # 0x36cb40
leaq 0x9647d(%rip), %rsi     # 0x135efa
callq 0x9090
testq %rax, %rax
jne 0x9faa3
leaq 0x2cd0b2(%rip), %rdi    # 0x36cb40
leaq 0x859bb(%rip), %rsi     # 0x125450
callq 0x9090
testq %rax, %rax
je 0x9fd42
leaq 0x26d626(%rip), %rax    # 0x30d0d0
movb $0x7, (%rax)
andl $-0x29, %r14d
movl %r14d, (%rbx)
jmp 0x9fad8
addq $0x9, %rax
movq %rax, %rdi
callq 0x95e0
leaq 0x26e3c3(%rip), %rcx    # 0x30de8c
movl %eax, (%rcx)
leaq 0x26e3be(%rip), %rax    # 0x30de90
movl $0x7, (%rax)
leaq 0x2cd061(%rip), %rdi    # 0x36cb40
movl $0x2a, %esi
callq 0x9100
testq %rax, %rax
je 0x9fb0a
leaq 0x2cd04b(%rip), %rbx    # 0x36cb40
movb $0x20, (%rax)
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
testq %rax, %rax
jne 0x9faf5
movb $0x0, 0x2cd040(%rip)    # 0x36cb51
leaq 0x2cd028(%rip), %rdi    # 0x36cb40
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq -0x28(%rbp), %r9
movl %r12d, (%r9)
leaq -0x2c(%rbp), %rcx
movl %r12d, (%rcx)
leaq -0x30(%rbp), %r8
movl %r12d, (%r8)
leaq -0x24(%rbp), %rdx
movl %r12d, (%rdx)
leaq 0x69fc3(%rip), %rsi     # 0x109b04
xorl %eax, %eax
callq 0x9360
cmpl $0x4, %eax
jne 0x9fc61
movl -0x24(%rbp), %edi
leal -0x1(%rdi), %eax
cmpl $0x3e6, %eax            # imm = 0x3E6
ja 0x9fc61
cmpl $0x0, -0x28(%rbp)
js 0x9fc61
movl -0x30(%rbp), %eax
movl -0x2c(%rbp), %ecx
movl %eax, %edx
orl %ecx, %edx
js 0x9fb92
cvtsi2ss %eax, %xmm0
cvtsi2ss %ecx, %xmm1
callq 0x5ad98
leaq 0x26d708(%rip), %rax    # 0x30d294
movl $0xa, (%rax)
movl -0x28(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movslq -0x24(%rbp), %rcx
imulq $0x348, %rcx, %rcx      # imm = 0x348
leaq 0x19f402(%rip), %rbx    # 0x23efb0
movss %xmm0, 0x20(%rbx,%rcx)
leaq 0x17b461(%rip), %rcx    # 0x21b01c
cmpl $0x0, (%rcx)
je 0x9fbfe
leaq 0x8736a(%rip), %r14     # 0x126f31
testl %eax, %eax
jle 0x9fc05
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x9160
mulsd 0x6bf59(%rip), %xmm0    # 0x10bb38
addsd 0x7eb09(%rip), %xmm0    # 0x11e6f0
cvtsd2ss %xmm0, %xmm0
movslq -0x24(%rbp), %rax
imulq $0x348, %rax, %rax      # imm = 0x348
movss %xmm0, 0x20(%rbx,%rax)
jmp 0x9fc05
leaq 0x85851(%rip), %r14     # 0x125456
leaq 0x19f2ec(%rip), %rax    # 0x23eef8
movq %r14, (%rax)
movslq -0x24(%rbp), %rdi
imulq $0x348, %rdi, %rax      # imm = 0x348
movl $0xf, 0x1c(%rbx,%rax)
callq 0xdbb74
leaq 0x26d71e(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
incl 0x2d229a(%rip)          # 0x371ed0
leaq 0x178c93(%rip), %rax    # 0x2188d0
cmpq $0x8, (%rax)
jne 0x9fc59
movslq -0x24(%rbp), %rax
imulq $0x348, %rax, %rax      # imm = 0x348
movl $0x1, 0x218(%rbx,%rax)
movl -0x24(%rbp), %edi
callq 0x5ced3
movl $0x0, -0x28(%rbp)
leaq -0x2c(%rbp), %rbx
movl %r12d, (%rbx)
leaq -0x30(%rbp), %r14
movl %r12d, (%r14)
leaq -0x24(%rbp), %r15
movl %r12d, (%r15)
leaq 0x2ccece(%rip), %rdi    # 0x36cb52
leaq 0x69e7c(%rip), %rsi     # 0x109b07
movq %r15, %rdx
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x9360
cmpl $0x3, %eax
sete %cl
movl (%r15), %edi
leal -0x1(%rdi), %eax
cmpl $0x3e7, %eax            # imm = 0x3E7
setb %dl
movl (%r14), %eax
testl %eax, %eax
setns %sil
andb %cl, %sil
andb %dl, %sil
movl (%rbx), %ecx
testl %ecx, %ecx
setns %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x9fd35
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
callq 0x5ad98
leaq 0x26d5ad(%rip), %rax    # 0x30d294
movl $0xb, (%rax)
movslq -0x24(%rbp), %rdi
imulq $0x348, %rdi, %rax      # imm = 0x348
leaq 0x19f2b1(%rip), %rcx    # 0x23efb0
movabsq $0x3a83126f00000010, %rdx # imm = 0x3A83126F00000010
movq %rdx, 0x1c(%rcx,%rax)
movl $0xffffffff, 0x218(%rcx,%rax) # imm = 0xFFFFFFFF
callq 0xdbb74
leaq 0x26d627(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
incl 0x2d21a7(%rip)          # 0x371ed4
movl -0x24(%rbp), %edi
callq 0x5ced3
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26d387(%rip), %rax    # 0x30d0d0
movb $0x63, (%rax)
jmp 0x9fad8