// File: /workspace/github_cpp_makefile_star2_O3/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 0x925cc(%rip), %rdi     # 0x12437d
callq 0x58dc2
leaq 0x18923b(%rip), %r12    # 0x21aff8
movl (%r12), %eax
testl %eax, %eax
je 0x91e91
decl %eax
movl %eax, (%r12)
leaq 0x189212(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x91eeb
leaq 0x2a9a4a(%rip), %rdi    # 0x33b830
leaq 0x92514(%rip), %rsi     # 0x124301
callq 0x9090
xorl %r14d, %r14d
movl $0x0, %ebx
testq %rax, %rax
je 0x91e1d
movq %rax, %r15
addq $0x3, %r15
movq %r15, %rdi
movl $0x2, %esi
callq 0x8fdd2
movq %r15, %rdi
callq 0x95e0
movl %eax, %ebx
leaq 0x2a9a0c(%rip), %rdi    # 0x33b830
leaq 0x92560(%rip), %rsi     # 0x12438b
callq 0x9090
testq %rax, %rax
je 0x91e54
movq %rax, %r15
addq $0x5, %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x8fdd2
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
leaq 0x2a99d5(%rip), %rdi    # 0x33b830
leaq 0x9252f(%rip), %rsi     # 0x124391
callq 0x9090
testq %rax, %rax
je 0x91ff7
movq %rax, %r15
addq $0x4, %r15
movq %r15, %rdi
movl $0x3, %esi
callq 0x8fdd2
movq %r15, %rdi
callq 0x95e0
jmp 0x91ff9
leaq 0x189150(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x91f72
movl $0x8, (%r12)
leaq 0x18914c(%rip), %rax    # 0x21affc
movl $0xce, (%rax)
movl $0x224, %eax            # imm = 0x224
leaq 0x1ad0ee(%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 0x91ecc
jmp 0x920c7
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0x920b8
leaq 0x2a9b3c(%rip), %rdi    # 0x33ba40
callq 0x95e0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x91f2b
movl %eax, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
leaq 0x1ad08c(%rip), %rdx    # 0x23efb0
movl %eax, 0x218(%rdx,%rcx)
leaq 0x2a9b0e(%rip), %rdi    # 0x33ba40
movl $0x3b, %esi
callq 0x9100
testq %rax, %rax
je 0x920c7
xorl %eax, %eax
movl %eax, (%r12)
leaq 0x1890aa(%rip), %rcx    # 0x21affc
movl %eax, (%rcx)
leaq 0x27b48d(%rip), %rbx    # 0x30d3e8
cmpl %eax, (%rbx)
jne 0x920b0
movl $0x7, %edi
movl $0x5de, %esi            # imm = 0x5DE
jmp 0x920ab
callq 0x810b1
testl %eax, %eax
je 0x920c7
leaq 0x2a9aba(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, (%r12)
leaq 0x189066(%rip), %rbx    # 0x21affc
movl $0xce, (%rbx)
movl $0x218, %ecx            # imm = 0x218
leaq 0x1ad008(%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 0x91faa
leaq 0x1acf41(%rip), %rcx    # 0x23ef0c
movl %eax, (%rcx)
movl %eax, %edi
callq 0x5e390
leaq 0x27b33d(%rip), %rax    # 0x30d318
movl $0x28, (%rax)
cmpl $0x0, (%r12)
jne 0x920c7
movl $0x0, (%rbx)
jmp 0x920c7
xorl %eax, %eax
leal -0x1(%rbx), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x92092
movl %ebx, %ecx
imulq $0x348, %rcx, %rdx      # imm = 0x348
leaq 0x1acf98(%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 0x27b2e8(%rip), %rdx    # 0x30d33c
cmpl $0x0, (%rdx)
jne 0x92066
leaq 0x1867e4(%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 0xdc1dd
leaq 0x27b2c3(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
movl %ebx, %edi
callq 0x5cdab
leaq 0x27b34f(%rip), %rbx    # 0x30d3e8
movl (%rbx), %eax
orl (%r12), %eax
jne 0x920b0
movl $0x7, %edi
movl $0x5df, %esi            # imm = 0x5DF
callq 0x1118c
movl $0x1, (%rbx)
jmp 0x920c7
leaq 0x188f3d(%rip), %rax    # 0x21affc
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, (%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq