// File: /workspace/github_cpp_makefile_star2_O3/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 0x8b8d6(%rip), %rdi     # 0x124b6b
callq 0x58dc2
leaq 0x273f37(%rip), %rax    # 0x30d1d8
movl (%rax), %eax
shrl $0x5, %eax
movl $0x1, %r13d
andl %r13d, %eax
leaq 0x27414e(%rip), %rcx    # 0x30d404
movl %eax, (%rcx)
callq 0x58964
callq 0x588d2
callq 0x588d2
callq 0x588d2
callq 0x58964
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x6fd47(%rip), %xmm0    # 0x109028
leaq 0x274ae0(%rip), %rax    # 0x30ddc8
movsd %xmm0, (%rax)
leaq 0x273fc1(%rip), %rax    # 0x30d2b4
movl %r13d, (%rax)
callq 0x588d2
movzwl %ax, %eax
leaq 0x274b6b(%rip), %rcx    # 0x30de70
movl %eax, (%rcx)
callq 0x58964
movl %eax, %r15d
callq 0x58964
movl %eax, %r14d
callq 0x58964
movl %eax, %ebx
callq 0x588d2
callq 0x588d2
callq 0x588d2
movl %eax, %r12d
callq 0x588d2
movzwl %ax, %eax
imull $0x32, %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
testw %r12w, %r12w
sete %dl
cmovel %eax, %ecx
leaq 0x181d74(%rip), %rax    # 0x21b0c4
movl %ecx, (%rax)
leaq 0x181d67(%rip), %rax    # 0x21b0c0
movl %edx, (%rax)
leaq 0x274066(%rip), %rax    # 0x30d3c8
movl %r13d, (%rax)
callq 0x58964
leaq 0x274093(%rip), %rax    # 0x30d404
cmpl $0x0, (%rax)
je 0x993c6
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd 0x85412(%rip), %xmm1    # 0x11e798
mulsd %xmm1, %xmm0
leaq 0x273c3f(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
leaq 0x273c30(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd 0x6fd45(%rip), %xmm0    # 0x109100
leaq 0x273c1e(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x75326