// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_tm4_sats()
void parse_tm4_sats()
{
int i;
int prn;
int w,x,y;
int z;
float sig;

   log_packet_id("sat info");
   reset_sat_tracking();

   for(i=0; i<12; i++) { 
      prn = w = x = y = 0;
      sig = 0.0F;
      if(get_msg_field()) {
         prn = atoi(msg_field);
         if((prn >= 1) && (prn < MAX_PRN)) ;
         else prn = 0;
      }

      if(get_msg_field()) {  // 0=included   1=not included
         w = atoi(msg_field);
         if(w == 0) sat[prn].tracking = (-1);
      }

      if(get_msg_field()) {  // tracking status A=acquiring S=searching  0..9=sig leve;
         if(isdigit(msg_field[0])) {  // sig level
            x = atoi(msg_field);
            if     (x == 9) sig = 45.0F;
            else if(x == 8) sig = 44.0F;
            else if(x == 7) sig = 43.0F;
            else if(x == 6) sig = 42.0F;
            else if(x == 5) sig = 41.0F;
            else if(x == 4) sig = 40.0F;
            else if(x == 3) sig = 39.0F;
            else if(x == 2) sig = 38.0F;
            else if(x == 1) sig = 37.0F;
            else if(x == 0) sig = 26.0F;
            sat[prn].tracking = 1;
            sat[prn].sig_level = sig;
            sat[prn].level_msg = 444;
         }
         else { // A=acquiring  S=searching
            x = msg_field[0];
         }
      }
      if(get_msg_field()) {  // ephemeris status
         y = atoi(msg_field);
      }
   }

   if(get_msg_field()) {  // receiver status
      // 2=sky search
      // 3=almanac collect
      // 4=ephemeris collect
      // 5=acquisition
      // 6=positioning
      z = atoi(msg_field);
   }

   level_type = "dBc";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x7fc78(%rip), %rdi     # 0x124ccf
callq 0x58dc2
movl $0x218, %eax            # imm = 0x218
leaq 0x199f48(%rip), %r14    # 0x23efb0
xorl %ecx, %ecx
movl %ecx, (%r14,%rax)
movl %ecx, -0x1fc(%r14,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd358, %rax          # imm = 0xCD358
jne 0xa506a
movl $0xc, %r15d
xorl %r12d, %r12d
leaq 0x2969ac(%rip), %rbx    # 0x33ba40
callq 0x810b1
testl %eax, %eax
je 0xa50b7
movq %rbx, %rdi
callq 0x95e0
leal -0x1(%rax), %ecx
cmpl $0x3e6, %ecx            # imm = 0x3E6
cmovael %r12d, %eax
movslq %eax, %r13
jmp 0xa50ba
xorl %r13d, %r13d
callq 0x810b1
testl %eax, %eax
je 0xa50e2
movq %rbx, %rdi
callq 0x95e0
testl %eax, %eax
jne 0xa50e2
imulq $0x348, %r13, %rax      # imm = 0x348
movl $0xffffffff, 0x218(%r14,%rax) # imm = 0xFFFFFFFF
callq 0x810b1
testl %eax, %eax
je 0xa5137
movsbl (%rbx), %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0xa5137
movq %rbx, %rdi
callq 0x95e0
xorps %xmm0, %xmm0
cmpl $0x9, %eax
ja 0xa5114
movl %eax, %eax
leaq 0x7b031(%rip), %rcx     # 0x120140
movss (%rcx,%rax,4), %xmm0
imulq $0x348, %r13, %rax      # imm = 0x348
movl $0x1, 0x218(%r14,%rax)
movss %xmm0, 0x20(%r14,%rax)
movl $0x1bc, 0x1c(%r14,%rax) # imm = 0x1BC
callq 0x810b1
decl %r15d
jne 0xa5094
callq 0x810b1
leaq 0x7cb89(%rip), %rax     # 0x121cda
leaq 0x199da0(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq