// File: /workspace/github_cpp_makefile_star2_O2/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 0xe5100(%rip), %rax     # 0x15ac70
testl %edi, (%rax)
je 0x75bcd
movl %edi, %ebx
callq 0x75767
testl %eax, %eax
je 0x75bcd
leaq 0x2afeba(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, %r14d
callq 0x75767
testl %eax, %eax
je 0x75bcd
leaq 0x2afea2(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, -0x34(%rbp)
callq 0x75767
testl %eax, %eax
je 0x75bdc
leaq 0x2afe8a(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, -0x30(%rbp)
leaq 0x281753(%rip), %rax    # 0x2f7318
movl $0x1, (%rax)
jmp 0x75bdc
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, 0x2e623a(%rip)    # 0x35be24
jne 0x75bf1
callq 0x56b1c
movl $0x1, 0x2e6229(%rip)    # 0x35be24
pushq $0x4
popq %r13
leaq 0x2afe3a(%rip), %rbx    # 0x325a40
subl $0x1, %r13d
jb 0x75cf9
callq 0x75767
testl %eax, %eax
je 0x75c06
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r15d
callq 0x75767
testl %eax, %eax
je 0x75c06
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r12d
callq 0x75767
testl %eax, %eax
je 0x75c06
movq %rbx, %rdi
callq 0x95e0
movl %eax, -0x3c(%rbp)
callq 0x75767
testl %eax, %eax
je 0x75c62
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r14d
jmp 0x75c65
xorl %r14d, %r14d
leal -0x1(%r15), %eax
cmpl $0x3e6, %eax            # imm = 0x3E6
ja 0x75c06
movl %r15d, %eax
imulq $0x348, %rax, %rbx      # imm = 0x348
cvtsi2ssl -0x3c(%rbp), %xmm0
leaq 0x1b332a(%rip), %rax    # 0x228fb0
movl $0x1, 0x1c(%rax,%rbx)
cvtsi2ss %r12d, %xmm1
movl %r15d, %edi
callq 0x53b74
cvtsi2ss %r14d, %xmm0
leaq 0x1b3309(%rip), %rax    # 0x228fb0
movss %xmm0, 0x20(%rax,%rbx)
movl %r15d, %edi
callq 0xca4da
leaq 0x281690(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
testl %r14d, %r14d
movl %r15d, %eax
pushq $-0x1
popq %rcx
cmovlel %ecx, %eax
leaq 0x1b32df(%rip), %rcx    # 0x228fb0
movl %eax, 0x218(%rcx,%rbx)
leaq 0x2afd61(%rip), %rbx    # 0x325a40
leaq 0x2815ae(%rip), %rax    # 0x2f7294
movl $0x2, (%rax)
movl %r15d, %edi
callq 0x559ba
jmp 0x75c06
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x75d40
leaq 0x9236e(%rip), %rax     # 0x108076
leaq 0x1b31e9(%rip), %rcx    # 0x228ef8
movq %rax, (%rcx)
leaq 0x18cbb7(%rip), %rax    # 0x2028d0
cmpq $0x40000, (%rax)        # imm = 0x40000
leaq 0x18f3bd(%rip), %rbx    # 0x2050e4
jne 0x75d3b
cmpl $0x0, (%rbx)
jne 0x75d3b
pushq $0x7
popq %rdi
movl $0x5e0, %esi            # imm = 0x5E0
callq 0x10a99
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 0x56d93