// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rbx
pushq %rax
leaq 0x8b697(%rip), %rdi     # 0x124aa5
callq 0x58e77
leaq 0x274908(%rip), %rax    # 0x30dd22
movb $0x1, %cl
movb %cl, (%rax)
leaq 0x2748fb(%rip), %rax    # 0x30dd20
movb %cl, (%rax)
leaq 0x273eae(%rip), %rax    # 0x30d2dc
movl $0x5, %ecx
movl %ecx, (%rax)
leaq 0x273eb0(%rip), %rax    # 0x30d2ec
movl %ecx, (%rax)
callq 0x589b0
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x588f0
leaq 0x2742cb(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x2742d1(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
leaq 0x273ea8(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0x99496
leaq 0x17f3b4(%rip), %rcx    # 0x218844
movl $0x7f6, (%rcx)          # imm = 0x7F6
movl $0x7, (%rax)
callq 0x589b0
leaq 0x274298(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x27428b(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x27428a(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x273e65(%rip), %rcx    # 0x30d328
cmpl $0x0, (%rcx)
jne 0x994d5
leaq 0x17f375(%rip), %rdx    # 0x218844
movl $0x7f7, (%rdx)          # imm = 0x7F7
movl $0x7, (%rcx)
movl %eax, %eax
leaq 0x27426c(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
callq 0x589b0
callq 0x588f0
movzwl %ax, %eax
leaq 0x273fd9(%rip), %rcx    # 0x30d4d4
movl %eax, (%rcx)
leaq 0x274008(%rip), %rcx    # 0x30d50c
movl %eax, (%rcx)
callq 0x588f0
movzwl %ax, %eax
leaq 0x273fc3(%rip), %rcx    # 0x30d4d8
movl %eax, (%rcx)
leaq 0x273ff2(%rip), %rcx    # 0x30d510
movl %eax, (%rcx)
callq 0x588f0
movzwl %ax, %eax
leaq 0x273fad(%rip), %rcx    # 0x30d4dc
movl %eax, (%rcx)
leaq 0x273fdc(%rip), %rcx    # 0x30d514
movl %eax, (%rcx)
callq 0x588f0
movzwl %ax, %eax
leaq 0x273f87(%rip), %rcx    # 0x30d4d0
movl %eax, (%rcx)
leaq 0x273fb6(%rip), %rcx    # 0x30d508
movl %eax, (%rcx)
callq 0x588f0
movzwl %ax, %eax
leaq 0x273f69(%rip), %rcx    # 0x30d4cc
movl %eax, (%rcx)
leaq 0x273f98(%rip), %rcx    # 0x30d504
movl %eax, (%rcx)
callq 0x588f0
movzwl %ax, %eax
leaq 0x273f4b(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x273f7a(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
callq 0x589b0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x84c54(%rip), %xmm0    # 0x11e1f0
leaq 0x273f3d(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x273f6a(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x273f04(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
jne 0x995e8
leaq 0x274163(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c907
leaq 0x273ecc(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x273dea(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
leaq 0x273e15(%rip), %rax    # 0x30d404
movl (%rax), %ebx
callq 0x589b0
testl %ebx, %ebx
je 0x99606
callq 0x589b0
callq 0x589b0
jmp 0x9965e
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x850d3(%rip), %xmm0    # 0x11e6e8
leaq 0x2739b4(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x850b4(%rip), %xmm0    # 0x11e6e8
leaq 0x27399d(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x589b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x6faad(%rip), %xmm0    # 0x109100
leaq 0x273986(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x588f0
callq 0x589b0
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x6f9e6(%rip), %xmm0    # 0x109060
leaq 0x27399f(%rip), %rax    # 0x30d020
movsd %xmm0, (%rax)
callq 0x588f0
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x6f99c(%rip), %xmm0    # 0x109038
mulsd 0x7217c(%rip), %xmm0    # 0x10b820
divsd 0x7216c(%rip), %xmm0    # 0x10b818
leaq 0x273975(%rip), %rax    # 0x30d028
movsd %xmm0, (%rax)
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x589b0
callq 0x589b0
callq 0x589b0
callq 0x588f0
callq 0x589b0
movl %eax, %ebx
callq 0x589b0
callq 0x589b0
callq 0x589b0
leaq 0x273c3d(%rip), %rax    # 0x30d334
movl $0x5, %ecx
movl %ecx, (%rax)
leaq 0x273c33(%rip), %rax    # 0x30d338
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd 0x6f9ec(%rip), %xmm0    # 0x109100
movl %ecx, (%rax)
leaq 0x2730a3(%rip), %rax    # 0x30c7c0
leaq 0x273b10(%rip), %rcx    # 0x30d234
movl $0x4, %edx
movl %edx, (%rcx)
leaq 0x273b16(%rip), %rcx    # 0x30d248
divsd 0x72126(%rip), %xmm0    # 0x10b860
movl %edx, (%rcx)
mulsd 0x6f8e4(%rip), %xmm0    # 0x109028
movsd %xmm0, (%rax)
movl $0x41f, %edi            # imm = 0x41F
movl $0x6, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x645ec
callq 0x646c7
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x7327e