// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sat_list(int)
void get_sat_list(int flag)
{
u08 dimension;
u08 count;
int i;
int prn;

   if(flag) log_packet_id("Packet 0x6C (GNSS satellite list)");  // also 6C
   else     log_packet_id("Packet 0x6D (Satellite list)");  // also 6C

   dimension = count = tsip_byte();
   dimension &= 0x0F;
   count >>= 4;

   if(ACU_GG || ACU_360 || ACUTIME) {
      if(0) {  // we get this from the 0x8F-AC secondary timeing message
         if     (dimension == 0x0B) rcvr_mode = RCVR_MODE_2D;      // manual 2D
         else if(dimension == 0x0C) rcvr_mode = RCVR_MODE_3D;      // manual 3D
         else if(dimension == 0)    rcvr_mode = RCVR_MODE_2D_3D;
         else if(dimension == 1)    rcvr_mode = RCVR_MODE_SINGLE;
         else if(dimension == 2)    rcvr_mode = RCVR_MODE_NO_SATS; // 2D clock hold
         else if(dimension == 3)    rcvr_mode = RCVR_MODE_2D;
         else if(dimension == 4)    rcvr_mode = RCVR_MODE_3D;
         else if(dimension == 5)    rcvr_mode = RCVR_MODE_HOLD;
         else if(dimension == 6)    rcvr_mode = RCVR_MODE_DGPS;
         else                       rcvr_mode = RCVR_MODE_2D_3D;
      }
   }
   else if(SV6_FAMILY) {
      if     (dimension == 0x0B) rcvr_mode = RCVR_MODE_2D;   // manual 2D
      else if(dimension == 0x0C) rcvr_mode = RCVR_MODE_3D;   // manual 3D
      else if(dimension == 0x03) rcvr_mode = RCVR_MODE_HOLD; // auto 2d
      else if(dimension == 0x04) rcvr_mode = RCVR_MODE_HOLD; // auto 2d/3d
      else rcvr_mode = RCVR_MODE_UNKNOWN;
//sprintf(debug_text3, "dim:%02X  rmode:%d", dimension, rcvr_mode);
   }

   have_dops = 0;
   pdop = tsip_single();
   hdop = tsip_single();
   vdop = tsip_single();
   tdop = tsip_single();

   if(pdop > 20.0) pdop = 20.0;
   if(hdop > 20.0) hdop = 20.0;
   if(vdop > 20.0) vdop = 20.0;
   if(tdop > 20.0) tdop = 20.0;

   have_dops |= (PDOP | HDOP | VDOP | TDOP);

   for(i=1; i<=MAX_PRN; i++) {  // reset current tracking flags
      if(ACU_360 || ACU_GG) ;     //rnx
      else sat[i].tracking = 0;
   }

   if(flag) {
      count = tsip_byte();
   }

   for(i=0; i<count; i++) {
      prn = tsip_byte();
      if(ACU_360) ;
      else if(prn & 0x80) {  // prn tracked,  but not used
         prn |= (~0xFF);
      }

      if(prn > MAX_PRN) prn = 0;  // put any bogus data in unused entry in array
      else if(prn < (-MAX_PRN)) prn = 0;

      if(prn < 0) {
         sat[0-prn].tracking = (-1); // prn;
      }
      else {  // prn is used in solution
         sat[prn].tracking = (1); // prn;
      }
if(0 && log_file) fprintf(log_file, "track prn %d:%d\n", prn,sat[prn].tracking);
   }
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, -0x30(%rbp)
testl %edi, %edi
leaq 0xa1517(%rip), %rax     # 0x10bd63
leaq 0xa14ee(%rip), %rdi     # 0x10bd41
cmoveq %rax, %rdi
callq 0x520bf
callq 0x51c47
leaq 0x198068(%rip), %r15    # 0x2028d0
movq (%r15), %rcx
cmpq $0x1, %rcx
sete %sil
leaq 0x19a75a(%rip), %r12    # 0x204fd4
movl (%r12), %r8d
cmpl $0x41, %r8d
sete %dl
andb %sil, %dl
leaq 0x198069(%rip), %rsi    # 0x2028f8
movl (%rsi), %esi
cmpl $0x47, %esi
sete %dil
testb %dil, %dl
jne 0x6a8f0
testb %dl, %dl
je 0x6a8ab
cmpl $0x33, %esi
je 0x6a8f0
cmpl $0x47, %esi
je 0x6a8f0
cmpq $0x1, %rcx
sete %cl
cmpb %dl, %cl
je 0x6a8f0
addl $-0x33, %r8d
cmpl $0x1d, %r8d
ja 0x6a8f0
movl $0x20004009, %ecx       # imm = 0x20004009
btl %r8d, %ecx
jae 0x6a8f0
movl %eax, %edx
andb $0xf, %dl
addb $-0x3, %dl
movb $0x63, %cl
cmpb $0x9, %dl
ja 0x6a8e7
movzbl %dl, %edx
leaq 0x9f67c(%rip), %rcx     # 0x109f60
movb (%rdx,%rcx), %cl
leaq 0x28c7e2(%rip), %rdx    # 0x2f70d0
movb %cl, (%rdx)
movb %al, -0x29(%rbp)
leaq 0x1a2bea(%rip), %rax    # 0x20d4e4
andl $0x0, (%rax)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a2bdb(%rip), %r13    # 0x20d4e8
movsd %xmm0, (%r13)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a2bcd(%rip), %rbx    # 0x20d4f0
movsd %xmm0, (%rbx)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a2bc1(%rip), %r14    # 0x20d4f8
movsd %xmm0, (%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm1
leaq 0x1a2bbc(%rip), %rdx    # 0x20d508
movsd %xmm1, (%rdx)
movsd (%r13), %xmm1
ucomisd 0x8b25a(%rip), %xmm1    # 0xf5bb8
movabsq $0x4034000000000000, %rcx # imm = 0x4034000000000000
jbe 0x6a96e
movq %rcx, (%r13)
movsd (%rbx), %xmm1
ucomisd 0x8b23e(%rip), %xmm1    # 0xf5bb8
jbe 0x6a97f
movq %rcx, (%rbx)
movsd (%r14), %xmm1
ucomisd 0x8b22c(%rip), %xmm1    # 0xf5bb8
movb -0x29(%rbp), %al
jbe 0x6a994
movq %rcx, (%r14)
ucomiss 0x9e02d(%rip), %xmm0    # 0x1089c8
jbe 0x6a9a0
movq %rcx, (%rdx)
leaq 0x1a2b3d(%rip), %rcx    # 0x20d4e4
orb $0x17, (%rcx)
shrb $0x4, %al
cmpq $0x1, (%r15)
sete %cl
cmpl $0x41, (%r12)
sete %sil
andb %cl, %sil
leaq 0x197f31(%rip), %rcx    # 0x2028f8
movl (%rcx), %ecx
movl $0x560, %edx            # imm = 0x560
leaq 0x1be5db(%rip), %rbx    # 0x228fb0
cmpq $0xcd358, %rdx          # imm = 0xCD358
je 0x6a9fa
testb %sil, %sil
je 0x6a9ed
cmpl $0x33, %ecx
je 0x6a9f1
cmpl $0x47, %ecx
je 0x6a9f1
andl $0x0, (%rbx,%rdx)
addq $0x348, %rdx            # imm = 0x348
jmp 0x6a9d5
cmpl $0x0, -0x30(%rbp)
je 0x6aa05
callq 0x51c47
movzbl %al, %r14d
pushq $0x1
popq %r13
subl $0x1, %r14d
jb 0x6aa6a
callq 0x51c47
movzbl %al, %eax
cmpq $0x1, (%r15)
jne 0x6aa40
cmpl $0x41, (%r12)
jne 0x6aa40
leaq 0x197ec9(%rip), %rcx    # 0x2028f8
movl (%rcx), %ecx
cmpl $0x33, %ecx
je 0x6aa3b
cmpl $0x47, %ecx
jne 0x6aa40
movl %r13d, %ecx
jmp 0x6aa5a
movl $0x100, %ecx            # imm = 0x100
subq %rax, %rcx
xorl %edx, %edx
testb %al, %al
setns %dl
cmovsq %rcx, %rax
leal -0x1(,%rdx,2), %ecx
imulq $0x348, %rax, %rax      # imm = 0x348
movl %ecx, 0x218(%rbx,%rax)
jmp 0x6aa0d
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x52194