// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpgsv(int)
void parse_gpgsv(int system)
{
int num_sents;
int sent_num;
int sat_count;
int prn;
int az, el;
int snr;
int i;

   if((system & system_mask) == 0) return;

   if(get_msg_field()) {
      num_sents = atoi(msg_field);
   }
   else return;

   if(get_msg_field()) {
      sent_num = atoi(msg_field);
   }
   else return;

   if(get_msg_field()) {
      sat_count = atoi(msg_field);
      have_count = 1;
   }

//   if(sent_num == 1) {  // reset sat tracking info 
   if(last_was_gsv == 0) {  // reset sat tracking info 
      reset_sat_tracking();
   }

   last_was_gsv = 1;

   for(i=0; i<4; i++) {
      if(get_msg_field()) prn = atoi(msg_field);
      else continue;

      if(get_msg_field()) el = atoi(msg_field);
      else continue;

      if(get_msg_field()) az = atoi(msg_field);
      else continue;

      if(get_msg_field()) snr = atoi(msg_field);
      else {
         snr = (0);
//       continue;
      }

      if((prn >= 1) && (prn <= MAX_PRN)) { 
         sat[prn].level_msg = 1;
         set_sat_azel(prn, (float) az, (float) el);
         sat[prn].sig_level = (float) snr;
         have_snr |= rinex_gnss(prn);
         if(snr > 0) sat[prn].tracking = prn;
         else        sat[prn].tracking = (-1);
         have_sat_azel = 2;

         record_sig_levels(prn);
      }
   }

   if(sent_num == num_sents) {
      level_type = "SNR";
      if((rcvr_type == BRANDY_RCVR) && (have_gpgsv == 0)) {
         new_queue(RESET_ALL_QUEUES, 1504);
      }
      have_gpgsv = system;
   }

   config_sat_count(sat_count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
leaq 0x11ec1b(%rip), %rcx    # 0x1cfe50
andl (%rcx), %eax
cmpl $0x0, %eax
jne 0xb1241
jmp 0xb1494
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb125c
leaq 0x2e99ce(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x8(%rbp)
jmp 0xb1261
jmp 0xb1494
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb127c
leaq 0x2e99ae(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0xc(%rbp)
jmp 0xb1281
jmp 0xb1494
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb12a7
leaq 0x2e998e(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x10(%rbp)
leaq 0x2bb257(%rip), %rax    # 0x36c4f8
movl $0x1, (%rax)
cmpl $0x0, 0x31fd46(%rip)    # 0x3d0ff4
jne 0xb12b5
callq 0x81c10
movl $0x1, 0x31fd35(%rip)    # 0x3d0ff4
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0xb143c
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb12eb
leaq 0x2e993f(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x14(%rbp)
jmp 0xb12f0
jmp 0xb142e
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb130b
leaq 0x2e991f(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x1c(%rbp)
jmp 0xb1310
jmp 0xb142e
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb132b
leaq 0x2e98ff(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x18(%rbp)
jmp 0xb1330
jmp 0xb142e
callq 0xb0bd0
cmpl $0x0, %eax
je 0xb134b
leaq 0x2e98df(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x20(%rbp)
jmp 0xb1352
movl $0x0, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0xb142c
cmpl $0x3e7, -0x14(%rbp)     # imm = 0x3E7
jg 0xb142c
movslq -0x14(%rbp), %rcx
leaq 0x1ece1c(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x1c(%rax)
movl -0x14(%rbp), %edi
cvtsi2ssl -0x18(%rbp), %xmm0
cvtsi2ssl -0x1c(%rbp), %xmm1
callq 0x7d450
cvtsi2ssl -0x20(%rbp), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x1ecde9(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movl -0x14(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2bb165(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x2bb15c(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
cmpl $0x0, -0x20(%rbp)
jle 0xb13f8
movl -0x14(%rbp), %ecx
movslq -0x14(%rbp), %rdx
leaq 0x1ecdaa(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x218(%rax)
jmp 0xb1417
movslq -0x14(%rbp), %rcx
leaq 0x1ecd8d(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
leaq 0x2bb056(%rip), %rax    # 0x36c474
movl $0x2, (%rax)
movl -0x14(%rbp), %edi
callq 0x80340
jmp 0xb142e
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb12c6
movl -0xc(%rbp), %eax
cmpl -0x8(%rbp), %eax
jne 0xb148c
leaq 0x1ecc8d(%rip), %rax    # 0x29e0d8
leaq 0xd15c4(%rip), %rcx     # 0x182a16
movq %rcx, (%rax)
leaq 0x1c6654(%rip), %rax    # 0x277ab0
cmpq $0x40000, (%rax)        # imm = 0x40000
jne 0xb1480
leaq 0x1c8e58(%rip), %rax    # 0x27a2c4
cmpl $0x0, (%rax)
jne 0xb1480
movl $0x7, %edi
movl $0x5e0, %esi            # imm = 0x5E0
callq 0x14df0
movl -0x4(%rbp), %ecx
leaq 0x1c8e3a(%rip), %rax    # 0x27a2c4
movl %ecx, (%rax)
movl -0x10(%rbp), %edi
callq 0x82080
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)