// File: 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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x21288c(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x8b89c
jmp 0x8bae1
leaq 0x30a95d(%rip), %rax    # 0x396200
cmpb $0x0, (%rax)
je 0x8b8ad
jmp 0x8bae1
leaq 0x30a946(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x8b8be
jmp 0x8bae1
leaq 0x1ec1eb(%rip), %rax    # 0x277ab0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0x8b929
xorps %xmm0, %xmm0
callq 0x88f10
movl $0x1, %edi
callq 0x89280
leaq 0xf8291(%rip), %rdi     # 0x183b78
movl $0x143, %esi            # imm = 0x143
callq 0x82fd0
movl -0x4(%rbp), %edx
leaq 0x30fb05(%rip), %rdi    # 0x39b400
leaq 0xf8283(%rip), %rsi     # 0x183b85
movb $0x0, %al
callq 0x9060
leaq 0x30faf0(%rip), %rdi    # 0x39b400
movl $0x19, %esi
callq 0x82fd0
callq 0x89260
callq 0x8baf0
jmp 0x8bae1
leaq 0x1ec180(%rip), %rax    # 0x277ab0
cmpq $0x20000000, (%rax)     # imm = 0x20000000
jne 0x8b94a
leaq 0xf8253(%rip), %rdi     # 0x183b93
callq 0x83270
jmp 0x8badf
leaq 0x1ec15f(%rip), %rax    # 0x277ab0
cmpq $0x20, (%rax)
jne 0x8b99c
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0xf8235(%rip), %rdi     # 0x183b9b
callq 0x86190
callq 0x86230
leaq 0xf8227(%rip), %rdi     # 0x183b9e
callq 0x86190
callq 0x86230
leaq 0xf8219(%rip), %rdi     # 0x183ba1
callq 0x86190
callq 0x86230
callq 0x8baf0
jmp 0x8badd
leaq 0x1ec10d(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x8b9cf
xorps %xmm0, %xmm0
callq 0x88f10
movl $0x11, %edi
callq 0x824f0
xorl %edi, %edi
callq 0x7b210
callq 0x82630
jmp 0x8badb
leaq 0x1ec0da(%rip), %rax    # 0x277ab0
cmpq $0x10, (%rax)
jne 0x8b9ff
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0xf7fdd(%rip), %rdi     # 0x1839c8
movl $0x19, %esi
callq 0x82fd0
callq 0x8baf0
jmp 0x8bad9
movabsq $0x800000000, %rcx      # imm = 0x800000000
leaq 0x1ec0a0(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x8ba38
movl $0x33, %edi
movl $0x5, %esi
callq 0x8ab80
movl $0x1, %edi
callq 0x7b210
callq 0x8ac40
jmp 0x8bad7
leaq 0x1ec071(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x8ba5b
movl $0x25, %edi
callq 0x824f0
callq 0x82590
callq 0x86040
jmp 0x8bad5
leaq 0x1ec04e(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0x8ba83
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0xf7f51(%rip), %rdi     # 0x1839c8
movl $0x19, %esi
callq 0x82fd0
jmp 0x8bad3
leaq 0x1ec026(%rip), %rax    # 0x277ab0
cmpq $0x100, (%rax)          # imm = 0x100
jne 0x8bad1
xorps %xmm0, %xmm0
callq 0x88f10
movl $0x514, %edi            # imm = 0x514
movl $0x8, %esi
xorl %edx, %edx
callq 0x89bf0
callq 0x89d10
xorl %edi, %edi
callq 0x7b4b0
callq 0x89d30
callq 0x8baf0
movl $0x2710, %edi           # imm = 0x2710
callq 0xb8b0
callq 0x860e0
jmp 0x8bad3
jmp 0x8bad5
jmp 0x8bad7
jmp 0x8bad9
jmp 0x8badb
jmp 0x8badd
jmp 0x8badf
jmp 0x8bae1
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)