// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %rbx
pushq %rax
leaq 0x2c59f5(%rip), %rax    # 0x33701a
leaq 0x1cd912(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x71639
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1a7290(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0xff, %rax
jle 0x716c6
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
jle 0x716ef
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jg 0x71769
cmpq $0x200000, %rax         # imm = 0x200000
je 0x71793
cmpq $0x20000000, %rax       # imm = 0x20000000
jne 0x71632
leaq 0x2caba2(%rip), %rax    # 0x33c220
leaq 0x29bb53(%rip), %rcx    # 0x30d1d8
andb $-0x21, (%rcx)
movabsq $0x315a2c7465735047, %rcx # imm = 0x315A2C7465735047
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
leaq 0x29c7d8(%rip), %rax    # 0x30de78
movq $0x0, (%rax)
leaq 0x29c7c2(%rip), %rax    # 0x30de70
movl $0x0, (%rax)
leaq 0xaf416(%rip), %rdi     # 0x120ad1
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5eff8
cmpq $0xf, %rax
jg 0x71718
cmpq $0x1, %rax
je 0x71807
cmpq $0x4, %rax
je 0x718fe
cmpq $0x8, %rax
je 0x71793
jmp 0x71632
cmpq $0x100, %rax            # imm = 0x100
je 0x717bf
cmpq $0x800, %rax            # imm = 0x800
je 0x717e1
cmpq $0x100000, %rax         # imm = 0x100000
je 0x71793
jmp 0x71632
cmpq $0x10, %rax
je 0x71889
cmpq $0x20, %rax
je 0x7185e
cmpq $0x80, %rax
jne 0x71632
leaq 0x29b891(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b88e(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b88b(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x66d89
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
je 0x71787
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x71793
jmp 0x71632
leaq 0xaf7b5(%rip), %rdi     # 0x120f43
callq 0x5f170
leaq 0x29b836(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b833(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b830(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x674dc
leaq 0x1a98fe(%rip), %rax    # 0x21b0c4
movl (%rax), %esi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movl $0x5, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x68563
movl $0x1d, %edi
callq 0x5e6be
xorl %edi, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5e7c0
leaq 0x1a97c6(%rip), %rax    # 0x21afd4
movl (%rax), %eax
leaq 0x1a70e1(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
cmpl $0x41, %eax
jne 0x71830
cmpl $0x33, %ecx
je 0x71793
cmpl $0x47, %ecx
je 0x71793
xorl $0x41, %eax
xorl $0x47, %ecx
orl %eax, %ecx
je 0x71793
leaq 0x1cd6e8(%rip), %rax    # 0x23ef2d
cmpb $0x0, (%rax)
jne 0x71793
leaq 0x1a70af(%rip), %rax    # 0x218904
cmpb $0x4, (%rax)
je 0x71793
movss 0x9b802(%rip), %xmm0    # 0x10d068
movl $0x7, %edi
movl $0xff, %esi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movl $0xff, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5cf59
leaq 0x1ccb00(%rip), %rbx    # 0x23e390
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x718b6
leaq 0xb017b(%rip), %rdi     # 0x121a1a
movl $0x10, %esi
movl $0x1, %edx
callq 0x9750
movq (%rbx), %rdi
callq 0x9420
xorps %xmm0, %xmm0
callq 0x63ce2
leaq 0x1a971b(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x7192f
leaq 0x29b6ff(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b6fc(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b6f9(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
callq 0x674dc
leaq 0xb00aa(%rip), %rdi     # 0x1219a1
movl $0x12, %esi
jmp 0x7194c
leaq 0x29b6cb(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b6c8(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b6c5(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x682ae
leaq 0xb00f5(%rip), %rdi     # 0x121a2b
movl $0x1d, %esi
callq 0x5edda
leaq 0xafdd9(%rip), %rdi     # 0x121720
movl $0x13, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda