// File: /workspace/github_cpp_makefile_star2_O1/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 0xad39d(%rip), %rax     # 0x121d3b
leaq 0xad374(%rip), %rdi     # 0x121d19
cmoveq %rax, %rdi
callq 0x58e77
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x749c4
leaq 0x1ca5af(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x1a3f05(%rip), %r15    # 0x2188d0
movq (%r15), %rcx
cmpq $0x1, %rcx
sete %sil
leaq 0x1a65f7(%rip), %r12    # 0x21afd4
movl (%r12), %r8d
cmpl $0x41, %r8d
sete %dl
andb %sil, %dl
leaq 0x1a3f06(%rip), %rsi    # 0x2188f8
movl (%rsi), %esi
cmpl $0x47, %esi
sete %dil
testb %dil, %dl
jne 0x74a53
testb %dl, %dl
je 0x74a0e
cmpl $0x33, %esi
je 0x74a53
cmpl $0x47, %esi
je 0x74a53
cmpq $0x1, %rcx
sete %cl
cmpb %dl, %cl
je 0x74a53
addl $-0x33, %r8d
cmpl $0x1d, %r8d
ja 0x74a53
movl $0x20004009, %ecx       # imm = 0x20004009
btl %r8d, %ecx
jae 0x74a53
movl %eax, %edx
andb $0xf, %dl
addb $-0x3, %dl
movb $0x63, %cl
cmpb $0x9, %dl
ja 0x74a4a
movzbl %dl, %edx
leaq 0xab4fd(%rip), %rcx     # 0x11ff44
movb (%rdx,%rcx), %cl
leaq 0x29867f(%rip), %rdx    # 0x30d0d0
movb %cl, (%rdx)
movl %eax, -0x30(%rbp)
leaq 0x1aea87(%rip), %rax    # 0x2234e4
movl $0x0, (%rax)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
leaq 0x1aea75(%rip), %r13    # 0x2234e8
movsd %xmm0, (%r13)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
leaq 0x1aea67(%rip), %r14    # 0x2234f0
movsd %xmm0, (%r14)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
leaq 0x1aea5a(%rip), %rbx    # 0x2234f8
movsd %xmm0, (%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm1
leaq 0x1aea56(%rip), %rdx    # 0x223508
movsd %xmm1, (%rdx)
movsd (%r13), %xmm1
ucomisd 0x97074(%rip), %xmm1    # 0x10bb38
movabsq $0x4034000000000000, %rcx # imm = 0x4034000000000000
jbe 0x74ad4
movq %rcx, (%r13)
movsd (%r14), %xmm1
ucomisd 0x97057(%rip), %xmm1    # 0x10bb38
jbe 0x74ae6
movq %rcx, (%r14)
movsd (%rbx), %xmm1
ucomisd 0x97046(%rip), %xmm1    # 0x10bb38
movl -0x30(%rbp), %eax
jbe 0x74afa
movq %rcx, (%rbx)
ucomiss 0xa9e9f(%rip), %xmm0    # 0x11e9a0
jbe 0x74b06
movq %rcx, (%rdx)
leaq 0x1ae9d7(%rip), %rcx    # 0x2234e4
orb $0x17, (%rcx)
shrb $0x4, %al
cmpq $0x1, (%r15)
sete %cl
cmpl $0x41, (%r12)
sete %dil
andb %cl, %dil
leaq 0x1a3dcb(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
cmpl $0x47, %ecx
sete %dl
andb %dil, %dl
movl $0x560, %esi            # imm = 0x560
leaq 0x1ca46c(%rip), %r14    # 0x23efb0
testb %dil, %dil
je 0x74b53
cmpl $0x33, %ecx
je 0x74b5f
cmpl $0x47, %ecx
je 0x74b5f
testb %dl, %dl
jne 0x74b5f
movl $0x0, (%r14,%rsi)
addq $0x348, %rsi            # imm = 0x348
cmpq $0xcd358, %rsi          # imm = 0xCD358
jne 0x74b44
cmpl $0x0, -0x2c(%rbp)
je 0x74b8b
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74b8b
leaq 0x1ca3e8(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
testb %al, %al
je 0x74bf7
movzbl %al, %ebx
leaq 0x1ca3d7(%rip), %r13    # 0x23ef70
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74baa
orb $0x8, (%r13)
movzbl %al, %ecx
cmpq $0x1, (%r15)
jne 0x74bcd
cmpl $0x41, (%r12)
jne 0x74bcd
leaq 0x1a3d37(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
cmpl $0x33, %edx
je 0x74bd7
cmpl $0x47, %edx
je 0x74bd7
movsbl %al, %eax
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
orl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
sarl $0x1f, %ecx
orl $0x1, %ecx
imulq $0x348, %rax, %rax      # imm = 0x348
movl %ecx, 0x218(%r14,%rax)
decl %ebx
jne 0x74b99
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x58f50