// File: 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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
leaq 0xe53fc(%rip), %rdi     # 0x18502e
callq 0x7add0
leaq 0x2cc836(%rip), %rax    # 0x36c474
movl $0x1, (%rax)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x8(%rbp)
cmpl $0x3e7, -0x8(%rbp)      # imm = 0x3E7
jle 0x9fc61
movl $0x0, -0x8(%rbp)
jmp 0x9fc70
cmpl $0x1, -0x8(%rbp)
jge 0x9fc6e
movl $0x0, -0x8(%rbp)
jmp 0x9fc70
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe50e(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x200(%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1fe4f3(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movzbl 0x200(%rax), %ecx
sarl $0x3, %ecx
movb %cl, 0x200(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe4c7(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x201(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe4a5(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x202(%rax)
callq 0x7a860
movss %xmm0, -0x14(%rbp)
movss -0x14(%rbp), %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x1fe47b(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movl -0x8(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2cc7f7(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x2cc7ee(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
movslq -0x8(%rbp), %rcx
leaq 0x1fe445(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x5c, 0x1c(%rax)
leaq 0x1d7d4d(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9fde3
leaq 0x1da444(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0x9fd99
leaq 0x1da438(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0x9fd99
leaq 0x1da42c(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0x9fd99
leaq 0x1da420(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9fde3
leaq 0x1fe330(%rip), %rax    # 0x29e0d0
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x9fde1
movslq -0x8(%rbp), %rcx
leaq 0x1fe3dd(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss 0x20(%rax), %xmm0
callq 0x154b60
movslq -0x8(%rbp), %rcx
leaq 0x1fe3be(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
jmp 0x9fde3
callq 0x7a860
movslq -0x8(%rbp), %rcx
leaq 0x1fe39d(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x204(%rax)
callq 0x7a860
movss 0xd1b42(%rip), %xmm1    # 0x171954
mulss %xmm1, %xmm0
movss %xmm0, -0x10(%rbp)
callq 0x7a860
movss 0xd1b2c(%rip), %xmm1    # 0x171954
mulss %xmm1, %xmm0
movss %xmm0, -0xc(%rbp)
movl -0x8(%rbp), %edi
movss -0xc(%rbp), %xmm0
movss -0x10(%rbp), %xmm1
callq 0x7d450
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe33b(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x212(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe319(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x213(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe2f7(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x214(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe2d5(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x215(%rax)
cmpl $0x5d, -0x4(%rbp)
jne 0x9ff15
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe2ad(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x216(%rax)
callq 0x7a510
movb %al, %cl
movslq -0x8(%rbp), %rdx
leaq 0x1fe28b(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movb %cl, 0x217(%rax)
movl $0x1, %edi
callq 0x7aee0
leaq 0x1fe22a(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0x9ff49
movslq -0x8(%rbp), %rcx
leaq 0x1fe25a(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0x1c(%rax)
jmp 0x9ff51
movl -0x8(%rbp), %edi
callq 0x80340
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)