// File: 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
subq $0x30, %rsp
leaq 0xb9740(%rip), %rdi     # 0x187d8f
callq 0x7add0
leaq 0x2ce979(%rip), %rax    # 0x39cfd4
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2ce96d(%rip), %rax    # 0x39cfd4
movl %ecx, (%rax)
leaq 0x29dd48(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x29dd3c(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
callq 0x7a510
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x4(%rbp)
callq 0x81c10
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xce86c
callq 0x7a510
callq 0x7a510
movzbl %al, %eax
movl %eax, -0xc(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x14(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x18(%rbp)
callq 0x7a560
movzwl %ax, %eax
movl %eax, -0x20(%rbp)
callq 0x7a560
movzwl %ax, %eax
movl %eax, -0x1c(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x24(%rbp)
cmpl $0x1, -0xc(%rbp)
jl 0xce85c
cmpl $0x3e7, -0xc(%rbp)      # imm = 0x3E7
jg 0xce85c
movl -0xc(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0xb3220
movslq -0xc(%rbp), %rcx
leaq 0x1cfa6b(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x1fc(%rax)
leaq 0x29de62(%rip), %rax    # 0x36c5a0
movl $0x1, (%rax)
movl -0x10(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xce788
movslq -0xc(%rbp), %rcx
leaq 0x1cfa36(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movb $0x0, (%rax)
movslq -0xc(%rbp), %rcx
leaq 0x1cfa1e(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x218(%rax)
jmp 0xce7bf
movslq -0xc(%rbp), %rcx
leaq 0x1cf9fd(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movb $0x1, (%rax)
movslq -0xc(%rbp), %rcx
leaq 0x1cf9e5(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
movl -0x24(%rbp), %eax
andl $0x30, %eax
cmpl $0x0, %eax
jne 0xce7e9
movslq -0xc(%rbp), %rcx
leaq 0x1cf9bb(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0xffffffff, 0x218(%rax) # imm = 0xFFFFFFFF
cvtsi2ssl -0x18(%rbp), %xmm0
movslq -0xc(%rbp), %rcx
leaq 0x1cf997(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movl -0xc(%rbp), %edi
cvtsi2ssl -0x1c(%rbp), %xmm0
cvtsi2ssl -0x20(%rbp), %xmm1
callq 0x7d450
leaq 0x29dc53(%rip), %rax    # 0x36c474
movl $0x2a, (%rax)
movslq -0xc(%rbp), %rcx
leaq 0x1cf95e(%rip), %rax    # 0x29e190
imulq $0x348, %rcx, %rcx      # imm = 0x348
addq %rcx, %rax
movl $0x1, 0x1c(%rax)
leaq 0x1cf88e(%rip), %rax    # 0x29e0d8
leaq 0xb41c5(%rip), %rcx     # 0x182a16
movq %rcx, (%rax)
movl -0xc(%rbp), %edi
callq 0x80340
jmp 0xce85e
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xce69a
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)