// File: 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
subq $0x20, %rsp
leaq 0xaf7f4(%rip), %rdi     # 0x188813
callq 0x7add0
cmpl $0x0, 0x2f618d(%rip)    # 0x3cf1b8
je 0xd906e
leaq 0x293648(%rip), %rax    # 0x36c67c
movl $0x8, (%rax)
leaq 0x29344f(%rip), %rax    # 0x36c490
movl $0x1, (%rax)
leaq 0x29336a(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x29335e(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x29340d(%rip), %rax    # 0x36c470
movl $0x1, (%rax)
jmp 0xd91ed
leaq 0x19ea3b(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0xd91eb
leaq 0x29340a(%rip), %rax    # 0x36c490
movl $0x0, (%rax)
leaq 0x293325(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x293319(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2933c8(%rip), %rax    # 0x36c470
movl $0x1, (%rax)
leaq 0x2f2c5b(%rip), %rdi    # 0x3cbd10
leaq 0xb20df(%rip), %rsi     # 0x18b19b
callq 0x9090
cmpq $0x0, %rax
je 0xd91e9
leaq 0x2f2c3e(%rip), %rdi    # 0x3cbd10
leaq 0xaf744(%rip), %rsi     # 0x18881d
callq 0x9090
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xd9165
leaq 0x2931c0(%rip), %rax    # 0x36c2b0
movb $0xb, (%rax)
leaq 0x2932be(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
orl $0x20, %ecx
leaq 0x2932b2(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x1a10b1(%rip), %rax    # 0x27a1c0
cmpl $0x53, (%rax)
jne 0xd913b
movq -0x20(%rbp), %rdi
addq $0x7, %rdi
callq 0x95c0
movl %eax, %ecx
leaq 0x293f42(%rip), %rax    # 0x36d06c
movl %ecx, (%rax)
leaq 0x293f3d(%rip), %rax    # 0x36d070
movl $0x6, (%rax)
jmp 0xd9160
movq -0x20(%rbp), %rdi
addq $0x9, %rdi
callq 0x95c0
movl %eax, %ecx
leaq 0x293f1b(%rip), %rax    # 0x36d06c
movl %ecx, (%rax)
leaq 0x293f16(%rip), %rax    # 0x36d070
movl $0x7, (%rax)
jmp 0xd91e7
leaq 0x2f2ba4(%rip), %rdi    # 0x3cbd10
leaq 0xbf9f9(%rip), %rsi     # 0x198b6c
callq 0x9090
cmpq $0x0, %rax
je 0xd919f
leaq 0x29312b(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
leaq 0x293229(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x21, %ecx
leaq 0x29321d(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd91e5
leaq 0x2f2b6a(%rip), %rdi    # 0x3cbd10
leaq 0xaf677(%rip), %rsi     # 0x188824
callq 0x9090
cmpq $0x0, %rax
je 0xd91d9
leaq 0x2930f1(%rip), %rax    # 0x36c2b0
movb $0x7, (%rax)
leaq 0x2931ef(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x21, %ecx
leaq 0x2931e3(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
jmp 0xd91e3
leaq 0x2930d0(%rip), %rax    # 0x36c2b0
movb $0x63, (%rax)
jmp 0xd91e5
jmp 0xd91e7
jmp 0xd91e9
jmp 0xd91eb
jmp 0xd91ed
jmp 0xd91ef
leaq 0x2f2b1a(%rip), %rdi    # 0x3cbd10
movl $0x2a, %esi
callq 0x9100
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xd920d
jmp 0xd9216
movq -0x20(%rbp), %rax
movb $0x20, (%rax)
jmp 0xd91ef
movb $0x0, 0x2f2b04(%rip)    # 0x3cbd21
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x8(%rbp) # imm = 0xFFFFFFFF
leaq 0x2f2ad0(%rip), %rdi    # 0x3cbd10
leaq 0x9673e(%rip), %rsi     # 0x16f985
leaq -0x8(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0xc(%rbp), %r8
leaq -0x14(%rbp), %r9
movb $0x0, %al
callq 0x9370
movl %eax, -0x4(%rbp)
cmpl $0x4, -0x4(%rbp)
jne 0xd93c7
cmpl $0x1, -0x8(%rbp)
jl 0xd93c7
cmpl $0x3e7, -0x8(%rbp)      # imm = 0x3E7
jg 0xd93c7
cmpl $0x0, -0x14(%rbp)
jl 0xd93c7
cmpl $0x0, -0xc(%rbp)
jl 0xd92b7
cmpl $0x0, -0x10(%rbp)
jl 0xd92b7
movl -0x8(%rbp), %edi
cvtsi2ssl -0xc(%rbp), %xmm0
cvtsi2ssl -0x10(%rbp), %xmm1
callq 0x7d450
leaq 0x2931c3(%rip), %rax    # 0x36c474
movl $0xa, (%rax)
cvtsi2ssl -0x14(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1c4ec9(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
leaq 0x1a0f1f(%rip), %rax    # 0x27a1fc
cmpl $0x0, (%rax)
je 0xd933b
cmpl $0x0, -0x14(%rbp)
jle 0xd9328
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x9160
movsd 0x95dce(%rip), %xmm1    # 0x16f0c8
mulsd %xmm1, %xmm0
movsd 0xa9d6a(%rip), %xmm1    # 0x183070
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1c4e77(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
leaq 0x1c4da9(%rip), %rax    # 0x29e0d8
leaq 0xb1080(%rip), %rcx     # 0x18a3b6
movq %rcx, (%rax)
jmp 0xd934c
leaq 0x1c4d96(%rip), %rax    # 0x29e0d8
leaq 0xaf4e1(%rip), %rcx     # 0x18882a
movq %rcx, (%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1c4e39(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xf, 0x1c(%rax)
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2931b3(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x2931aa(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
movl 0x2f7d3a(%rip), %eax    # 0x3d10c4
addl $0x1, %eax
movl %eax, 0x2f7d31(%rip)    # 0x3d10c4
leaq 0x19e716(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0xd93bf
movslq -0x8(%rbp), %rcx
leaq 0x1c4de5(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x218(%rax)
movl -0x8(%rbp), %edi
callq 0x80340
movl $0x0, -0x14(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x8(%rbp) # imm = 0xFFFFFFFF
leaq 0x2f2926(%rip), %rdi    # 0x3cbd10
addq $0x12, %rdi
leaq 0x96593(%rip), %rsi     # 0x16f988
leaq -0x8(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0xc(%rbp), %r8
movb $0x0, %al
callq 0x9370
movl %eax, -0x4(%rbp)
cmpl $0x3, -0x4(%rbp)
jne 0xd94ef
cmpl $0x1, -0x8(%rbp)
jl 0xd94ef
cmpl $0x3e7, -0x8(%rbp)      # imm = 0x3E7
jg 0xd94ef
cmpl $0x0, -0xc(%rbp)
jl 0xd94ef
cmpl $0x0, -0x10(%rbp)
jl 0xd94ef
movl -0x8(%rbp), %edi
cvtsi2ssl -0xc(%rbp), %xmm0
cvtsi2ssl -0x10(%rbp), %xmm1
callq 0x7d450
leaq 0x29301b(%rip), %rax    # 0x36c474
movl $0xb, (%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1c4d26(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0xa9f34(%rip), %xmm0    # 0x1833b0
movss %xmm0, 0x20(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1c4d04(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x10, 0x1c(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1c4ce8(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x29305f(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x293056(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
movl 0x2f7bea(%rip), %eax    # 0x3d10c8
addl $0x1, %eax
movl %eax, 0x2f7be1(%rip)    # 0x3d10c8
movl -0x8(%rbp), %edi
callq 0x80340
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)