// File: 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
subq $0x20, %rsp
leaq 0xb7758(%rip), %rdi     # 0x187e57
callq 0x7add0
leaq 0x29bcad(%rip), %rax    # 0x36c3b8
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xd0724
leaq 0x29bec8(%rip), %rax    # 0x36c5e4
movl $0x1, (%rax)
jmp 0xd0751
leaq 0x29bb85(%rip), %rax    # 0x36c2b0
movzbl (%rax), %eax
cmpl $0x7, %eax
jne 0xd0742
leaq 0x29beaa(%rip), %rax    # 0x36c5e4
movl $0x0, (%rax)
jmp 0xd074f
leaq 0x29be9b(%rip), %rax    # 0x36c5e4
movl $0x0, (%rax)
jmp 0xd0751
xorl %edi, %edi
callq 0xd0040
callq 0x7a560
movw %ax, -0x6(%rbp)
callq 0x7a560
callq 0x7a680
movl %eax, -0x4(%rbp)
cvtsi2ssl -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x9e8a9(%rip), %xmm1    # 0x16f028
divsd %xmm1, %xmm0
leaq 0x29c81e(%rip), %rax    # 0x36cfa8
movsd %xmm0, (%rax)
leaq 0x29bcff(%rip), %rax    # 0x36c494
movl $0x1, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x29c8a6(%rip), %rax    # 0x36d050
movl %ecx, (%rax)
callq 0x7a680
movl %eax, -0xc(%rbp)
callq 0x7a680
movl %eax, -0x10(%rbp)
callq 0x7a680
movl %eax, -0x14(%rbp)
callq 0x7a560
callq 0x7a560
callq 0x7a560
movw %ax, -0x16(%rbp)
callq 0x7a560
movzwl %ax, %eax
imull $0x32, %eax, %ecx
leaq 0x1a9abb(%rip), %rax    # 0x27a2a4
movl %ecx, (%rax)
cmpw $0x0, -0x16(%rbp)
je 0xd080e
leaq 0x1a9aa7(%rip), %rax    # 0x27a2a0
movl $0x0, (%rax)
leaq 0x1a9a9e(%rip), %rax    # 0x27a2a4
movl $0x0, (%rax)
jmp 0xd081b
leaq 0x1a9a8b(%rip), %rax    # 0x27a2a0
movl $0x1, (%rax)
leaq 0x29bd86(%rip), %rax    # 0x36c5a8
movl $0x1, (%rax)
callq 0x7a680
leaq 0x29bdb0(%rip), %rax    # 0x36c5e4
cmpl $0x0, (%rax)
je 0xd088d
cvtsi2sdl -0xc(%rbp), %xmm0
movsd 0xb2822(%rip), %xmm1    # 0x183068
mulsd %xmm1, %xmm0
leaq 0x29b95f(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0xb2806(%rip), %xmm1    # 0x183068
mulsd %xmm1, %xmm0
leaq 0x29b94b(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x9e8a2(%rip), %xmm1    # 0x16f120
mulsd %xmm1, %xmm0
leaq 0x29b937(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
callq 0xa0f60
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)