// File: /workspace/github_cpp_makefile_star2_O2/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 0x89411(%rip), %rdi     # 0x10e2c5
callq 0x520bf
leaq 0x180138(%rip), %r12    # 0x204ff8
movl (%r12), %eax
testl %eax, %eax
je 0x84f8e
decl %eax
movl %eax, (%r12)
leaq 0x18010f(%rip), %rax    # 0x204fe8
cmpl $0x4f, (%rax)
jne 0x84fe9
leaq 0x2a0947(%rip), %rdi    # 0x325830
leaq 0x89359(%rip), %rsi     # 0x10e249
callq 0x9090
xorl %r14d, %r14d
movl $0x0, %ebx
testq %rax, %rax
je 0x84f1e
movq %rax, %r15
addq $0x3, %r15
pushq $0x2
popq %rsi
movq %r15, %rdi
callq 0x830bb
movq %r15, %rdi
callq 0x95e0
movl %eax, %ebx
leaq 0x2a090b(%rip), %rdi    # 0x325830
leaq 0x893a7(%rip), %rsi     # 0x10e2d3
callq 0x9090
testq %rax, %rax
je 0x84f53
movq %rax, %r15
addq $0x5, %r15
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x830bb
movq %r15, %rdi
callq 0x95e0
movl %eax, %r14d
leaq 0x2a08d6(%rip), %rdi    # 0x325830
leaq 0x89378(%rip), %rsi     # 0x10e2d9
callq 0x9090
testq %rax, %rax
je 0x850cf
movq %rax, %r15
addq $0x4, %r15
pushq $0x3
popq %rsi
movq %r15, %rdi
callq 0x830bb
movq %r15, %rdi
callq 0x95e0
jmp 0x850d1
leaq 0x180053(%rip), %rax    # 0x204fe8
cmpl $0x4f, (%rax)
jne 0x8506e
movl $0x8, (%r12)
leaq 0x18004f(%rip), %rax    # 0x204ffc
movl $0xce, (%rax)
movl $0x224, %eax            # imm = 0x224
leaq 0x1a3ff1(%rip), %rcx    # 0x228fb0
movabsq $-0x3e700000000, %rdx   # imm = 0xFFFFFC1900000000
cmpq $0xcd364, %rax          # imm = 0xCD364
je 0x8519d
movl $0xfffffc19, (%rcx,%rax) # imm = 0xFFFFFC19
movq %rdx, -0x8(%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
jmp 0x84fc9
callq 0x75767
callq 0x75767
testl %eax, %eax
je 0x8518e
leaq 0x2a0a3e(%rip), %rdi    # 0x325a40
callq 0x95e0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x85029
movl %eax, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
leaq 0x1a3f8e(%rip), %rdx    # 0x228fb0
movl %eax, 0x218(%rdx,%rcx)
leaq 0x2a0a10(%rip), %rdi    # 0x325a40
pushq $0x3b
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x8519d
andl $0x0, (%r12)
leaq 0x17ffaf(%rip), %rax    # 0x204ffc
andl $0x0, (%rax)
leaq 0x272391(%rip), %rbx    # 0x2f73e8
xorl %eax, %eax
cmpl %eax, (%rbx)
jne 0x85186
pushq $0x7
popq %rdi
movl $0x5de, %esi            # imm = 0x5DE
jmp 0x85181
callq 0x75767
testl %eax, %eax
je 0x8519d
leaq 0x2a09be(%rip), %rdi    # 0x325a40
callq 0x95e0
movl %eax, (%r12)
leaq 0x17ff6a(%rip), %rbx    # 0x204ffc
movl $0xce, (%rbx)
callq 0x56b1c
movl (%r12), %edi
leaq 0x1a3e64(%rip), %rax    # 0x228f0c
movl %edi, (%rax)
callq 0x56d93
leaq 0x272262(%rip), %rax    # 0x2f7318
movl $0x28, (%rax)
cmpl $0x0, (%r12)
jne 0x8519d
andl $0x0, (%rbx)
jmp 0x8519d
xorl %eax, %eax
leal -0x1(%rbx), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
ja 0x8516a
movl %ebx, %ecx
imulq $0x348, %rcx, %rdx      # imm = 0x348
leaq 0x1a3ec0(%rip), %rsi    # 0x228fb0
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 0x272210(%rip), %rdx    # 0x2f733c
cmpl $0x0, (%rdx)
jne 0x8513e
leaq 0x17d70c(%rip), %rsi    # 0x202844
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 0xca4da
leaq 0x2721eb(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
movl %ebx, %edi
callq 0x559ba
leaq 0x272277(%rip), %rbx    # 0x2f73e8
movl (%rbx), %eax
orl (%r12), %eax
jne 0x85186
pushq $0x7
popq %rdi
movl $0x5df, %esi            # imm = 0x5DF
callq 0x10a99
movl $0x1, (%rbx)
jmp 0x8519d
leaq 0x17fe67(%rip), %rax    # 0x204ffc
andl $0x0, (%rax)
andl $0x0, (%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq