// File: 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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
leaq 0xd7036(%rip), %rdi     # 0x185e18
callq 0x7add0
callq 0x7a9d0
movsd 0xc27d4(%rip), %xmm1    # 0x1715c8
mulsd %xmm1, %xmm0
leaq 0x2bd3b1(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
callq 0x7a9d0
movsd 0xc27b8(%rip), %xmm1    # 0x1715c8
mulsd %xmm1, %xmm0
leaq 0x2bd39d(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
callq 0x7a9d0
leaq 0x2bd395(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
callq 0x7a9d0
movsd %xmm0, -0x18(%rbp)
callq 0x7a9d0
movsd %xmm0, -0x20(%rbp)
callq 0x7a9d0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1d3871(%rip), %rax    # 0x2826c8
movsd %xmm0, (%rax)
leaq 0x1d3862(%rip), %rax    # 0x2826c4
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x1d3856(%rip), %rax    # 0x2826c4
movl %ecx, (%rax)
callq 0x7a9d0
callq 0x7a9d0
callq 0x7a9d0
callq 0x7a680
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x8(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0xaeeb4
leaq 0x2bd404(%rip), %rax    # 0x36c2b0
movb $0x1, (%rax)
jmp 0xaef3b
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x1, %eax
jne 0xaeecb
leaq 0x2bd3ea(%rip), %rax    # 0x36c2b0
movb $0x3, (%rax)
jmp 0xaef39
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x2, %eax
jne 0xaeee2
leaq 0x2bd3d3(%rip), %rax    # 0x36c2b0
movb $0x6, (%rax)
jmp 0xaef37
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x3, %eax
jne 0xaeef9
leaq 0x2bd3bc(%rip), %rax    # 0x36c2b0
movb $0x0, (%rax)
jmp 0xaef35
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x4, %eax
jne 0xaef10
leaq 0x2bd3a5(%rip), %rax    # 0x36c2b0
movb $0x4, (%rax)
jmp 0xaef33
movl -0x8(%rbp), %eax
andl $0x7, %eax
cmpl $0x5, %eax
jne 0xaef27
leaq 0x2bd38e(%rip), %rax    # 0x36c2b0
movb $0x5, (%rax)
jmp 0xaef31
leaq 0x2bd382(%rip), %rax    # 0x36c2b0
movb $0x63, (%rax)
jmp 0xaef33
jmp 0xaef35
jmp 0xaef37
jmp 0xaef39
jmp 0xaef3b
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xaef5a
callq 0x7a510
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xaef42
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xaef79
callq 0x7a510
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xaef61
movsd -0x18(%rbp), %xmm0
movsd 0xc2662(%rip), %xmm1    # 0x1715e8
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd 0xc0091(%rip), %xmm0    # 0x16f028
mulsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
leaq 0x2bc9eb(%rip), %rax    # 0x36b998
movsd %xmm0, (%rax)
leaq 0x2bd460(%rip), %rax    # 0x36c418
movl $0x11, (%rax)
movsd -0x20(%rbp), %xmm0
leaq 0x2bc9d6(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
leaq 0x2bd43f(%rip), %rax    # 0x36c414
movl $0x11, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)