// File: /workspace/github_cpp_makefile_star2_O3/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 0xa339f(%rip), %rdi     # 0x122b88
callq 0x58dc2
callq 0x58b08
mulsd 0x8c02d(%rip), %xmm0    # 0x10b828
leaq 0x28d7ce(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x58b08
mulsd 0x8c015(%rip), %xmm0    # 0x10b828
leaq 0x28d7be(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x58b08
leaq 0x28d7b6(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58b08
movsd %xmm0, -0x20(%rbp)
callq 0x58b08
movsd %xmm0, -0x28(%rbp)
callq 0x58b08
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1a3c92(%rip), %rax    # 0x2234e8
movsd %xmm0, (%rax)
leaq 0x1a3c83(%rip), %rax    # 0x2234e4
orb $0x1, (%rax)
callq 0x58b08
callq 0x58b08
callq 0x58b08
callq 0x58964
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x7f891
leaq 0x1bf6e2(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x7f8a9
leaq 0x1bf6ca(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
shll $0x3, %r14d
movabsq $0x6363050400060301, %rax # imm = 0x6363050400060301
movl %r14d, %ecx
shrq %cl, %rax
leaq 0x28d80c(%rip), %rcx    # 0x30d0d0
movb %al, (%rcx)
andl $0xff, %ebx
je 0x7f901
leaq 0x1bf69b(%rip), %r14    # 0x23ef70
movl %ebx, %r15d
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x7f8e8
orb $0x8, (%r14)
decl %r15d
jne 0x7f8d8
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x7f8fd
orb $0x8, (%r14)
decl %ebx
jne 0x7f8ed
movsd -0x20(%rbp), %xmm0
divsd 0x8bf62(%rip), %xmm0    # 0x10b870
mulsd 0x89712(%rip), %xmm0    # 0x109028
leaq 0x28ce9b(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x28d910(%rip), %rax    # 0x30d238
movl $0x11, %ecx
movl %ecx, (%rax)
leaq 0x28ce8a(%rip), %rax    # 0x30c7c0
movsd -0x28(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x28d8ee(%rip), %rax    # 0x30d234
movl %ecx, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq