// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_rt17_posn(int)
void parse_rt17_posn(int rif)
{
int flags;
int count;
int i;
double clock;
double freq;

   log_packet_id("Position");

   lat = tsip_double() * PI;
   lon = tsip_double() * PI;
   alt = tsip_double();
   clock = tsip_double();  // clock offset (meters)
   freq = tsip_double();   // freq offset (from 1536*1.023MHz)
   pdop = (float) tsip_double();
   have_dops |= PDOP;
   tsip_double();   // lat rate
   tsip_double();   // lon rate
   tsip_double();   // alt rate
   tsip_dword();    // time tag (msecs)
   flags = tsip_byte();
   count = tsip_byte();

   if(     (flags & 0x07) == 0x00) rcvr_mode = RCVR_MODE_SINGLE;
   else if((flags & 0x07) == 0x01) rcvr_mode = RCVR_MODE_2D;
   else if((flags & 0x07) == 0x02) rcvr_mode = RCVR_MODE_2DCLK;
   else if((flags & 0x07) == 0x03) rcvr_mode = RCVR_MODE_2D_3D;
   else if((flags & 0x07) == 0x04) rcvr_mode = RCVR_MODE_3D;
   else if((flags & 0x07) == 0x05) rcvr_mode = RCVR_MODE_DGPS;  // RTK/SBAS
   else                            rcvr_mode = RCVR_MODE_UNKNOWN; 

   for(i=0; i<count; i++) {  // channel numbers
      tsip_byte();
   }
   for(i=0; i<count; i++) {  // prn numbers
      tsip_byte();
   }

clock = (clock / (LIGHTSPEED*1000.0)); // convert meters to secs
clock *= 1.0E9;  // nsecs
pps_offset = clock;
have_pps_offset = 17;
osc_offset = freq;
have_osc_offset = 17;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
leaq 0xa30f4(%rip), %rdi     # 0x122aa8
callq 0x58e77
callq 0x58b86
mulsd 0x8be52(%rip), %xmm0    # 0x10b818
leaq 0x28d603(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x58b86
mulsd 0x8be3a(%rip), %xmm0    # 0x10b818
leaq 0x28d5f3(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x58b86
leaq 0x28d5eb(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58b86
movsd %xmm0, -0x20(%rbp)
callq 0x58b86
movsd %xmm0, -0x28(%rbp)
callq 0x58b86
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1a3ac7(%rip), %rax    # 0x2234e8
movsd %xmm0, (%rax)
leaq 0x1a3ab8(%rip), %rax    # 0x2234e4
orb $0x1, (%rax)
callq 0x58b86
callq 0x58b86
callq 0x58b86
callq 0x589b0
callq 0x587d1
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x7fa5c
leaq 0x1bf517(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x7fa74
leaq 0x1bf4ff(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
shll $0x3, %r14d
movabsq $0x6363050400060301, %rax # imm = 0x6363050400060301
movl %r14d, %ecx
shrq %cl, %rax
leaq 0x28d641(%rip), %rcx    # 0x30d0d0
movb %al, (%rcx)
andl $0xff, %ebx
je 0x7facc
leaq 0x1bf4d0(%rip), %r14    # 0x23ef70
movl %ebx, %r15d
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x7fab3
orb $0x8, (%r14)
decl %r15d
jne 0x7faa3
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x7fac8
orb $0x8, (%r14)
decl %ebx
jne 0x7fab8
movsd -0x20(%rbp), %xmm0
divsd 0x8bd87(%rip), %xmm0    # 0x10b860
mulsd 0x89547(%rip), %xmm0    # 0x109028
leaq 0x28ccd0(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x28d745(%rip), %rax    # 0x30d238
movl $0x11, %ecx
movl %ecx, (%rax)
leaq 0x28ccbf(%rip), %rax    # 0x30c7c0
movsd -0x28(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x28d723(%rip), %rax    # 0x30d234
movl %ecx, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq