// File: jkingan[P]ladyheather/heathgps.cpp
// Function: stop_self_survey(int)
void stop_self_survey(int why)
{
// set_survey_params(0, 0, 0L);
// start_self_survey(0, 5);
   if(read_only) return;
   if(luxor) return;

if(0 && debug_file) fprintf(debug_file, "stop self survey:%d\n", why); //plugh

   if(rcvr_type == ESIP_RCVR) {
      set_lla(lat,lon,alt);
   }
   else if(rcvr_type == FURUNO_RCVR) {
      sprintf(out, "GPset,Z1");  // Z1=3D positioning
      minor_alarms &= (~MINOR_SURVEY);
      do_survey = 0;
      survey_length = 0;
      send_furuno_cmd("GPsrq");
   }
   else if(rcvr_type == MOTO_RCVR) {
      set_rcvr_mode(RCVR_MODE_HOLD);   // position hold mode
   }
   else if(rcvr_type == NVS_RCVR) {
      send_nvs_start(0x1D);
      send_byte(0x00);
      send_byte(0x01);
      send_nvs_end();
   }
   else if(rcvr_type == SCPI_RCVR) { 
if(debug_file) {
   fprintf(debug_file, "### stop survey\n");
   fflush(debug_file);
}
//    queue_scpi_cmd(":GPS:POS LAST", SCPI_POS_MSG);   // use old saved position
      extend_com_timeout(0.0);
      if(scpi_type == NORTEL_TYPE) {
         set_lla(lat,lon,alt);
         queue_scpi_cmd("GPS:POS:SURVEY:PROGRESS?", SCPI_PROGRESS_MSG);
      }
      else {
         queue_scpi_cmd(":GPS:POS SURV", SCPI_POS_MSG);   // use position calculated so far
         queue_scpi_cmd(":PTIM:GPS:POS:SURV:STAT?", SCPI_SURVEY_MSG);
      }
   }
   else if(rcvr_type == TM4_RCVR) {
      send_tm4_cmd("#07,1");
      set_lla(lat, lon, alt);
   }
   else if(rcvr_type == TRUE_RCVR) {
      set_lla(lat, lon, alt);
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(ACU_360 || ACU_GG || saw_icm || (res_t == RES_T_360)) {
         set_lla(lat,lon,alt);
      }
      else {
         set_rcvr_mode(RCVR_MODE_HOLD);
      }
   }
   else if(rcvr_type == UBX_RCVR) {  // zorky // go to position hold at current LLA
      set_ubx_config(2, lat,lon,alt);  
   }
   else if(rcvr_type == UCCM_RCVR) {  // go to position hold at current LLA
      set_lla(lat,lon,alt);
   }
   else if(rcvr_type == VENUS_RCVR) { 
      set_venus_survey(2, lat,lon,alt); // go to position hold at current LLA 
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      set_zod_config(5, 0.0,0.0,0.0, traim_threshold, 8);
   }
   else if(rcvr_type == ZYFER_RCVR) {
      set_lla(lat, lon, alt);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x2fb368(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x9ae9c
jmp 0x9b2fd
leaq 0x20327b(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x9aead
jmp 0x9b2fd
movl $0x80000000, %ecx       # imm = 0x80000000
leaq 0x1dcbf7(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x9aee9
leaq 0x2d12eb(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d12e8(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d12e5(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b2fd
leaq 0x1dcbc0(%rip), %rax    # 0x277ab0
cmpq $0x20000000, (%rax)     # imm = 0x20000000
jne 0x9af4f
leaq 0x300500(%rip), %rdi    # 0x39b400
leaq 0xe9238(%rip), %rsi     # 0x18413f
movb $0x0, %al
callq 0x9060
leaq 0x2d14a3(%rip), %rax    # 0x36c3b8
movl (%rax), %ecx
andl $-0x21, %ecx
leaq 0x2d1497(%rip), %rax    # 0x36c3b8
movl %ecx, (%rax)
leaq 0x2d212e(%rip), %rax    # 0x36d058
movq $0x0, (%rax)
leaq 0x2d2118(%rip), %rax    # 0x36d050
movl $0x0, (%rax)
leaq 0xe8e0c(%rip), %rdi     # 0x183d51
callq 0x83270
jmp 0x9b2fb
leaq 0x1dcb5a(%rip), %rax    # 0x277ab0
cmpq $0x20, (%rax)
jne 0x9af83
movl $0x7, %edi
movl $0xff, %edx
movss 0xd69ca(%rip), %xmm3    # 0x171938
movl %edx, %esi
movaps %xmm3, %xmm0
movaps %xmm3, %xmm1
movaps %xmm3, %xmm2
callq 0x805d0
jmp 0x9b2f9
leaq 0x1dcb26(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x9afb8
movl $0x1d, %edi
callq 0x824f0
xorl %edi, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
callq 0x82630
jmp 0x9b2f7
leaq 0x1dcaf1(%rip), %rax    # 0x277ab0
cmpq $0x10, (%rax)
jne 0x9b071
leaq 0x2025a0(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0x9affd
leaq 0x202593(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0xe9cc3(%rip), %rsi     # 0x184caa
movb $0x0, %al
callq 0x9550
leaq 0x20257b(%rip), %rax    # 0x29d570
movq (%rax), %rdi
callq 0x9430
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0x1df1b4(%rip), %rax    # 0x27a1c0
cmpl $0x4e, (%rax)
jne 0x9b04a
leaq 0x2d1198(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d1195(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d1192(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
leaq 0xe9bf3(%rip), %rdi     # 0x184c31
movl $0x12, %esi
callq 0x82fd0
jmp 0x9b06c
leaq 0xe9c6a(%rip), %rdi     # 0x184cbb
movl $0x1d, %esi
callq 0x82fd0
leaq 0xe994e(%rip), %rdi     # 0x1849b0
movl $0x13, %esi
callq 0x82fd0
jmp 0x9b2f5
movabsq $0x400000000, %rcx      # imm = 0x400000000
leaq 0x1dca2e(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x9b0be
leaq 0xe9135(%rip), %rdi     # 0x1841c3
callq 0x83490
leaq 0x2d1116(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d1113(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d1110(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b2f3
leaq 0x1dc9eb(%rip), %rax    # 0x277ab0
cmpq $0x200000, (%rax)       # imm = 0x200000
jne 0x9b0f9
leaq 0x2d10db(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d10d8(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d10d5(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b2f1
leaq 0x1dc9b0(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9b1ca
leaq 0x1dc99f(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9b13b
leaq 0x1df096(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9b13b
leaq 0x1dc9ae(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0x9b17b
leaq 0x1dc9a2(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0x9b17b
leaq 0x1dc96e(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9b160
leaq 0x1df065(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9b160
leaq 0x1dc97d(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0x9b17b
leaq 0x202fa6(%rip), %rax    # 0x29e10d
cmpb $0x0, (%rax)
jne 0x9b17b
leaq 0x1dc971(%rip), %rax    # 0x277ae4
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x9b1a3
leaq 0x2d102e(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d102b(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d1028(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b1c5
movl $0x7, %edi
movl $0xff, %edx
movss 0xd6783(%rip), %xmm3    # 0x171938
movl %edx, %esi
movaps %xmm3, %xmm0
movaps %xmm3, %xmm1
movaps %xmm3, %xmm2
callq 0x805d0
jmp 0x9b2ef
leaq 0x1dc8df(%rip), %rax    # 0x277ab0
cmpq $0x4, (%rax)
jne 0x9b207
leaq 0x2d0fd2(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d0fcf(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d0fcc(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
movl $0x2, %edi
callq 0x8e2f0
jmp 0x9b2ed
leaq 0x1dc8a2(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0x9b23f
leaq 0x2d0f95(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d0f92(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d0f8f(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b2eb
leaq 0x1dc86a(%rip), %rax    # 0x277ab0
cmpq $0x80, (%rax)
jne 0x9b27c
leaq 0x2d0f5a(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d0f57(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d0f54(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
movl $0x2, %edi
callq 0x8c850
jmp 0x9b2e9
leaq 0x1dc82d(%rip), %rax    # 0x277ab0
cmpq $0x100, (%rax)          # imm = 0x100
jne 0x9b2af
leaq 0x1df011(%rip), %rax    # 0x27a2a4
movl (%rax), %esi
movl $0x5, %edi
xorps %xmm2, %xmm2
movl $0x8, %edx
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x8e4f0
jmp 0x9b2e7
leaq 0x1dc7fa(%rip), %rax    # 0x277ab0
cmpq $0x100000, (%rax)       # imm = 0x100000
jne 0x9b2e5
leaq 0x2d0eea(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x2d0ee7(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm1
leaq 0x2d0ee4(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm2
callq 0x8d180
jmp 0x9b2e7
jmp 0x9b2e9
jmp 0x9b2eb
jmp 0x9b2ed
jmp 0x9b2ef
jmp 0x9b2f1
jmp 0x9b2f3
jmp 0x9b2f5
jmp 0x9b2f7
jmp 0x9b2f9
jmp 0x9b2fb
jmp 0x9b2fd
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)