// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: set_filter_config(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, int)
void set_filter_config(u08 pv, u08 stat, u08 alt, u08 kalman, u08 marine, int save)
{
u08 val;

   if(read_only) return;
   if(luxor) return;

   if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) return;
      if(ACU_360) return;
      if(ACUTIME) return;
      if(PALISADE) return;

      if(SV6_FAMILY) {
         set_alt_filter(alt);
         set_posn_filter(stat, pv);
      }
      else {
         send_tsip_start(0x70);
         send_byte(pv);
         send_byte(stat);
         send_byte(alt);
         send_byte(kalman); // rsvd on ThunderBolt,  kalman on ThunderBolt-E
         send_tsip_end();
         if(0 && save) save_segment(255, 20);
      }
   }
   else if(1 && (rcvr_type == MOTO_RCVR)) { // marine velocity filter - !!!! code in heathui.cpp will need to be changed to do this
      if((marine >= 10) && (marine <= 100)) {
         send_moto_start("AN");
         send_byte(marine);
         send_moto_end();
      }

      send_moto_start("AQ");
      send_byte(pv);
      send_moto_end();

      val = 0x00;
      if(stat) val |= 0x01;
      if(alt) val |= 0x02;
      send_moto_start("Aq");
      send_byte(val);
      send_moto_end();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r12d
leaq 0x2cd2fa(%rip), %rax    # 0x33701a
leaq 0x1d5217(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
jne 0x69d9a
movl %edx, %ebx
movl %esi, %r14d
movl %edi, %r15d
leaq 0x1aeb94(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x20, %rax
je 0x69da9
cmpq $0x1, %rax
jne 0x69d9a
leaq 0x1b1282(%rip), %rcx    # 0x21afd4
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x41, %esi
leaq 0x1aeb98(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
movl %edx, %edi
xorl $0x47, %edi
orl %esi, %edi
je 0x69d9a
cmpl $0x41, %ecx
jne 0x69d7a
cmpl $0x33, %edx
je 0x69d9a
cmpl $0x47, %edx
je 0x69d9a
cmpl $0x41, %ecx
sete %dl
cmpl $0x50, %ecx
sete %sil
cmpq $0x1, %rax
jne 0x69e22
orb %sil, %dl
je 0x69e22
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r8d, %r13d
leal -0xa(%r13), %eax
cmpb $0x5a, %al
ja 0x69dce
leaq 0xba412(%rip), %rdi     # 0x1241cd
callq 0x61694
movzbl %r13b, %edi
callq 0x591af
callq 0x6170f
leaq 0xb6ed1(%rip), %rdi     # 0x120ca6
callq 0x61694
movzbl %r15b, %edi
callq 0x591af
callq 0x6170f
xorl %eax, %eax
testb %r14b, %r14b
setne %al
leal 0x2(%rax), %ecx
testb %bl, %bl
movzbl %cl, %ebx
cmovel %eax, %ebx
leaq 0xb6ea7(%rip), %rdi     # 0x120ca9
callq 0x61694
movzbl %bl, %edi
callq 0x591af
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6170f
cmpq $0x1, %rax
jne 0x69e5d
addl $-0x33, %ecx
cmpl $0x1d, %ecx
ja 0x69e5d
movl $0x20004009, %eax       # imm = 0x20004009
btl %ecx, %eax
jae 0x69e5d
movzbl %bl, %edi
callq 0x69e9d
movzbl %r14b, %edi
movzbl %r15b, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x69c14
movl $0x70, %edi
callq 0x5e740
movzbl %r15b, %edi
callq 0x591af
movzbl %r14b, %edi
callq 0x591af
movzbl %bl, %edi
callq 0x591af
movzbl %r12b, %edi
callq 0x591af
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e7c0