// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_ubx_svn()
void parse_ubx_svn()
{
int chans;
int prn;
int flag;
int qual;
int sig;
int az;
int el;

   // get satellite position and signal info
   log_packet_id("UBX_SVIN");

   tsip_dword();  // tow
   chans = tsip_byte();
if(debug_file) fprintf(debug_file, "UBX_SVN chans:%d\n", chans);
   have_count = 50;
   tsip_byte();
   tsip_word();

   reset_sat_tracking();

   sat_count = 0;
   while(chans--) {
      tsip_byte();       // channel number
      prn = tsip_byte();
      flag = tsip_byte();
      qual = tsip_byte();
      sig = tsip_byte();
//sig += (sig/2);   // Ublox reports dBc levels that are around 50% less than most receivers
      el = tsip_byte();
      az = tsip_word();
      tsip_dword();      // pseudo range
if(0 && debug_file) fprintf(debug_file, "UBX_SVN %3d:: az:%-3d  el:%-3d  sig:%-3d  flag:%02X\n", prn, az,el, sig, flag);

//    if((az == 0) || (el == 0)) continue;

      if((prn >= 1) && (prn <= MAX_PRN)) {  
         set_sat_azel(prn, (float) az, (float) el);
         sat[prn].sig_level = (float) sig;
         sat[prn].level_msg = 3;
         sat[prn].sv_accuracy = 0.0F;
         sat[prn].state = qual;
         if(flag & 0x10) sat[prn].health_flag = 1;
         else            sat[prn].health_flag = 0;
         if(have_state == 0) need_redraw = 2033;
         have_state = UBX_STATE;
         have_snr |= rinex_gnss(prn);
         have_sat_azel = 3;

if(debug_file) fprintf(debug_file, "UBX_SVN %3d:  az:%-3d  el:%-2d  sig:%-2d  flag:%02X\n", prn, az,el, sig, flag);
         if(flag & 0x01) sat[prn].tracking = 1;
         else            sat[prn].tracking = (-1);

         record_sig_levels(prn);
         ++sat_count;
         have_count = 20;
      }
   }

   level_type = "dBc";
   config_sat_count(sat_count); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x909d5(%rip), %rdi     # 0x1245d3
callq 0x58e77
callq 0x589b0
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93c1e
leaq 0x1ab355(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %ebx
leaq 0x1aa768(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x93c40
leaq 0x909a5(%rip), %rsi     # 0x1245dc
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
leaq 0x2796d1(%rip), %rax    # 0x30d318
movl $0x32, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93c63
leaq 0x1ab310(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588f0
movl $0x218, %eax            # imm = 0x218
leaq 0x1ab33c(%rip), %rdx    # 0x23efb0
xorl %ecx, %ecx
movl %ecx, (%rdx,%rax)
movl %ecx, -0x1fc(%rdx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd358, %rax          # imm = 0xCD358
jne 0x93c76
leaq 0x1ab277(%rip), %rax    # 0x23ef0c
movl $0x0, (%rax)
testl %ebx, %ebx
je 0x93e65
leaq 0x1ab2c6(%rip), %r14    # 0x23ef70
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x93cba
orb $0x8, (%r14)
callq 0x587d1
movl %eax, %r12d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ccd
orb $0x8, (%r14)
movl %ebx, -0x3c(%rbp)
callq 0x587d1
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ce3
orb $0x8, (%r14)
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x93cf5
orb $0x8, (%r14)
callq 0x587d1
movl %eax, %r13d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d08
orb $0x8, (%r14)
callq 0x587d1
movl %eax, -0x30(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d1b
orb $0x8, (%r14)
callq 0x588f0
movl %eax, %r14d
callq 0x589b0
testb %r12b, %r12b
je 0x93e53
movzbl %r12b, %edi
movzbl %r13b, %r13d
movzwl %r14w, %eax
movl $0xff, %r14d
andl %r14d, %ebx
movl %eax, -0x34(%rbp)
cvtsi2ss %eax, %xmm0
movl -0x30(%rbp), %eax
andl %r14d, %eax
cvtsi2ss %eax, %xmm1
movl %edi, -0x2c(%rbp)
callq 0x5ad98
movl %r13d, -0x38(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
andl %r14d, %r12d
imulq $0x348, %r12, %r14      # imm = 0x348
leaq 0x1ab234(%rip), %r12    # 0x23efb0
movss %xmm0, 0x20(%r12,%r14)
movl $0x3, 0x1c(%r12,%r14)
movl $0x0, 0x1fc(%r12,%r14)
movl %ebx, 0x18(%r12,%r14)
movl %r15d, %eax
shrb $0x4, %al
andb $0x1, %al
movb %al, (%r12,%r14)
leaq 0x27958c(%rip), %rax    # 0x30d33c
cmpl $0x0, (%rax)
jne 0x93dc2
leaq 0x184a88(%rip), %rcx    # 0x218844
movl $0x7f1, (%rcx)          # imm = 0x7F1
movl $0x5, (%rax)
movl -0x2c(%rbp), %edi
callq 0xdbb74
leaq 0x279575(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
leaq 0x2794b4(%rip), %rax    # 0x30d294
movl $0x3, (%rax)
leaq 0x1aa5a3(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x93e19
movzbl %r15b, %eax
movzbl -0x30(%rbp), %r8d
movl %eax, (%rsp)
leaq 0x907e6(%rip), %rsi     # 0x1245ee
movl -0x2c(%rbp), %edx
movl -0x34(%rbp), %ecx
movl -0x38(%rbp), %r9d
xorl %eax, %eax
callq 0x9560
addq %r12, %r14
andl $0x1, %r15d
cmpl $0x1, %r15d
movl $0x0, %eax
sbbl %eax, %eax
orl $0x1, %eax
movl %eax, 0x218(%r14)
movl -0x2c(%rbp), %edi
callq 0x5ced3
leaq 0x1ab0c8(%rip), %rax    # 0x23ef0c
incl (%rax)
leaq 0x2794cb(%rip), %rax    # 0x30d318
movl $0x14, (%rax)
movl -0x3c(%rbp), %ebx
decl %ebx
leaq 0x1ab111(%rip), %r14    # 0x23ef70
jne 0x93caa
leaq 0x8dd8e(%rip), %rax     # 0x121bfa
leaq 0x1ab085(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
leaq 0x1ab08f(%rip), %rax    # 0x23ef0c
movl (%rax), %edi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e411