// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
leaq 0x83824(%rip), %rdi     # 0x10eacd
callq 0x520bf
leaq 0x26ca6d(%rip), %rax    # 0x2f7d22
movb $0x1, %cl
movb %cl, (%rax)
leaq 0x26ca60(%rip), %rax    # 0x2f7d20
movb %cl, (%rax)
leaq 0x26c013(%rip), %rax    # 0x2f72dc
pushq $0x5
popq %r14
movl %r14d, (%rax)
leaq 0x26c015(%rip), %rax    # 0x2f72ec
movl %r14d, (%rax)
pushq $0x1
popq %rdi
callq 0x8ab27
callq 0x51c63
callq 0x51c63
callq 0x51c63
callq 0x51c63
callq 0x51c63
leaq 0x26c436(%rip), %rcx    # 0x2f7738
leaq 0x26c43f(%rip), %rdx    # 0x2f7748
andl $0x0, (%rdx)
movw %ax, (%rcx)
leaq 0x26c016(%rip), %rax    # 0x2f732c
cmpl $0x0, (%rax)
jne 0x8b328
leaq 0x177522(%rip), %rcx    # 0x202844
movl $0x7f6, (%rcx)          # imm = 0x7F6
movl $0x7, (%rax)
callq 0x51cf3
leaq 0x26c406(%rip), %rcx    # 0x2f7740
movl %eax, (%rcx)
leaq 0x26c3f9(%rip), %rcx    # 0x2f773c
movl %eax, (%rcx)
leaq 0x26c3f8(%rip), %rcx    # 0x2f7744
movl %eax, (%rcx)
leaq 0x26bfd3(%rip), %rcx    # 0x2f7328
cmpl $0x0, (%rcx)
jne 0x8b367
leaq 0x1774e3(%rip), %rdx    # 0x202844
movl $0x7f7, (%rdx)          # imm = 0x7F7
movl $0x7, (%rcx)
movl %eax, %eax
leaq 0x26c3da(%rip), %rcx    # 0x2f7750
movq %rax, (%rcx)
callq 0x51cf3
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c147(%rip), %rcx    # 0x2f74d4
movl %eax, (%rcx)
leaq 0x26c176(%rip), %rcx    # 0x2f750c
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c131(%rip), %rcx    # 0x2f74d8
movl %eax, (%rcx)
leaq 0x26c160(%rip), %rcx    # 0x2f7510
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c11b(%rip), %rcx    # 0x2f74dc
movl %eax, (%rcx)
leaq 0x26c14a(%rip), %rcx    # 0x2f7514
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c0f5(%rip), %rcx    # 0x2f74d0
movl %eax, (%rcx)
leaq 0x26c124(%rip), %rcx    # 0x2f7508
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c0d7(%rip), %rcx    # 0x2f74cc
movl %eax, (%rcx)
leaq 0x26c106(%rip), %rcx    # 0x2f7504
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26c0b9(%rip), %rcx    # 0x2f74c8
movl %eax, (%rcx)
leaq 0x26c0e8(%rip), %rcx    # 0x2f7500
movl %eax, (%rcx)
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x67d1a(%rip), %xmm0    # 0xf3148
leaq 0x26c0ab(%rip), %rax    # 0x2f74e0
movsd %xmm0, (%rax)
leaq 0x26c0d8(%rip), %rax    # 0x2f7518
movsd %xmm0, (%rax)
leaq 0x26c072(%rip), %rax    # 0x2f74bd
cmpb $0x0, (%rax)
jne 0x8b455
callq 0x554d3
leaq 0x26bfa8(%rip), %rax    # 0x2f7404
movl (%rax), %ebx
callq 0x51cf3
testl %ebx, %ebx
je 0x8b473
callq 0x51cf3
callq 0x51cf3
jmp 0x8b4c2
cvtsi2sd %eax, %xmm0
mulsd 0x7d291(%rip), %xmm0    # 0x108710
leaq 0x26bb4a(%rip), %rax    # 0x2f6fd0
movsd %xmm0, (%rax)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
mulsd 0x7d275(%rip), %xmm0    # 0x108710
leaq 0x26bb36(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
callq 0x51cf3
cvtsi2sd %eax, %xmm0
mulsd 0x67c49(%rip), %xmm0    # 0xf3100
leaq 0x26bb22(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
callq 0x51c63
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
divsd 0x67b85(%rip), %xmm0    # 0xf3060
leaq 0x26bb3e(%rip), %rax    # 0x2f7020
movsd %xmm0, (%rax)
callq 0x51c63
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x67b3e(%rip), %xmm0    # 0xf3038
mulsd 0x6a3a6(%rip), %xmm0    # 0xf58a8
divsd 0x6a396(%rip), %xmm0    # 0xf58a0
leaq 0x26bb17(%rip), %rax    # 0x2f7028
movsd %xmm0, (%rax)
callq 0x51c63
callq 0x51c63
callq 0x51c63
callq 0x51cf3
callq 0x51cf3
callq 0x51cf3
callq 0x51c63
callq 0x51cf3
movl %eax, %ebx
callq 0x51cf3
callq 0x51cf3
callq 0x51cf3
leaq 0x26bddf(%rip), %rax    # 0x2f7334
movl %r14d, (%rax)
leaq 0x26bdd9(%rip), %rax    # 0x2f7338
cvtsi2sd %ebx, %xmm0
mulsd 0x67b95(%rip), %xmm0    # 0xf3100
movl %r14d, (%rax)
leaq 0x26bcbf(%rip), %rax    # 0x2f7234
pushq $0x4
popq %rcx
movl %ecx, (%rax)
leaq 0x26bcc7(%rip), %rax    # 0x2f7248
movl %ecx, (%rax)
divsd 0x6a35d(%rip), %xmm0    # 0xf58e8
mulsd 0x67a95(%rip), %xmm0    # 0xf3028
leaq 0x26b226(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
movl $0x41f, %edi            # imm = 0x41F
callq 0x5dabd
popq %rbx
popq %r14
popq %rbp
jmp 0x694f6