// File: /workspace/github_cpp_makefile_star2_O2/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 0x83a76(%rip), %rdi     # 0x10eab3
callq 0x520bf
leaq 0x26c18f(%rip), %rax    # 0x2f71d8
movl (%rax), %eax
shrl $0x5, %eax
pushq $0x1
popq %r13
andl %r13d, %eax
leaq 0x26c3a8(%rip), %rcx    # 0x2f7404
movl %eax, (%rcx)
xorl %edi, %edi
callq 0x8ab27
callq 0x51c63
callq 0x51c63
callq 0x51cf3
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x67fa4(%rip), %xmm0    # 0xf3028
leaq 0x26cd3d(%rip), %rax    # 0x2f7dc8
movsd %xmm0, (%rax)
leaq 0x26c21e(%rip), %rax    # 0x2f72b4
movl %r13d, (%rax)
callq 0x51c63
movzwl %ax, %eax
leaq 0x26cdc8(%rip), %rcx    # 0x2f7e70
movl %eax, (%rcx)
callq 0x51cf3
movl %eax, %r15d
callq 0x51cf3
movl %eax, %r14d
callq 0x51cf3
movl %eax, %ebx
callq 0x51c63
callq 0x51c63
callq 0x51c63
movl %eax, %r12d
callq 0x51c63
movzwl %ax, %eax
imull $0x32, %eax, %eax
xorl %ecx, %ecx
testw %r12w, %r12w
sete %cl
movl $0x0, %edx
cmovnel %edx, %eax
leaq 0x179fce(%rip), %rdx    # 0x2050c4
movl %eax, (%rdx)
leaq 0x179fc1(%rip), %rax    # 0x2050c0
movl %ecx, (%rax)
leaq 0x26c2c0(%rip), %rax    # 0x2f73c8
movl %r13d, (%rax)
callq 0x51cf3
leaq 0x26c2ed(%rip), %rax    # 0x2f7404
cmpl $0x0, (%rax)
je 0x8b163
cvtsi2sd %r15d, %xmm0
movsd 0x7d5e7(%rip), %xmm1    # 0x108710
mulsd %xmm1, %xmm0
leaq 0x26be9c(%rip), %rax    # 0x2f6fd0
movsd %xmm0, (%rax)
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
leaq 0x26be90(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
cvtsi2sd %ebx, %xmm0
mulsd 0x67fa8(%rip), %xmm0    # 0xf3100
leaq 0x26be81(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6b202