// File: /workspace/github_cpp_makefile_star2_O3/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 0x8b673(%rip), %rdi     # 0x124b85
callq 0x58dc2
leaq 0x274804(%rip), %rax    # 0x30dd22
movb $0x1, %cl
movb %cl, (%rax)
leaq 0x2747f7(%rip), %rax    # 0x30dd20
movb %cl, (%rax)
leaq 0x273daa(%rip), %rax    # 0x30d2dc
movl $0x5, %ecx
movl %ecx, (%rax)
leaq 0x273dac(%rip), %rax    # 0x30d2ec
movl %ecx, (%rax)
callq 0x58964
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x588d2
leaq 0x2741c7(%rip), %rcx    # 0x30d738
movw %ax, (%rcx)
leaq 0x2741cd(%rip), %rax    # 0x30d748
movl $0x0, (%rax)
leaq 0x273da4(%rip), %rax    # 0x30d32c
cmpl $0x0, (%rax)
jne 0x9959a
leaq 0x17f2b0(%rip), %rcx    # 0x218844
movl $0x7f6, (%rcx)          # imm = 0x7F6
movl $0x7, (%rax)
callq 0x58964
leaq 0x274194(%rip), %rcx    # 0x30d740
movl %eax, (%rcx)
leaq 0x274187(%rip), %rcx    # 0x30d73c
movl %eax, (%rcx)
leaq 0x274186(%rip), %rcx    # 0x30d744
movl %eax, (%rcx)
leaq 0x273d61(%rip), %rcx    # 0x30d328
cmpl $0x0, (%rcx)
jne 0x995d9
leaq 0x17f271(%rip), %rdx    # 0x218844
movl $0x7f7, (%rdx)          # imm = 0x7F7
movl $0x7, (%rcx)
movl %eax, %eax
leaq 0x274168(%rip), %rcx    # 0x30d750
movq %rax, (%rcx)
callq 0x58964
callq 0x588d2
movzwl %ax, %eax
leaq 0x273ed5(%rip), %rcx    # 0x30d4d4
movl %eax, (%rcx)
leaq 0x273f04(%rip), %rcx    # 0x30d50c
movl %eax, (%rcx)
callq 0x588d2
movzwl %ax, %eax
leaq 0x273ebf(%rip), %rcx    # 0x30d4d8
movl %eax, (%rcx)
leaq 0x273eee(%rip), %rcx    # 0x30d510
movl %eax, (%rcx)
callq 0x588d2
movzwl %ax, %eax
leaq 0x273ea9(%rip), %rcx    # 0x30d4dc
movl %eax, (%rcx)
leaq 0x273ed8(%rip), %rcx    # 0x30d514
movl %eax, (%rcx)
callq 0x588d2
movzwl %ax, %eax
leaq 0x273e83(%rip), %rcx    # 0x30d4d0
movl %eax, (%rcx)
leaq 0x273eb2(%rip), %rcx    # 0x30d508
movl %eax, (%rcx)
callq 0x588d2
movzwl %ax, %eax
leaq 0x273e65(%rip), %rcx    # 0x30d4cc
movl %eax, (%rcx)
leaq 0x273e94(%rip), %rcx    # 0x30d504
movl %eax, (%rcx)
callq 0x588d2
movzwl %ax, %eax
leaq 0x273e47(%rip), %rcx    # 0x30d4c8
movl %eax, (%rcx)
leaq 0x273e76(%rip), %rcx    # 0x30d500
movl %eax, (%rcx)
callq 0x58964
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x6faa8(%rip), %xmm0    # 0x109148
leaq 0x273e39(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
leaq 0x273e66(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x273e00(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
jne 0x996ec
leaq 0x27405f(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c7ed
leaq 0x273dc8(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x273ce6(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
leaq 0x273d11(%rip), %rax    # 0x30d404
movl (%rax), %ebx
callq 0x58964
testl %ebx, %ebx
je 0x9970a
callq 0x58964
callq 0x58964
jmp 0x99762
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8507f(%rip), %xmm0    # 0x11e798
leaq 0x2738b0(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
callq 0x58964
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x85060(%rip), %xmm0    # 0x11e798
leaq 0x273899(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
callq 0x58964
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x6f9a9(%rip), %xmm0    # 0x109100
leaq 0x273882(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x588d2
callq 0x58964
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x6f8e2(%rip), %xmm0    # 0x109060
leaq 0x27389b(%rip), %rax    # 0x30d020
movsd %xmm0, (%rax)
callq 0x588d2
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x6f898(%rip), %xmm0    # 0x109038
mulsd 0x72088(%rip), %xmm0    # 0x10b830
divsd 0x72078(%rip), %xmm0    # 0x10b828
leaq 0x273871(%rip), %rax    # 0x30d028
movsd %xmm0, (%rax)
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x58964
callq 0x58964
callq 0x58964
callq 0x588d2
callq 0x58964
movl %eax, %ebx
callq 0x58964
callq 0x58964
callq 0x58964
leaq 0x273b39(%rip), %rax    # 0x30d334
movl $0x5, %ecx
movl %ecx, (%rax)
leaq 0x273b2f(%rip), %rax    # 0x30d338
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd 0x6f8e8(%rip), %xmm0    # 0x109100
movl %ecx, (%rax)
leaq 0x273a13(%rip), %rax    # 0x30d234
movl $0x4, %ecx
movl %ecx, (%rax)
leaq 0x273a19(%rip), %rax    # 0x30d248
movl %ecx, (%rax)
divsd 0x72037(%rip), %xmm0    # 0x10b870
mulsd 0x6f7e7(%rip), %xmm0    # 0x109028
leaq 0x272f78(%rip), %rax    # 0x30c7c0
movsd %xmm0, (%rax)
movl $0x41f, %edi            # imm = 0x41F
movl $0x6, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x646e6
callq 0x648ab
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x730e8