// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_zod_config(int, double, double, double, unsigned int, int)
void set_zod_config(int mode, double slat,double slon,double salt, u32 traim, int why)
{
S32 val;
u16 pps_suppress;

//sprintf(debug_text2, "set zod config: %d", why);
   if(read_only) return;

   send_zod_start(ZOD_SET_CONFIG, 24, 0);
   send_zod_seq();

   send_word(mode);
   send_word(1);     // power up in posn hold mode
   send_dword((S32) (cable_delay*1.0E9));
   send_word((u16) do_survey);  // hours

   val = (S32) (slat * 1.0E8);    // lat lon alt
   send_dword(val);
   val = (S32) (slon * 1.0E8);
   send_dword(val);
   val = (S32) (salt * 1.0E2);
   send_dword(val);

   pps_suppress = 0;  // !!!! zorky set to 1 to suppress PPS pulses if traim error

   if(time_flags & TFLAGS_UTC) send_word(0x0000 | pps_suppress);  // align to UTC
   else                        send_word(0x0002 | pps_suppress);  // align to GPS

   send_word(0x0007);  // traim alarm due to any time fault

   if(traim == 0) send_word(1);  // traim disabled
   else           send_word(0);  // traim enabled
   send_word(traim/50);

   send_dword(0);  // reserved

   send_zod_end();

   Sleep(200);  // zorky
   query_zod_msg(ZOD_TRAIM_CONFIG_MSG);
}

// Assembly:
leaq 0x2ceab0(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x68570
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebx
movl %edi, %r14d
movl $0x4e7, %edi            # imm = 0x4E7
movl $0x18, %esi
xorl %edx, %edx
movsd %xmm2, -0x30(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm0, -0x20(%rbp)
callq 0x646e6
callq 0x64869
movw %r14w, -0x12(%rbp)
leaq 0x1b0223(%rip), %r14    # 0x2187d4
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
movw $0x1, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
leaq 0x2a57be(%rip), %rax    # 0x30ddc8
movsd (%rax), %xmm0
mulsd 0xa0a12(%rip), %xmm0    # 0x109028
cvttsd2si %xmm0, %edi
callq 0x592eb
leaq 0x2a5852(%rip), %rax    # 0x30de78
movzwl (%rax), %eax
movw %ax, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
movsd -0x20(%rbp), %xmm0
mulsd 0xb5b68(%rip), %xmm0    # 0x11e1c8
cvttsd2si %xmm0, %edi
callq 0x592eb
movsd -0x28(%rbp), %xmm0
mulsd 0xb5b52(%rip), %xmm0    # 0x11e1c8
cvttsd2si %xmm0, %edi
callq 0x592eb
movsd -0x30(%rbp), %xmm0
mulsd 0xa09d4(%rip), %xmm0    # 0x109060
cvttsd2si %xmm0, %edi
callq 0x592eb
leaq 0x2a4e08(%rip), %rax    # 0x30d4a4
testb $0x1, (%rax)
jne 0x686a9
movw $0x2, -0x12(%rbp)
jmp 0x686af
movw $0x0, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
movw $0x7, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
testl %ebx, %ebx
je 0x6870d
movw $0x0, -0x12(%rbp)
jmp 0x68713
movw $0x1, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
movl %ebx, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x24, %rax
movw %ax, -0x12(%rbp)
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %edi, %edi
callq 0x592eb
callq 0x648ab
movl $0xc8, %edi
callq 0xafe8
movl $0x41f, %edi            # imm = 0x41F
movl $0x6, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x646e6
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x648ab