// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_ubx_gnss()
void parse_ubx_gnss()
{
int hw_chans;
int use_chans;
int blocks;
int id;
int min_chans;
int max_chans;
u32 flags;

   log_packet_id("UBX_GNSS");

   tsip_byte();  // msg version
   hw_chans = tsip_byte();
   use_chans = tsip_byte();
   blocks = tsip_byte();
//sprintf(debug_text2, "GNSS info hw_chans:%d  use:%d  blocks:%d", hw_chans,use_chans,blocks);

   if(blocks == 0) return;

   gnss_mask = 0x0000;
   have_gnss_mask = 1;
   while(blocks--) {
      id = tsip_byte();
      min_chans = tsip_byte();
      max_chans = tsip_byte();
      tsip_byte();  // reserved
      flags = tsip_dword();

      if(id == 0) {       // GPS
         if(flags & 0x0001) gnss_mask |= GPS;
      }
      else if(id == 1) {  // SBAS
         if(flags & 0x0001) gnss_mask |= SBAS;
      }
      else if(id == 2) {  // GALILEO
         if(flags & 0x0001) gnss_mask |= GALILEO;
      }
      else if(id == 3) {  // Beidou
         if(flags & 0x0001) gnss_mask |= BEIDOU;
      }
      else if(id == 4) {  // IMES
         if(flags & 0x0001) gnss_mask |= IMES;
      }
      else if(id == 5) {  // QZSS
         if(flags & 0x0001) gnss_mask |= QZSS;
      }
      else if(id == 6) {  // GLONASS
         if(flags & 0x0001) gnss_mask |= GLONASS;
      }

if(0 && debug_file) {
   fprintf(debug_file, "gnss blk:%d  hw:%d use:%d  id:%d min:%d max:%d flags:%08X  mask:%04X\n", 
   blocks, hw_chans, use_chans, id,min_chans,max_chans,flags, gnss_mask);
}
   }
// sprintf(debug_text2, "GNSS got mask:%04X", gnss_mask);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x8f254(%rip), %rdi     # 0x1247fa
callq 0x58dc2
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x955c1
leaq 0x1a99b2(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x955d7
leaq 0x1a999c(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x955ed
leaq 0x1a9986(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x95605
leaq 0x1a996e(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
andl $0xff, %ebx
je 0x956d7
leaq 0xdb65c(%rip), %r15     # 0x170c74
movl $0x0, (%r15)
leaq 0xdb652(%rip), %rax     # 0x170c78
movl $0x1, (%rax)
leaq 0x8a11d(%rip), %r12     # 0x11f750
leaq 0x1a9936(%rip), %r13    # 0x23ef70
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x9564e
orb $0x8, (%r13)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x9565f
orb $0x8, (%r13)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x95670
orb $0x8, (%r13)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x95681
orb $0x8, (%r13)
callq 0x58964
cmpb $0x6, %r14b
ja 0x956cf
movzbl %r14b, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl $0x1, %ecx
jmp 0x956c8
movl $0x2000, %ecx           # imm = 0x2000
jmp 0x956c8
movl $0x4, %ecx
jmp 0x956c8
movl $0x8, %ecx
jmp 0x956c8
movl $0x8000, %ecx           # imm = 0x8000
jmp 0x956c8
movl $0x4000, %ecx           # imm = 0x4000
jmp 0x956c8
movl $0x2, %ecx
testb $0x1, %al
je 0x956cf
orl %ecx, (%r15)
decl %ebx
jne 0x9563a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq