// File: 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
subq $0x30, %rsp
leaq 0xbda90(%rip), %rdi     # 0x18799f
callq 0x7add0
callq 0x7a680
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x4(%rbp)
leaq 0x1d3645(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xc9f4c
leaq 0x1d3638(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x4(%rbp), %edx
leaq 0xbda63(%rip), %rsi     # 0x1879a8
movb $0x0, %al
callq 0x9550
leaq 0x2a25a5(%rip), %rax    # 0x36c4f8
movl $0x32, (%rax)
callq 0x7a510
callq 0x7a560
callq 0x81c10
leaq 0x1d417d(%rip), %rax    # 0x29e0ec
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x4(%rbp)
cmpl $0x0, %eax
je 0xca1b3
callq 0x7a510
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x8(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0xc(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x14(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
callq 0x7a560
movzwl %ax, %eax
movl %eax, -0x18(%rbp)
callq 0x7a680
cmpl $0x1, -0x8(%rbp)
jl 0xca1ae
cmpl $0x3e7, -0x8(%rbp)      # imm = 0x3E7
jg 0xca1ae
movl -0x8(%rbp), %edi
cvtsi2ssl -0x18(%rbp), %xmm0
cvtsi2ssl -0x1c(%rbp), %xmm1
callq 0x7d450
cvtsi2ssl -0x14(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1d4182(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1d4168(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x3, 0x1c(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1d414c(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1fc(%rax)
movl -0x10(%rbp), %ecx
movslq -0x8(%rbp), %rdx
leaq 0x1d4129(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movl -0xc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xca099
movslq -0x8(%rbp), %rcx
leaq 0x1d4106(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movb $0x1, (%rax)
jmp 0xca0b1
movslq -0x8(%rbp), %rcx
leaq 0x1d40ec(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movb $0x0, (%rax)
leaq 0x2a2464(%rip), %rax    # 0x36c51c
cmpl $0x0, (%rax)
jne 0xca0ca
leaq 0x1ad960(%rip), %rax    # 0x277a24
movl $0x7f1, (%rax)          # imm = 0x7F1
leaq 0x2a244b(%rip), %rax    # 0x36c51c
movl $0x5, (%rax)
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2a2444(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x2a243b(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
leaq 0x2a237a(%rip), %rax    # 0x36c474
movl $0x3, (%rax)
leaq 0x1d3469(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xca139
leaq 0x1d345c(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x8(%rbp), %edx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movl -0x14(%rbp), %r9d
movl -0xc(%rbp), %eax
leaq 0xbd88b(%rip), %rsi     # 0x1879ba
movl %eax, (%rsp)
movb $0x0, %al
callq 0x9550
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xca165
movslq -0x8(%rbp), %rcx
leaq 0x1d4041(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x218(%rax)
jmp 0xca184
movslq -0x8(%rbp), %rcx
leaq 0x1d4020(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
movl -0x8(%rbp), %edi
callq 0x80340
leaq 0x1d3f59(%rip), %rax    # 0x29e0ec
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1d3f4d(%rip), %rax    # 0x29e0ec
movl %ecx, (%rax)
leaq 0x2a2350(%rip), %rax    # 0x36c4f8
movl $0x14, (%rax)
jmp 0xc9f75
leaq 0x1d3f1e(%rip), %rax    # 0x29e0d8
leaq 0xbada9(%rip), %rcx     # 0x184f6a
movq %rcx, (%rax)
leaq 0x1d3f21(%rip), %rax    # 0x29e0ec
movl (%rax), %edi
callq 0x82080
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)