// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x92568(%rip), %rdi     # 0x12429d
callq 0x58e77
leaq 0x1892b7(%rip), %r12    # 0x21aff8
movl (%r12), %eax
testl %eax, %eax
je 0x91e15
decl %eax
movl %eax, (%r12)
leaq 0x18928e(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x91e6f
leaq 0x2a9ac6(%rip), %rdi    # 0x33b830
leaq 0x924b0(%rip), %rsi     # 0x124221
callq 0x9090
xorl %r14d, %r14d
movl $0x0, %ebx
testq %rax, %rax
je 0x91da1
movq %rax, %r15
addq $0x3, %r15
movq %r15, %rdi
movl $0x2, %esi
callq 0x8fd78
movq %r15, %rdi
callq 0x95e0
movl %eax, %ebx
leaq 0x2a9a88(%rip), %rdi    # 0x33b830
leaq 0x924fc(%rip), %rsi     # 0x1242ab
callq 0x9090
testq %rax, %rax
je 0x91dd8
movq %rax, %r15
addq $0x5, %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x8fd78
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
leaq 0x2a9a51(%rip), %rdi    # 0x33b830
leaq 0x924cb(%rip), %rsi     # 0x1242b1
callq 0x9090
testq %rax, %rax
je 0x91f7b
movq %rax, %r15
addq $0x4, %r15
movq %r15, %rdi
movl $0x3, %esi
callq 0x8fd78
movq %r15, %rdi
callq 0x95e0
jmp 0x91f7d
leaq 0x1891cc(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x91ef6
movl $0x8, (%r12)
leaq 0x1891c8(%rip), %rax    # 0x21affc
movl $0xce, (%rax)
movl $0x224, %eax            # imm = 0x224
leaq 0x1ad16a(%rip), %rcx    # 0x23efb0
movabsq $-0x3e700000000, %rdx   # imm = 0xFFFFFC1900000000
movl $0xfffffc19, (%rcx,%rax) # imm = 0xFFFFFC19
movq %rdx, -0x8(%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd364, %rax          # imm = 0xCD364
jne 0x91e50
jmp 0x9204b
callq 0x811da
callq 0x811da
testl %eax, %eax
je 0x9203c
leaq 0x2a9bb8(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x91eaf
movl %eax, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
leaq 0x1ad108(%rip), %rdx    # 0x23efb0
movl %eax, 0x218(%rdx,%rcx)
leaq 0x2a9b8a(%rip), %rdi    # 0x33ba40
movl $0x3b, %esi
callq 0x9100
testq %rax, %rax
je 0x9204b
xorl %eax, %eax
movl %eax, (%r12)
leaq 0x189126(%rip), %rcx    # 0x21affc
movl %eax, (%rcx)
leaq 0x27b509(%rip), %rbx    # 0x30d3e8
cmpl %eax, (%rbx)
jne 0x92034
movl $0x7, %edi
movl $0x5de, %esi            # imm = 0x5DE
jmp 0x9202f
callq 0x811da
testl %eax, %eax
je 0x9204b
leaq 0x2a9b36(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, (%r12)
leaq 0x1890e2(%rip), %rbx    # 0x21affc
movl $0xce, (%rbx)
movl $0x218, %ecx            # imm = 0x218
leaq 0x1ad084(%rip), %rdx    # 0x23efb0
xorl %esi, %esi
movl %esi, (%rdx,%rcx)
movl %esi, -0x1fc(%rdx,%rcx)
addq $0x348, %rcx            # imm = 0x348
cmpq $0xcd358, %rcx          # imm = 0xCD358
jne 0x91f2e
leaq 0x1acfbd(%rip), %rcx    # 0x23ef0c
movl %eax, (%rcx)
movl %eax, %edi
callq 0x5e411
leaq 0x27b3b9(%rip), %rax    # 0x30d318
movl $0x28, (%rax)
cmpl $0x0, (%r12)
jne 0x9204b
movl $0x0, (%rbx)
jmp 0x9204b
xorl %eax, %eax
leal -0x1(%rbx), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x92016
movl %ebx, %ecx
imulq $0x348, %rcx, %rdx      # imm = 0x348
leaq 0x1ad014(%rip), %rsi    # 0x23efb0
leaq (%rsi,%rdx), %rcx
movl %eax, 0x220(%rsi,%rdx)
cvtsi2ss %eax, %xmm0
movl %r14d, 0x224(%rsi,%rdx)
movl %r14d, 0x18(%rsi,%rdx)
movss %xmm0, 0x20(%rsi,%rdx)
movl $0x34, 0x1c(%rsi,%rdx)
movl $0x1, 0x21c(%rsi,%rdx)
leaq 0x27b364(%rip), %rdx    # 0x30d33c
cmpl $0x0, (%rdx)
jne 0x91fea
leaq 0x186860(%rip), %rsi    # 0x218844
movl $0x7d3, (%rsi)          # imm = 0x7D3
movl $0x3, (%rdx)
xorl %edx, %edx
cmpl $0x1, %eax
sbbl %edx, %edx
orl %ebx, %edx
movl %edx, 0x218(%rcx)
movl %ebx, %edi
callq 0xdbb74
leaq 0x27b33f(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movl %ebx, %edi
callq 0x5ced3
leaq 0x27b3cb(%rip), %rbx    # 0x30d3e8
movl (%rbx), %eax
orl (%r12), %eax
jne 0x92034
movl $0x7, %edi
movl $0x5df, %esi            # imm = 0x5DF
callq 0x1120f
movl $0x1, (%rbx)
jmp 0x9204b
leaq 0x188fb9(%rip), %rax    # 0x21affc
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, (%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq