// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zod_traim_config()
void parse_zod_traim_config()
{
S32 val;
u16 mode;
S32 slat;
S32 slon;
S32 salt;
u16 flag;

   log_packet_id("traim config");

   if(minor_alarms & MINOR_SURVEY) use_traim_lla = 1;
   else if(rcvr_mode == RCVR_MODE_HOLD) use_traim_lla = 0;
   else if(1) use_traim_lla = 0;
   else if(precision_survey) use_traim_lla = 2;
   else                      use_traim_lla = 3;
//use_traim_lla = 0;

   get_zod_seq(0);
   mode = tsip_word(); // rcvr mode
   tsip_word();        // power up in posn hold mode

   val = tsip_dword();
   cable_delay = ((float) val) / 1.0E9;
// if(have_cable_delay == 0) need_redraw = 2037;
   have_cable_delay = 1;

   survey_length = tsip_word();  // survey hours

   slat = tsip_dword();
   slon = tsip_dword();
   salt = tsip_dword();

   tsip_word();  // align to UTC

   tsip_word();  // traim alarm due to any time fault

   flag = tsip_word();  // traim disabled
   traim_threshold = tsip_word()*50;
   if(flag) {
      traim_mode = 0;
      traim_threshold = 0;
   }
   else traim_mode = 1;
   have_traim = 1;

   tsip_dword();  // reserved

   if(use_traim_lla) {
      lat = ((double) (S32) slat) * 1.0E-8;
      lon = ((double) (S32) slon) * 1.0E-8;
      alt = ((double) (S32) salt) * 1.0E-2;
//sprintf(debug_text2, "lla from traim");
   }

   show_cable_delay();
//sprintf(debug_text, "zod config %d: mode %d  traim threshold: %d  slat:%d", use_traim_lla, mode, traim_threshold, slat);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x8b902(%rip), %rdi     # 0x124a8b
callq 0x58e77
leaq 0x274043(%rip), %rax    # 0x30d1d8
movl (%rax), %eax
shrl $0x5, %eax
andl $0x1, %eax
leaq 0x274260(%rip), %r13    # 0x30d404
movl %eax, (%r13)
callq 0x589b0
callq 0x588f0
callq 0x588f0
callq 0x588f0
callq 0x589b0
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x6fe57(%rip), %xmm0    # 0x109028
leaq 0x274bf0(%rip), %rax    # 0x30ddc8
movsd %xmm0, (%rax)
leaq 0x2740d1(%rip), %rax    # 0x30d2b4
movl $0x1, (%rax)
callq 0x588f0
movzwl %ax, %eax
leaq 0x274c78(%rip), %rcx    # 0x30de70
movl %eax, (%rcx)
callq 0x589b0
movl %eax, %r15d
callq 0x589b0
movl %eax, %r14d
callq 0x589b0
movl %eax, %ebx
callq 0x588f0
callq 0x588f0
callq 0x588f0
movl %eax, %r12d
callq 0x588f0
movzwl %ax, %eax
imull $0x32, %eax, %ecx
leaq 0x181e8f(%rip), %rax    # 0x21b0c4
movl %ecx, (%rax)
testw %r12w, %r12w
je 0x9924c
leaq 0x181e7c(%rip), %rcx    # 0x21b0c0
xorl %edx, %edx
movl %edx, (%rcx)
movl %edx, (%rax)
jmp 0x99259
leaq 0x181e6d(%rip), %rax    # 0x21b0c0
movl $0x1, (%rax)
leaq 0x274168(%rip), %rax    # 0x30d3c8
movl $0x1, (%rax)
callq 0x589b0
cmpl $0x0, (%r13)
je 0x992c2
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd 0x85466(%rip), %xmm1    # 0x11e6e8
mulsd %xmm1, %xmm0
leaq 0x273d43(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
leaq 0x273d34(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd 0x6fe49(%rip), %xmm0    # 0x109100
leaq 0x273d22(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x754c4