// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zod_posn()
void parse_zod_posn()
{
u16 flag1;
u16 type;
u16 used;
u16 flag2;
S32 val;

   log_packet_id("time / position");

   pps_enabled = pps_mode = 1;
   have_pps_enable = 5;
   have_pps_mode = 5;

   get_zod_seq(1);

   flag1 = tsip_word();
   type = tsip_word();
   used = tsip_word();
   flag2 = tsip_word();

   gps_week = tsip_word();
   faked_tow = 0;
   if(have_week == 0) need_redraw = 2038;
   have_week = 7;

   pri_tow = tow = this_tow = tsip_dword();
   if(have_tow == 0) need_redraw = 2039;
   have_tow = 7;
   survey_tow = tow;
   tsip_dword();  // tow nsecs

   pri_day = day = tsip_word();
   pri_month = month = tsip_word();
   pri_year = year = tsip_word();
   pri_hours = hours = tsip_word();
   pri_minutes = minutes = tsip_word();
   pri_seconds = seconds = tsip_word();
   pri_frac = raw_frac = ((double) tsip_dword()) * 1.0E-9;


   if(timing_mode == TMODE_GPS) {  // convert utc time to gps time
      utc_to_gps();
   }

   if(use_traim_lla == 0) {
      lat = ((double) (S32) tsip_dword()) * 1.0E-8;
      lon = ((double) (S32) tsip_dword()) * 1.0E-8;
      alt = ((double) (S32) tsip_dword()) * 1.0E-2;
   }
   else {
      tsip_dword();
      tsip_dword();
      tsip_dword();
   }

   tsip_word();   // geoid separation
   speed = ((double) tsip_dword()) / 100.0;  // speed
   heading = (((double)tsip_word()) / 1000.0) * 180.0 / PI; // course
   tsip_word();   // mvar 
   tsip_word();   // climb
   tsip_word();   // datum
   tsip_dword();  // horiz err
   tsip_dword();  // vert err
   tsip_dword();  // time err
   tsip_word();   // hv err
   val = tsip_dword();  // clock bias in meters
   tsip_dword();  // bias sdev
   tsip_dword();  // clock drift
   tsip_dword();  // clock drift sdev

   have_heading = 5;
   have_speed = 5;

   osc_offset = ((double) val) * 1.0E-2;  // clock bias (in meters)
   have_osc_offset = 4;
   have_rcvr_osc = 4;
osc_offset /= 299792458.0;  // convert meters to secs
osc_offset *= 1.0E9;        // convert secs to ns
//adadad   if(jitter_adev == 0) do_osc_adev(osc_offset);

// query_zod_msg(ZOD_TEMP_MSG);  // this does no good, current temp sensor reading is not sent by any message
   query_zod_msg(ZOD_TRAIM_CONFIG_MSG);  // to get dynamic lat/lon/alt values 
   update_gps_screen(1003);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xb73f2(%rip), %rdi     # 0x187e71
callq 0x7add0
leaq 0x29c477(%rip), %rax    # 0x36cf02
movb $0x1, (%rax)
leaq 0x29c46b(%rip), %rax    # 0x36cf00
movb $0x1, (%rax)
leaq 0x29ba1d(%rip), %rax    # 0x36c4bc
movl $0x5, (%rax)
leaq 0x29ba20(%rip), %rax    # 0x36c4cc
movl $0x5, (%rax)
movl $0x1, %edi
callq 0xd0040
callq 0x7a560
movw %ax, -0x2(%rbp)
callq 0x7a560
movw %ax, -0x4(%rbp)
callq 0x7a560
movw %ax, -0x6(%rbp)
callq 0x7a560
movw %ax, -0x8(%rbp)
callq 0x7a560
movw %ax, %cx
leaq 0x29be29(%rip), %rax    # 0x36c918
movw %cx, (%rax)
leaq 0x29be2f(%rip), %rax    # 0x36c928
movl $0x0, (%rax)
leaq 0x29ba06(%rip), %rax    # 0x36c50c
cmpl $0x0, (%rax)
jne 0xd0b18
leaq 0x1a6f12(%rip), %rax    # 0x277a24
movl $0x7f6, (%rax)          # imm = 0x7F6
leaq 0x29b9ed(%rip), %rax    # 0x36c50c
movl $0x7, (%rax)
callq 0x7a680
movl %eax, %ecx
leaq 0x29bded(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x29bde0(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x29bddf(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
leaq 0x29b9ba(%rip), %rax    # 0x36c508
cmpl $0x0, (%rax)
jne 0xd0b60
leaq 0x1a6eca(%rip), %rax    # 0x277a24
movl $0x7f7, (%rax)          # imm = 0x7F7
leaq 0x29b9a1(%rip), %rax    # 0x36c508
movl $0x7, (%rax)
leaq 0x29bda8(%rip), %rax    # 0x36c91c
movl (%rax), %eax
movl %eax, %ecx
leaq 0x29bdb1(%rip), %rax    # 0x36c930
movq %rcx, (%rax)
callq 0x7a680
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29bb1e(%rip), %rax    # 0x36c6b4
movl %ecx, (%rax)
leaq 0x29bb4d(%rip), %rax    # 0x36c6ec
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29bb08(%rip), %rax    # 0x36c6b8
movl %ecx, (%rax)
leaq 0x29bb37(%rip), %rax    # 0x36c6f0
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29baf2(%rip), %rax    # 0x36c6bc
movl %ecx, (%rax)
leaq 0x29bb21(%rip), %rax    # 0x36c6f4
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29bacc(%rip), %rax    # 0x36c6b0
movl %ecx, (%rax)
leaq 0x29bafb(%rip), %rax    # 0x36c6e8
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29baae(%rip), %rax    # 0x36c6ac
movl %ecx, (%rax)
leaq 0x29badd(%rip), %rax    # 0x36c6e4
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29ba90(%rip), %rax    # 0x36c6a8
movl %ecx, (%rax)
leaq 0x29babf(%rip), %rax    # 0x36c6e0
movl %ecx, (%rax)
callq 0x7a680
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x9e531(%rip), %xmm1    # 0x16f168
mulsd %xmm1, %xmm0
leaq 0x29ba7e(%rip), %rax    # 0x36c6c0
movsd %xmm0, (%rax)
leaq 0x29baab(%rip), %rax    # 0x36c6f8
movsd %xmm0, (%rax)
leaq 0x29ba45(%rip), %rax    # 0x36c69d
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xd0c65
callq 0x7fc70
leaq 0x29b978(%rip), %rax    # 0x36c5e4
cmpl $0x0, (%rax)
jne 0xd0cd3
callq 0x7a680
cvtsi2sd %eax, %xmm0
movsd 0xb23e6(%rip), %xmm1    # 0x183068
mulsd %xmm1, %xmm0
leaq 0x29b523(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
callq 0x7a680
cvtsi2sd %eax, %xmm0
movsd 0xb23c6(%rip), %xmm1    # 0x183068
mulsd %xmm1, %xmm0
leaq 0x29b50b(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
callq 0x7a680
cvtsi2sd %eax, %xmm0
movsd 0x9e45e(%rip), %xmm1    # 0x16f120
mulsd %xmm1, %xmm0
leaq 0x29b4f3(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
jmp 0xd0ce2
callq 0x7a680
callq 0x7a680
callq 0x7a680
callq 0x7a560
callq 0x7a680
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x9e355(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
leaq 0x29b4fa(%rip), %rax    # 0x36c200
movsd %xmm0, (%rax)
callq 0x7a560
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
movsd 0x9e312(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd 0x9e34e(%rip), %xmm1    # 0x16f078
mulsd %xmm1, %xmm0
movsd 0xa0892(%rip), %xmm1    # 0x1715c8
divsd %xmm1, %xmm0
leaq 0x29b4c7(%rip), %rax    # 0x36c208
movsd %xmm0, (%rax)
callq 0x7a560
callq 0x7a560
callq 0x7a560
callq 0x7a680
callq 0x7a680
callq 0x7a680
callq 0x7a560
callq 0x7a680
movl %eax, -0xc(%rbp)
callq 0x7a680
callq 0x7a680
callq 0x7a680
leaq 0x29b78e(%rip), %rax    # 0x36c514
movl $0x5, (%rax)
leaq 0x29b785(%rip), %rax    # 0x36c518
movl $0x5, (%rax)
cvtsi2sdl -0xc(%rbp), %xmm0
movsd 0x9e37a(%rip), %xmm1    # 0x16f120
mulsd %xmm1, %xmm0
leaq 0x29abef(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
leaq 0x29b658(%rip), %rax    # 0x36c414
movl $0x4, (%rax)
leaq 0x29b65f(%rip), %rax    # 0x36c428
movl $0x4, (%rax)
leaq 0x29abca(%rip), %rax    # 0x36b9a0
movsd (%rax), %xmm0
movsd 0xa0806(%rip), %xmm1    # 0x1715e8
divsd %xmm1, %xmm0
leaq 0x29abb3(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
movsd 0x9e22f(%rip), %xmm0    # 0x16f028
leaq 0x29aba0(%rip), %rax    # 0x36b9a0
mulsd (%rax), %xmm0
leaq 0x29ab95(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
movl $0x41f, %edi            # imm = 0x41F
callq 0x8b850
movl $0x3eb, %edi            # imm = 0x3EB
callq 0x9d790
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)