// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_venus_sv()
void parse_venus_sv()
{
int count;
int i;
int prn;
int state1;
int ura;
int snr;
int az,el;
int state2;

   // sky view
   log_packet_id("venus_sv");

   saw_venus_raw |= 0x01;
   minor_alarms &= (~MINOR_NO_TRACK);
   tsip_byte();  // iod
   count = tsip_byte();

   reset_sat_tracking();
   for(i=0; i<count; i++) {
      tsip_byte(); // channel
      prn = tsip_byte();
      state1 = tsip_byte();
      ura = tsip_byte();
      snr = tsip_byte();
      el = (int) tsip_word();
      az = (int) tsip_word();
      state2 = tsip_byte();

      if((prn >= 1) && (prn <= MAX_PRN)) {
         sat[prn].sv_accuracy = ura_to_dist(prn, ura); // convert to distance

         have_accu = 1;

         if(state1 & 0x04) {  // healthy
            sat[prn].health_flag = 0;
            sat[prn].tracking = 1;
         }
         else {
            sat[prn].health_flag = 1;  // docs say health flag... usage seems more like tracking flag
            sat[prn].tracking = (-1);
         }
         if((state2 & 0x30) == 0) sat[prn].tracking = (-1);
//if(log_file) fprintf(log_file, "prn:%02d  state1:%02X  state2:%02X\n", prn,state1,state2);  // rnx3

         sat[prn].sig_level = (float) snr;
         set_sat_azel(prn, (float) az, (float) el);
         have_sat_azel = 42;

         sat[prn].level_msg = 1;
         level_type = "SNR";
         record_sig_levels(prn);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x8d090(%rip), %rdi     # 0x124aa3
callq 0x58dc2
leaq 0x2a63d5(%rip), %rax    # 0x33ddf4
orb $0x1, (%rax)
leaq 0x2757af(%rip), %rax    # 0x30d1d8
andb $-0x9, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x97a42
leaq 0x1a7531(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x97a5a
leaq 0x1a7519(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
movl $0x218, %eax            # imm = 0x218
leaq 0x1a754a(%rip), %rdx    # 0x23efb0
xorl %ecx, %ecx
movl %ecx, (%rdx,%rax)
movl %ecx, -0x1fc(%rdx,%rax)
addq $0x348, %rax            # imm = 0x348
cmpq $0xcd358, %rax          # imm = 0xCD358
jne 0x97a68
andl $0xff, %ebx
je 0x97bec
leaq 0x1a74dd(%rip), %r15    # 0x23ef70
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x97aa3
orb $0x8, (%r15)
callq 0x587be
movl %eax, %r13d
cmpl $0x100, %eax            # imm = 0x100
jb 0x97ab6
orb $0x8, (%r15)
callq 0x587be
movl %eax, -0x34(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x97ac9
orb $0x8, (%r15)
callq 0x587be
movl %eax, %r12d
cmpl $0x100, %eax            # imm = 0x100
jb 0x97adc
orb $0x8, (%r15)
callq 0x587be
movl %eax, -0x30(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x97aef
orb $0x8, (%r15)
callq 0x588d2
movw %ax, -0x2c(%rbp)
callq 0x588d2
movw %ax, -0x2a(%rbp)
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x97b14
orb $0x8, (%r15)
movzbl %r13b, %r13d
testl %r13d, %r13d
je 0x97be4
movzbl %r12b, %esi
movl %r13d, %edi
callq 0x82c38
movl %r13d, %eax
imulq $0x348, %rax, %r12      # imm = 0x348
leaq 0x1a7472(%rip), %r15    # 0x23efb0
movss %xmm0, 0x1fc(%r15,%r12)
leaq 0x275871(%rip), %rax    # 0x30d3c0
movl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edx
testb $0x4, -0x34(%rbp)
sete %al
sete (%r15,%r12)
testb $0x30, %r14b
sete %cl
orb %al, %cl
movzbl %cl, %eax
negl %eax
orl %edx, %eax
movl $0x1, %r14d
movl %eax, 0x218(%r15,%r12)
movzbl -0x30(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x20(%r15,%r12)
movzwl -0x2a(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movzwl -0x2c(%rbp), %eax
cvtsi2ss %eax, %xmm1
movl %r13d, %edi
callq 0x5ace1
leaq 0x2756db(%rip), %rax    # 0x30d294
movl $0x2a, (%rax)
movl %r14d, 0x1c(%r15,%r12)
leaq 0x1a73a5(%rip), %r15    # 0x23ef70
leaq 0x86429(%rip), %rax     # 0x11dffb
leaq 0x1a731f(%rip), %rcx    # 0x23eef8
movq %rax, (%rcx)
movl %r13d, %edi
callq 0x5cdab
decl %ebx
jne 0x97a93
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq