// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
movl %edi, %ebx
leaq 0xad5f0(%rip), %rdi     # 0x121cbe
callq 0x58e77
leaq 0x298bba(%rip), %rax    # 0x30d294
movl $0x1, (%rax)
callq 0x587d1
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x746f9
leaq 0x1ca87a(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x7470f
leaq 0x1ca864(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %r14b, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
leaq 0x1ca88f(%rip), %rdx    # 0x23efb0
leaq (%rdx,%rcx), %r15
shrb $0x3, %al
movb %al, 0x200(%rdx,%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74745
leaq 0x1ca82e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %r14b, %r14d
movb %al, 0x201(%r15)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74766
leaq 0x1ca80d(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x202(%r15)
callq 0x58aae
movss %xmm0, 0x20(%r15)
movl %r14d, %edi
callq 0xdbb74
leaq 0x298bc5(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movl $0x5c, 0x1c(%r15)
leaq 0x1a4138(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x747e4
leaq 0x1a682f(%rip), %rax    # 0x21afd4
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 0x747e4
leaq 0x1ca722(%rip), %rax    # 0x23eef0
cmpb $0x0, (%rax)
jne 0x747e4
movss 0x20(%r15), %xmm0
callq 0xf72a0
movss %xmm0, 0x20(%r15)
callq 0x58aae
movss %xmm0, 0x204(%r15)
callq 0x58aae
mulss 0x987f5(%rip), %xmm0    # 0x10cff4
movss %xmm0, -0x1c(%rbp)
callq 0x58aae
mulss 0x987e3(%rip), %xmm0    # 0x10cff4
movl %r14d, %edi
movss -0x1c(%rbp), %xmm1
callq 0x5ad98
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74834
leaq 0x1ca73f(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x212(%r15)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x74851
leaq 0x1ca722(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x213(%r15)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x7486e
leaq 0x1ca705(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x214(%r15)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x7488b
leaq 0x1ca6e8(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x215(%r15)
cmpl $0x5d, %ebx
jne 0x748d1
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x748ad
leaq 0x1ca6c6(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x216(%r15)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x748ca
leaq 0x1ca6a9(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x217(%r15)
xorl %edi, %edi
callq 0x58f50
leaq 0x1ca691(%rip), %rax    # 0x23ef70
cmpl $0x0, (%rax)
je 0x748f7
movl $0x0, 0x1c(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5ced3