// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xef6cf(%rip), %rax     # 0x170c70
testl %edi, (%rax)
je 0x815fe
movl %edi, %ebx
callq 0x811da
testl %eax, %eax
je 0x815fe
leaq 0x2ba489(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %r14d
callq 0x811da
testl %eax, %eax
je 0x815fe
leaq 0x2ba471(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, -0x34(%rbp)
callq 0x811da
testl %eax, %eax
je 0x8160d
leaq 0x2ba459(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, -0x30(%rbp)
leaq 0x28bd22(%rip), %rax    # 0x30d318
movl $0x1, (%rax)
jmp 0x8160d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, -0x38(%rbp)
movl %ebx, -0x2c(%rbp)
cmpl $0x0, 0x2f0809(%rip)    # 0x371e24
jne 0x81643
movl $0x218, %eax            # imm = 0x218
leaq 0x1bd987(%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 0x8162b
movl $0x1, 0x2f07d7(%rip)    # 0x371e24
movl $0x4, %r13d
leaq 0x2ba3e6(%rip), %rbx    # 0x33ba40
callq 0x811da
testl %eax, %eax
je 0x81759
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r15d
callq 0x811da
testl %eax, %eax
je 0x81759
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r12d
callq 0x811da
testl %eax, %eax
je 0x81759
movq %rbx, %rdi
callq 0x95e0
movl %eax, -0x3c(%rbp)
callq 0x811da
testl %eax, %eax
je 0x816b8
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r14d
jmp 0x816bb
xorl %r14d, %r14d
leal -0x1(%r15), %eax
cmpl $0x3e6, %eax            # imm = 0x3E6
ja 0x81759
movl %r15d, %eax
imulq $0x348, %rax, %rbx      # imm = 0x348
xorps %xmm0, %xmm0
cvtsi2ssl -0x3c(%rbp), %xmm0
leaq 0x1bd8cd(%rip), %rax    # 0x23efb0
movl $0x1, 0x1c(%rax,%rbx)
xorps %xmm1, %xmm1
cvtsi2ss %r12d, %xmm1
movl %r15d, %edi
callq 0x5ad98
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
leaq 0x1bd8a6(%rip), %rax    # 0x23efb0
movss %xmm0, 0x20(%rax,%rbx)
movl %r15d, %edi
callq 0xdbb74
leaq 0x28bc2d(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
testl %r14d, %r14d
movl %r15d, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovlel %ecx, %eax
leaq 0x1bd87a(%rip), %rcx    # 0x23efb0
movl %eax, 0x218(%rcx,%rbx)
leaq 0x2ba2fc(%rip), %rbx    # 0x33ba40
leaq 0x28bb49(%rip), %rax    # 0x30d294
movl $0x2, (%rax)
movl %r15d, %edi
callq 0x5ced3
decl %r13d
jne 0x8165a
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x817ab
leaq 0x9c7ff(%rip), %rax     # 0x11df70
leaq 0x1bd780(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
leaq 0x19714e(%rip), %rax    # 0x2188d0
cmpq $0x40000, (%rax)        # imm = 0x40000
leaq 0x199954(%rip), %rbx    # 0x21b0e4
jne 0x817a6
cmpl $0x0, (%rbx)
jne 0x817a6
movl $0x7, %edi
movl $0x5e0, %esi            # imm = 0x5E0
callq 0x1120f
movl -0x2c(%rbp), %eax
movl %eax, (%rbx)
movl -0x30(%rbp), %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e411