// File: /workspace/github_cpp_makefile_star2_O2/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 0x2b926d(%rip), %rax    # 0x32101a
leaq 0x1c118a(%rip), %rcx    # 0x228f3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x67dc1
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x19ab08(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x1, %rax
je 0x67f27
cmpq $0x4, %rax
je 0x67e57
cmpq $0x8, %rax
je 0x67e92
cmpq $0x10, %rax
je 0x67fc9
cmpq $0x20, %rax
je 0x67f7e
cmpq $0x80, %rax
je 0x68037
cmpq $0x100, %rax            # imm = 0x100
je 0x67f07
cmpq $0x800, %rax            # imm = 0x800
je 0x67fa7
cmpq $0x100000, %rax         # imm = 0x100000
je 0x67e92
cmpq $0x200000, %rax         # imm = 0x200000
je 0x67e92
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x67ebe
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
je 0x67e86
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x67e92
jmp 0x67dba
leaq 0x28f172(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
leaq 0x28f16f(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
leaq 0x28f16c(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm2
pushq $0x2
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f939
leaq 0xa2ffe(%rip), %rdi     # 0x10ae8b
callq 0x57a21
leaq 0x28f137(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
leaq 0x28f134(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
leaq 0x28f131(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm2
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5ec70
leaq 0x2be35b(%rip), %rax    # 0x326220
leaq 0x28f30c(%rip), %rcx    # 0x2f71d8
andb $-0x21, (%rcx)
leaq 0x28ffa2(%rip), %rcx    # 0x2f7e78
andq $0x0, (%rcx)
leaq 0x28ff8f(%rip), %rcx    # 0x2f7e70
andl $0x0, (%rcx)
movabsq $0x315a2c7465735047, %rcx # imm = 0x315A2C7465735047
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
leaq 0xa2b1d(%rip), %rdi     # 0x10aa19
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x578d5
leaq 0x19d1b6(%rip), %rax    # 0x2050c4
movl (%rax), %esi
pushq $0x5
popq %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5faee
leaq 0x19d0a6(%rip), %rax    # 0x204fd4
movl (%rax), %eax
leaq 0x19a9c1(%rip), %rcx    # 0x2028f8
movl (%rcx), %ecx
cmpl $0x41, %eax
jne 0x67f50
cmpl $0x33, %ecx
je 0x67e92
cmpl $0x47, %ecx
je 0x67e92
xorl $0x41, %eax
xorl $0x47, %ecx
orl %eax, %ecx
je 0x67e92
leaq 0x1c0fc8(%rip), %rax    # 0x228f2d
cmpb $0x0, (%rax)
jne 0x67e92
leaq 0x19a98f(%rip), %rax    # 0x202904
cmpb $0x4, (%rax)
je 0x67e92
pushq $0x7
popq %rdi
movss 0x8f15f(%rip), %xmm0    # 0xf70e8
movl $0xff, %esi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movl $0xff, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x55b65
pushq $0x1d
popq %rdi
callq 0x5707f
xorl %edi, %edi
callq 0x523f2
pushq $0x1
popq %rdi
callq 0x523f2
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x57171
leaq 0x1c03c0(%rip), %rbx    # 0x228390
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x67ff2
leaq 0xa3983(%rip), %rdi     # 0x10b962
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x9750
movq (%rbx), %rdi
callq 0x9420
xorps %xmm0, %xmm0
callq 0x5bd83
leaq 0x19cfdf(%rip), %rax    # 0x204fe0
cmpl $0x4e, (%rax)
jne 0x68066
leaq 0x28efc3(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
leaq 0x28efc0(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
leaq 0x28efbd(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm2
callq 0x5ec70
leaq 0xa38b6(%rip), %rdi     # 0x10b8e9
pushq $0x12
jmp 0x6807e
leaq 0x28ef92(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm0
leaq 0x28ef8f(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
leaq 0x28ef8c(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm2
pushq $0x2
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5e5b2
leaq 0xa3906(%rip), %rdi     # 0x10b973
pushq $0x1d
popq %rsi
callq 0x576d4
leaq 0xa35ec(%rip), %rdi     # 0x10b668
pushq $0x13
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x576d4