// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: request_self_tests(int)
void request_self_tests(int test)
{
   if(luxor) return;
   if(no_poll) return;
   if(read_only) return;

   if(rcvr_type == CS_RCVR) { 
      extend_com_timeout(0.0);
      set_cs_remote(1);
      queue_cs_cmd(":PTIM:STAN 1", CS_STANDBY_MSG);
      sprintf(out, "DIAG:TEST? %d", test);
      queue_cs_cmd(out, SCPI_TEST_MSG);
      restore_cs_remote();
      show_test_warning();
   }
   else if(rcvr_type == FURUNO_RCVR) {
      send_furuno_cmd("GPtrq,0");
   }
   else if(rcvr_type == MOTO_RCVR) {
      extend_com_timeout(0.0);
      send_moto_start("Ia");
      send_moto_end();

      send_moto_start("Fa");
      send_moto_end();

      send_moto_start("Ca");
      send_moto_end();
      show_test_warning();
   }
   else if(rcvr_type == NVS_RCVR) {
      extend_com_timeout(0.0);
      send_nvs_start(0x11);
      send_byte(0x00);
      send_nvs_end();
   }
   else if(rcvr_type == SCPI_RCVR) { 
      extend_com_timeout(0.0);
      queue_scpi_cmd("*TST?", SCPI_TEST_MSG);  // NORTEL_TYPE?
      show_test_warning();
   }
   else if(rcvr_type == SS_RCVR) {
      send_ss_start(51, 5);
      send_byte(1);
      send_ss_end();
   }
   else if(rcvr_type == TSIP_RCVR) {
      send_tsip_start(0x25);
      send_tsip_end();
      restart_gpsdo();
   }
   else if(rcvr_type == UCCM_RCVR) {  // not for UCCM? only UCCMP? uuuuuu
      extend_com_timeout(0.0);
      queue_uccm_cmd("*TST?", SCPI_TEST_MSG);
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      extend_com_timeout(0.0);
      send_zod_start(ZOD_REQ_DIAGS, 8, 0);
      send_zod_seq();
      send_word(0);
      send_zod_end();
      show_test_warning();

      Sleep(10000);
      restart_zodiac_rcvr();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x1d8f2a(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x661b4
leaq 0x2d0ffc(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x661b4
leaq 0x2d0fe6(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
jne 0x661b4
leaq 0x1b288c(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0xff, %rax
jle 0x660f2
cmpq $0x1ffff, %rax          # imm = 0x1FFFF
jle 0x6617a
movabsq $0x800000000, %rcx      # imm = 0x800000000
cmpq %rcx, %rax
je 0x661ff
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x662ba
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x661b4
movl %edi, %ebx
xorps %xmm0, %xmm0
callq 0x63ce2
movl $0x1, %edi
callq 0x63e3b
leaq 0xba853(%rip), %rdi     # 0x1208f8
movl $0x143, %esi            # imm = 0x143
callq 0x5edda
leaq 0x2d616a(%rip), %r14    # 0x33c220
leaq 0xba848(%rip), %rsi     # 0x120905
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
movl $0x19, %esi
callq 0x5edda
leaq 0x1b490f(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x661f2
xorl %edi, %edi
callq 0x63e3b
jmp 0x661f2
cmpq $0xf, %rax
jg 0x6612d
cmpq $0x1, %rax
je 0x661bd
cmpq $0x8, %rax
jne 0x661b4
xorps %xmm0, %xmm0
callq 0x63ce2
leaq 0xba62d(%rip), %rdi     # 0x120748
movl $0x19, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5edda
cmpq $0x10, %rax
je 0x661d9
cmpq $0x20, %rax
jne 0x661b4
xorps %xmm0, %xmm0
callq 0x63ce2
leaq 0xba7cf(%rip), %rdi     # 0x12091b
callq 0x6160d
callq 0x61688
leaq 0xba7c1(%rip), %rdi     # 0x12091e
callq 0x6160d
callq 0x61688
leaq 0xba7b3(%rip), %rdi     # 0x120921
callq 0x6160d
callq 0x61688
jmp 0x661f2
cmpq $0x100, %rax            # imm = 0x100
je 0x6624a
cmpq $0x800, %rax            # imm = 0x800
jne 0x661b4
xorps %xmm0, %xmm0
callq 0x63ce2
movl $0x11, %edi
callq 0x5e6be
xorl %edi, %edi
callq 0x590f7
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5e7c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x25, %edi
callq 0x5e6be
callq 0x5e73c
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x614df
xorps %xmm0, %xmm0
callq 0x63ce2
leaq 0xba560(%rip), %rdi     # 0x120748
movl $0x19, %esi
callq 0x5edda
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x662ce
movl $0x33, %edi
movl $0x5, %esi
callq 0x65608
movl $0x1, %edi
callq 0x590f7
movzwl 0x30689c(%rip), %r14d   # 0x36cabc
movl $0xff, %ebx
movl %r14d, %edi
andl %ebx, %edi
callq 0x590f7
addl %r14d, %ebx
testw %r14w, %r14w
cmovnsl %r14d, %ebx
movzbl %bh, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x590f7
xorps %xmm0, %xmm0
callq 0x63ce2
movl $0x514, %edi            # imm = 0x514
movl $0x8, %esi
xorl %edx, %edx
callq 0x646e6
callq 0x64869
movw $0x0, -0x12(%rbp)
leaq 0x1b255f(%rip), %rbx    # 0x2187d4
xorl %eax, %eax
cmpb $0x0, (%rbx)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%rbx)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
callq 0x648ab
callq 0x662ce
movl $0x2710, %edi           # imm = 0x2710
callq 0xafe8
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x6156d
leaq 0xba652(%rip), %rdi     # 0x120913
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5eff8