// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_moto_En(int)
void parse_moto_En(int num_chans)
{
int i;
S32 sawtooth;
s16 accu;

   if(num_chans == 6)      log_packet_id("6-chan traim info");
   else if(num_chans == 8) log_packet_id("8-chan traim info");
   else                    log_packet_id("unkn-chans traim info");

   if((num_chans == 6) && have_moto_En) return;

   if(num_chans != moto_chans) {
      moto_chans = num_chans;
      config_msg_ofs();
   }

   tsip_byte();  // output rate
   traim_mode = tsip_byte();
   have_traim = 1;
   traim_threshold = tsip_word();
   pps_enabled = pps_mode = tsip_byte();  // 0=off, 1=always on,  2=on when tracking, 3=on when traim met
   have_pps_enable = 6;
   have_pps_mode = 6;

   tsip_byte();  // pps rate   // !!!!! have_pps_rate
   tsip_byte();
   tsip_byte();

   tsip_byte();  // next pps time
   tsip_byte();
   tsip_word();
   tsip_byte();
   tsip_byte();
   tsip_byte();

   tsip_byte();  // pps status (=0off, 1=enabled)
   tsip_byte();  // 0=sync to UTC  1=sync to GPS
   traim_status = tsip_byte();
   tsip_byte();

   accu = tsip_word();     // time accuracy
   sawtooth = tsip_byte(); // sawtooth
   if(sawtooth & 0x80) sawtooth |= (~(S32)0xFF);
   have_sawtooth = 1;

   dac_voltage = (float) sawtooth;
   pps_offset = (double) accu;
   have_pps_offset = 5;
   have_rcvr_pps = 5;
//adadad   if(jitter_adev == 0) do_pps_adev(pps_offset);

   for(i=0; i<num_chans; i++) {
      tsip_byte();  // prn
      tsip_dword(); // time fraction
   }
//sprintf(debug_text2, "En: thresh:%d tmode:%d tstat:%d  pps:%d  saw:%d  rate:%d   ", 
//traim_threshold,traim_mode,traim_status,pps_mode,sawtooth,pps_rate);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
cmpl $0x8, %edi
leaq 0x89671(%rip), %rax     # 0x124d0e
leaq 0x8967c(%rip), %rcx     # 0x124d20
cmoveq %rax, %rcx
cmpl $0x6, %edi
leaq 0x8964a(%rip), %rdi     # 0x124cfc
cmovneq %rcx, %rdi
callq 0x58e77
cmpl $0x6, %ebx
jne 0x9b6d0
leaq 0x271b4d(%rip), %rax    # 0x30d214
cmpl $0x0, (%rax)
jne 0x9b92d
leaq 0x17f94d(%rip), %rax    # 0x21b024
cmpl %ebx, (%rax)
je 0x9b6e2
movl %ebx, (%rax)
callq 0x47650
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b6f8
leaq 0x1a387b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b70e
leaq 0x1a3865(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x17f9a8(%rip), %rcx    # 0x21b0c0
movl %eax, (%rcx)
leaq 0x271ca7(%rip), %rax    # 0x30d3c8
movl $0x1, (%rax)
callq 0x588f0
movzwl %ax, %eax
leaq 0x17f98e(%rip), %rcx    # 0x21b0c4
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b74e
leaq 0x1a3825(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2725cd(%rip), %rcx    # 0x30dd22
movb %al, (%rcx)
leaq 0x2725c2(%rip), %rcx    # 0x30dd20
movb %al, (%rcx)
leaq 0x271b75(%rip), %rax    # 0x30d2dc
movl $0x6, %ecx
movl %ecx, (%rax)
leaq 0x271b77(%rip), %rax    # 0x30d2ec
movl %ecx, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b78d
leaq 0x1a37e6(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b7a3
leaq 0x1a37d0(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b7b9
leaq 0x1a37ba(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b7cf
leaq 0x1a37a4(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b7e5
leaq 0x1a378e(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588f0
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b800
leaq 0x1a3773(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b816
leaq 0x1a375d(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b82c
leaq 0x1a3747(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b842
leaq 0x1a3731(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b858
leaq 0x1a371b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b86e
leaq 0x1a3705(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
leaq 0x17f850(%rip), %rcx    # 0x21b0c8
movl %eax, (%rcx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b890
leaq 0x1a36e3(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x588f0
movl %eax, %r14d
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b8ae
leaq 0x1a36c5(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movsbl %al, %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl %eax, %ecx
cvtsi2ss %ecx, %xmm0
leaq 0x271afd(%rip), %rax    # 0x30d3c4
movl $0x1, (%rax)
cvtss2sd %xmm0, %xmm0
leaq 0x271128(%rip), %rax    # 0x30ca00
movsd %xmm0, (%rax)
movswl %r14w, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
leaq 0x270eca(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x27193f(%rip), %rax    # 0x30d238
movl $0x5, %ecx
movl %ecx, (%rax)
leaq 0x27193d(%rip), %rax    # 0x30d244
movl %ecx, (%rax)
testl %ebx, %ebx
jle 0x9b92d
leaq 0x1a365c(%rip), %r14    # 0x23ef70
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x9b924
orb $0x8, (%r14)
callq 0x589b0
decl %ebx
jne 0x9b914
popq %rbx
popq %r14
popq %rbp
retq