// File: /workspace/github_cpp_makefile_star2_O3/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 $0x18, %rsp
leaq 0x90a31(%rip), %rdi     # 0x1246b3
callq 0x58dc2
callq 0x58964
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ca2
leaq 0x1ab2d1(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %ebx
leaq 0x1aa6e4(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x93cc4
leaq 0x90a01(%rip), %rsi     # 0x1246bc
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
leaq 0x27964d(%rip), %rax    # 0x30d318
movl $0x32, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x93ce7
leaq 0x1ab28c(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588d2
movl $0x218, %eax            # imm = 0x218
leaq 0x1ab2b8(%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 0x93cfa
leaq 0x1ab1f3(%rip), %rax    # 0x23ef0c
movl $0x0, (%rax)
testl %ebx, %ebx
je 0x93ef7
leaq 0x1ab242(%rip), %r13    # 0x23ef70
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d3f
orb $0x8, (%r13)
callq 0x587be
movl %eax, %r12d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d53
orb $0x8, (%r13)
callq 0x587be
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d67
orb $0x8, (%r13)
movl %ebx, -0x38(%rbp)
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d7e
orb $0x8, (%r13)
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x93d91
orb $0x8, (%r13)
callq 0x587be
movl %eax, -0x34(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x93da5
orb $0x8, (%r13)
movzbl %r12b, %r12d
callq 0x588d2
movl %eax, %r13d
callq 0x58964
testl %r12d, %r12d
je 0x93eda
movzbl %bl, %ebx
movzwl %r13w, %eax
movl $0xff, %ecx
andl %ecx, %r14d
movl %eax, -0x2c(%rbp)
cvtsi2ss %eax, %xmm0
movl -0x34(%rbp), %r13d
movl %r13d, %eax
andl %ecx, %eax
cvtsi2ss %eax, %xmm1
movl %r12d, %edi
callq 0x5ace1
movl %ebx, -0x30(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
movl %r12d, %eax
imulq $0x348, %rax, %rbx      # imm = 0x348
leaq 0x1ab1ab(%rip), %rcx    # 0x23efb0
movss %xmm0, 0x20(%rcx,%rbx)
movl $0x3, 0x1c(%rcx,%rbx)
movl $0x0, 0x1fc(%rcx,%rbx)
movl %r14d, 0x18(%rcx,%rbx)
movl %r15d, %eax
shrb $0x4, %al
andb $0x1, %al
movb %al, (%rcx,%rbx)
leaq 0x279507(%rip), %rax    # 0x30d33c
cmpl $0x0, (%rax)
jne 0x93e47
leaq 0x184a03(%rip), %rcx    # 0x218844
movl $0x7f1, (%rcx)          # imm = 0x7F1
movl $0x5, (%rax)
movl %r12d, %edi
callq 0xdc1dd
leaq 0x2794f0(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
leaq 0x27942f(%rip), %rax    # 0x30d294
movl $0x3, (%rax)
leaq 0x1aa51e(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x93e9d
movzbl %r15b, %eax
movzbl %r13b, %r8d
movl %eax, (%rsp)
leaq 0x90842(%rip), %rsi     # 0x1246ce
movl %r12d, %edx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r9d
xorl %eax, %eax
callq 0x9560
addq 0xbc09c(%rip), %rbx     # 0x14ff40
andl $0x1, %r15d
cmpl $0x1, %r15d
movl $0x0, %eax
sbbl %eax, %eax
orl $0x1, %eax
movl %eax, 0x218(%rbx)
movl %r12d, %edi
callq 0x5cdab
leaq 0x1ab041(%rip), %rax    # 0x23ef0c
incl (%rax)
leaq 0x279444(%rip), %rax    # 0x30d318
movl $0x14, (%rax)
movl -0x38(%rbp), %ebx
decl %ebx
leaq 0x1ab08a(%rip), %r13    # 0x23ef70
jne 0x93d2e
leaq 0x1ab019(%rip), %rax    # 0x23ef0c
movl (%rax), %edi
jmp 0x93ef9
xorl %edi, %edi
leaq 0x8ddda(%rip), %rax     # 0x121cda
leaq 0x1aaff1(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e390