// File: /workspace/github_cpp_makefile_star2_O3/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, -0x2c(%rbp)
testl %edi, %edi
leaq 0xad65a(%rip), %rax     # 0x121e1b
leaq 0xad631(%rip), %rdi     # 0x121df9
cmoveq %rax, %rdi
callq 0x58dc2
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x747e9
leaq 0x1ca78a(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leaq 0x1a40e0(%rip), %r15    # 0x2188d0
movq (%r15), %rcx
cmpq $0x1, %rcx
sete %sil
leaq 0x1a67d2(%rip), %r12    # 0x21afd4
movl (%r12), %eax
cmpl $0x41, %eax
sete %dl
andb %sil, %dl
leaq 0x1a40e2(%rip), %rsi    # 0x2188f8
movl (%rsi), %esi
cmpl $0x47, %esi
sete %dil
testb %dil, %dl
jne 0x74871
testb %dl, %dl
je 0x74832
cmpl $0x33, %esi
je 0x74871
cmpl $0x47, %esi
je 0x74871
cmpq $0x1, %rcx
sete %cl
cmpb %dl, %cl
je 0x74871
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x74871
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x74871
movl %ebx, %eax
andb $0xf, %al
addb $-0x3, %al
movb $0x63, %cl
cmpb $0x9, %al
ja 0x74868
movzbl %al, %eax
leaq 0xab7b7(%rip), %rcx     # 0x12001c
movb (%rax,%rcx), %cl
leaq 0x298861(%rip), %rax    # 0x30d0d0
movb %cl, (%rax)
leaq 0x1aec6c(%rip), %rax    # 0x2234e4
movl $0x0, (%rax)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
leaq 0x1aec5a(%rip), %r13    # 0x2234e8
movsd %xmm0, (%r13)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
leaq 0x1aec4c(%rip), %r14    # 0x2234f0
movsd %xmm0, (%r14)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
leaq 0x1aec3f(%rip), %rax    # 0x2234f8
movsd %xmm0, (%rax)
callq 0x58a30
cvtss2sd %xmm0, %xmm1
leaq 0x1aec3b(%rip), %rax    # 0x223508
movsd %xmm1, (%rax)
movsd (%r13), %xmm1
ucomisd 0x97261(%rip), %xmm1    # 0x10bb40
movabsq $0x4034000000000000, %rcx # imm = 0x4034000000000000
jbe 0x748ef
movq %rcx, (%r13)
movsd (%r14), %xmm1
ucomisd 0x97244(%rip), %xmm1    # 0x10bb40
jbe 0x74901
movq %rcx, (%r14)
leaq 0x1aebf0(%rip), %rdx    # 0x2234f8
movsd (%rdx), %xmm1
ucomisd 0x9722c(%rip), %xmm1    # 0x10bb40
jbe 0x74919
movq %rcx, (%rdx)
ucomiss 0xaa130(%rip), %xmm0    # 0x11ea50
jbe 0x74925
movq %rcx, (%rax)
leaq 0x1aebb8(%rip), %rax    # 0x2234e4
orb $0x17, (%rax)
shrb $0x4, %bl
cmpq $0x1, (%r15)
sete %cl
cmpl $0x41, (%r12)
sete %al
andb %cl, %al
leaq 0x1a3fae(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
movl $0x560, %edx            # imm = 0x560
leaq 0x1ca658(%rip), %r14    # 0x23efb0
testb %al, %al
je 0x74966
cmpl $0x33, %ecx
je 0x7496e
cmpl $0x47, %ecx
je 0x7496e
movl $0x0, (%r14,%rdx)
addq $0x348, %rdx            # imm = 0x348
cmpq $0xcd358, %rdx          # imm = 0xCD358
jne 0x74958
cmpl $0x0, -0x2c(%rbp)
je 0x7499c
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x7499c
leaq 0x1ca5d7(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
testb %bl, %bl
je 0x74a0f
movzbl %bl, %ebx
leaq 0x1ca5c6(%rip), %r13    # 0x23ef70
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x749bb
orb $0x8, (%r13)
movzbl %al, %ecx
cmpq $0x1, (%r15)
jne 0x749e3
cmpl $0x41, (%r12)
jne 0x749e3
leaq 0x1a3f26(%rip), %rdx    # 0x2188f8
movl (%rdx), %esi
movl $0x1, %edx
cmpl $0x33, %esi
je 0x749fa
cmpl $0x47, %esi
je 0x749fa
movl $0x1, %edx
testb %al, %al
jns 0x749fa
orl $0xffffff00, %eax       # imm = 0xFFFFFF00
negl %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
movl %ecx, %eax
imulq $0x348, %rax, %rax      # imm = 0x348
movl %edx, 0x218(%r14,%rax)
decl %ebx
jne 0x749aa
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x58e9b