// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sat_tracking(int)
void get_sat_tracking(int msg_fmt)
{
int prn;
float az, el;
float sig_level;

   log_packet_id("Packet 0x5C (Sat tracking)");
// also packet 5d

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

   sat[prn].chan = tsip_byte();
   sat[prn].chan >>= 3;
   sat[prn].acq_flag = tsip_byte();
   sat[prn].eph_flag = tsip_byte();
   if(1 || (log_db == 0)) {
      sig_level = tsip_single();
      sat[prn].sig_level = sig_level;
      have_snr |= rinex_gnss(prn);
      sat[prn].level_msg = 0x5C;
      if(SV6_FAMILY) {
         if(amu_mode == 0) {
            sat[prn].sig_level = amu_to_dbc(sat[prn].sig_level);
         }
      }
   }
   else tsip_single();

   sat[prn].time_of_week = tsip_single();

   el = tsip_single() * (float) RAD_TO_DEG;
   az = tsip_single() * (float) RAD_TO_DEG;
   set_sat_azel(prn, az,el);

//sprintf(plot_title, "trk msg %02X prn:%02d  az:%p el:%p", msg_fmt, prn, sat[prn].azimuth,sat[prn].elevation);
   sat[prn].age = tsip_byte();
   sat[prn].msec = tsip_byte();
   sat[prn].bad_flag = tsip_byte();
   sat[prn].collecting = tsip_byte();
   if(msg_fmt == 0x5D) {  // RES 360 message 0x5D
      sat[prn].how_used = tsip_byte();
      // sv_type for icm receivers:
      //   0=GPS
      //   1=Glonass
      //   2=Beidou?
      //   3=Galileo?
      //   4=SBAS
      //   5=QZSS
      sat[prn].sv_type = tsip_byte();
   }

   check_tsip_end(1);
   if(tsip_error) {
      sat[prn].level_msg = 0x00;
      return;
   }

   record_sig_levels(prn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %r14d
leaq 0xa168d(%rip), %rdi     # 0x10bce6
callq 0x520bf
leaq 0x28cc2f(%rip), %rax    # 0x2f7294
movl $0x1, (%rax)
callq 0x51c47
movzbl %al, %ebx
callq 0x51c47
imulq $0x348, %rbx, %r12      # imm = 0x348
leaq 0x1be92a(%rip), %r13    # 0x228fb0
leaq (%r12,%r13), %r15
shrb $0x3, %al
movb %al, 0x200(%r13,%r12)
callq 0x51c47
movb %al, 0x201(%r13,%r12)
callq 0x51c47
movb %al, 0x202(%r13,%r12)
callq 0x51dc3
movss %xmm0, 0x20(%r13,%r12)
movl %ebx, %edi
callq 0xca4da
leaq 0x28cc83(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
movl $0x5c, 0x1c(%r13,%r12)
leaq 0x1981f5(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x6a727
leaq 0x19a8ec(%rip), %rax    # 0x204fd4
movl (%rax), %eax
cmpl $0x36, %eax
setne %cl
cmpl $0x33, %eax
setne %dl
andb %cl, %dl
cmpl $0x50, %eax
setne %cl
andb %dl, %cl
cmpl $0x41, %eax
setne %al
testb %cl, %al
jne 0x6a727
leaq 0x1be7df(%rip), %rax    # 0x228ef0
cmpb $0x0, (%rax)
jne 0x6a727
movss 0x20(%r15), %xmm0
callq 0xe21de
movss %xmm0, 0x20(%r15)
callq 0x51dc3
movss %xmm0, 0x204(%r15)
callq 0x51dc3
mulss 0x8c9c6(%rip), %xmm0    # 0xf7108
movss %xmm0, -0x2c(%rbp)
callq 0x51dc3
mulss 0x8c9b4(%rip), %xmm0    # 0xf7108
movl %ebx, %edi
movss -0x2c(%rbp), %xmm1
callq 0x53b74
callq 0x51c47
movb %al, 0x212(%r15)
callq 0x51c47
movb %al, 0x213(%r15)
callq 0x51c47
movb %al, 0x214(%r15)
callq 0x51c47
movb %al, 0x215(%r15)
cmpl $0x5d, %r14d
jne 0x6a7ae
callq 0x51c47
movb %al, 0x216(%r15)
callq 0x51c47
movb %al, 0x217(%r15)
xorl %edi, %edi
callq 0x52194
leaq 0x1be7b4(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
je 0x6a7d5
andl $0x0, 0x1c(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x559ba