// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_star_track()
void parse_star_track()    
{
int prn;
int mode;
int snr;
char *s;

   // tracked sat info
   log_packet_id("Star tracking");

   prn = 0;
   mode = 0;
   snr = 0;
   if(star_line) {  // info lines
      --star_line;

      if(star_type == OSA_TYPE) {
         s = strstr(nmea_msg, "ID:");
         if(s) {
            s += 3;
            zpad(s, 2);
            prn = atoi(s);
         }

         s = strstr(nmea_msg, "MODE:");
         if(s) {
            s += 5;
            zpad(s, 1);
            mode = atoi(s);
         }

         s = strstr(nmea_msg, "S/N:");
         if(s) {
            s += 4;
            zpad(s, 3);
            snr = atoi(s);
         }

         if((prn >= 1) && (prn <= MAX_PRN)) {
            sat[prn].osa_snr = snr;
            sat[prn].osa_state = mode;
            sat[prn].state = mode;
            sat[prn].sig_level = (float) snr;
            sat[prn].level_msg = 52;
            sat[prn].visible = 1;
            if(have_state == 0) need_redraw = 2003;
            have_state = STAR_STATE;  // STATE

            if(snr) sat[prn].tracking = prn;
            else sat[prn].tracking = (-1);
            have_snr |= rinex_gnss(prn);
            record_sig_levels(prn);
         }

         if((star_line == 0) && (have_star_track == 0)) { // flush queues on first tracking info message
            new_queue(RESET_ALL_QUEUES, 1503);
         }
         have_star_track = 1;
      }
      else {
         get_msg_field();      // eat the line number
         if(get_msg_field()) { // sat PRN
            prn = atoi(msg_field);
            if((prn >= 1) && (prn <= MAX_PRN)) {
               sat[prn].tracking = prn;
            }
            if(strchr(msg_field, ';')) {  // end of list
               star_line = 0;
               star_msg = 0;
               if(have_star_track == 0) {
                  new_queue(RESET_ALL_QUEUES, 1502);
               }
               have_star_track = 1;
            }
         }
         else {
            star_line = star_msg = 0;
         }
      }
   }
   else if(star_type == OSA_TYPE) {  // first line of chan message
      star_line = 8;
      star_msg = STAR_TRACK_MSG;
      for(prn=0; prn<=MAX_PRN; prn++) {
         sat[prn].osa_snr = (-999);
         sat[prn].osa_state = (-999);
         sat[prn].visible = 0;
      }
      if(star_line == 0) {
         star_msg = 0;
      }
   }
   else if(get_msg_field()) {   // first line of STAR4 track message
      star_line = atoi(msg_field);
      star_msg = STAR_TRACK_MSG;
      reset_sat_tracking();

      sat_count = star_line;
      config_sat_count(sat_count);
      have_count = 40;

      if(star_line == 0) {
         star_msg = 0;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xbfd8b(%rip), %rdi     # 0x18766a
callq 0x7add0
movl $0x0, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
leaq 0x1b28d8(%rip), %rax    # 0x27a1d8
cmpl $0x0, (%rax)
je 0xc7c55
leaq 0x1b28c8(%rip), %rax    # 0x27a1d8
movl (%rax), %ecx
addl $-0x1, %ecx
leaq 0x1b28bc(%rip), %rax    # 0x27a1d8
movl %ecx, (%rax)
leaq 0x1b28a3(%rip), %rax    # 0x27a1c8
cmpl $0x4f, (%rax)
jne 0xc7b8a
leaq 0x2d30db(%rip), %rdi    # 0x39aa10
leaq 0xbfcb2(%rip), %rsi     # 0x1875ee
callq 0x9090
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xc7972
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0xc4fb0
movq -0x18(%rbp), %rdi
callq 0x95c0
movl %eax, -0x4(%rbp)
leaq 0x2d3097(%rip), %rdi    # 0x39aa10
leaq 0xbfcf8(%rip), %rsi     # 0x187678
callq 0x9090
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xc79b6
movq -0x18(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xc4fb0
movq -0x18(%rbp), %rdi
callq 0x95c0
movl %eax, -0x8(%rbp)
leaq 0x2d3053(%rip), %rdi    # 0x39aa10
leaq 0xbfcba(%rip), %rsi     # 0x18767e
callq 0x9090
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xc79fa
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0xc4fb0
movq -0x18(%rbp), %rdi
callq 0x95c0
movl %eax, -0xc(%rbp)
cmpl $0x1, -0x4(%rbp)
jl 0xc7b51
cmpl $0x3e7, -0x4(%rbp)      # imm = 0x3E7
jg 0xc7b51
movl -0xc(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x1d6771(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x220(%rax)
movl -0x8(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x1d6753(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x224(%rax)
movl -0x8(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x1d6735(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x18(%rax)
cvtsi2ssl -0xc(%rbp), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x1d6718(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x1d66fe(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x34, 0x1c(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x1d66e2(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x21c(%rax)
leaq 0x2a4a53(%rip), %rax    # 0x36c51c
cmpl $0x0, (%rax)
jne 0xc7adb
leaq 0x1aff4f(%rip), %rax    # 0x277a24
movl $0x7d3, (%rax)          # imm = 0x7D3
leaq 0x2a4a3a(%rip), %rax    # 0x36c51c
movl $0x3, (%rax)
cmpl $0x0, -0xc(%rbp)
je 0xc7b0e
movl -0x4(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x1d6694(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x218(%rax)
jmp 0xc7b2d
movslq -0x4(%rbp), %rcx
leaq 0x1d6677(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %edi
callq 0x12d280
movl %eax, %ecx
leaq 0x2a49ee(%rip), %rax    # 0x36c52c
orl (%rax), %ecx
leaq 0x2a49e5(%rip), %rax    # 0x36c52c
movl %ecx, (%rax)
movl -0x4(%rbp), %edi
callq 0x80340
leaq 0x1b2680(%rip), %rax    # 0x27a1d8
cmpl $0x0, (%rax)
jne 0xc7b78
leaq 0x2a4a64(%rip), %rax    # 0x36c5c8
cmpl $0x0, (%rax)
jne 0xc7b78
movl $0x7, %edi
movl $0x5df, %esi            # imm = 0x5DF
callq 0x14df0
leaq 0x2a4a49(%rip), %rax    # 0x36c5c8
movl $0x1, (%rax)
jmp 0xc7c50
callq 0xb0bd0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc7c34
leaq 0x2d307c(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x4(%rbp)
cmpl $0x1, -0x4(%rbp)
jl 0xc7bd9
cmpl $0x3e7, -0x4(%rbp)      # imm = 0x3E7
jg 0xc7bd9
movl -0x4(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x1d65c7(%rip), %rax    # 0x29e190
imulq $0x348, %rdx, %rdx      # imm = 0x348
addq %rdx, %rax
movl %ecx, 0x218(%rax)
leaq 0x2d3040(%rip), %rdi    # 0x39ac20
movl $0x3b, %esi
callq 0x9100
cmpq $0x0, %rax
je 0xc7c32
leaq 0x1b25e1(%rip), %rax    # 0x27a1d8
movl $0x0, (%rax)
leaq 0x1b25d8(%rip), %rax    # 0x27a1dc
movl $0x0, (%rax)
leaq 0x2a49b7(%rip), %rax    # 0x36c5c8
cmpl $0x0, (%rax)
jne 0xc7c25
movl $0x7, %edi
movl $0x5de, %esi            # imm = 0x5DE
callq 0x14df0
leaq 0x2a499c(%rip), %rax    # 0x36c5c8
movl $0x1, (%rax)
jmp 0xc7c4e
leaq 0x1b25a1(%rip), %rax    # 0x27a1dc
movl $0x0, (%rax)
leaq 0x1b2590(%rip), %rax    # 0x27a1d8
movl $0x0, (%rax)
jmp 0xc7c50
jmp 0xc7d91
leaq 0x1b256c(%rip), %rax    # 0x27a1c8
cmpl $0x4f, (%rax)
jne 0xc7d12
leaq 0x1b256c(%rip), %rax    # 0x27a1d8
movl $0x8, (%rax)
leaq 0x1b2563(%rip), %rax    # 0x27a1dc
movl $0xce, (%rax)
movl $0x0, -0x4(%rbp)
cmpl $0x3e7, -0x4(%rbp)      # imm = 0x3E7
jg 0xc7cf7
movslq -0x4(%rbp), %rcx
leaq 0x1d64f6(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xfffffc19, 0x220(%rax) # imm = 0xFFFFFC19
movslq -0x4(%rbp), %rcx
leaq 0x1d64d7(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xfffffc19, 0x224(%rax) # imm = 0xFFFFFC19
movslq -0x4(%rbp), %rcx
leaq 0x1d64b8(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x0, 0x21c(%rax)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xc7c86
leaq 0x1b24da(%rip), %rax    # 0x27a1d8
cmpl $0x0, (%rax)
jne 0xc7d10
leaq 0x1b24d2(%rip), %rax    # 0x27a1dc
movl $0x0, (%rax)
jmp 0xc7d8f
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc7d8d
leaq 0x2d2efd(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x1b24a7(%rip), %rax    # 0x27a1d8
movl %ecx, (%rax)
leaq 0x1b24a2(%rip), %rax    # 0x27a1dc
movl $0xce, (%rax)
callq 0x81c10
leaq 0x1b248c(%rip), %rax    # 0x27a1d8
movl (%rax), %ecx
leaq 0x1d6397(%rip), %rax    # 0x29e0ec
movl %ecx, (%rax)
leaq 0x1d638e(%rip), %rax    # 0x29e0ec
movl (%rax), %edi
callq 0x82080
leaq 0x2a478c(%rip), %rax    # 0x36c4f8
movl $0x28, (%rax)
leaq 0x1b245f(%rip), %rax    # 0x27a1d8
cmpl $0x0, (%rax)
jne 0xc7d8b
leaq 0x1b2457(%rip), %rax    # 0x27a1dc
movl $0x0, (%rax)
jmp 0xc7d8d
jmp 0xc7d8f
jmp 0xc7d91
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)