// File: /workspace/github_cpp_makefile_star2_O1/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 0x2c5a1f(%rip), %rax    # 0x33701a
leaq 0x1cd93c(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x7160f
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1a72ba(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0xff, %rax
jle 0x7169c
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
jle 0x716c5
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jg 0x7173f
cmpq $0x200000, %rax         # imm = 0x200000
je 0x71769
cmpq $0x20000000, %rax       # imm = 0x20000000
jne 0x71608
leaq 0x2cabcc(%rip), %rax    # 0x33c220
leaq 0x29bb7d(%rip), %rcx    # 0x30d1d8
andb $-0x21, (%rcx)
movabsq $0x315a2c7465735047, %rcx # imm = 0x315A2C7465735047
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
leaq 0x29c802(%rip), %rax    # 0x30de78
movq $0x0, (%rax)
leaq 0x29c7ec(%rip), %rax    # 0x30de70
movl $0x0, (%rax)
leaq 0xaf360(%rip), %rdi     # 0x1209f1
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f070
cmpq $0xf, %rax
jg 0x716ee
cmpq $0x1, %rax
je 0x717dd
cmpq $0x4, %rax
je 0x718ea
cmpq $0x8, %rax
je 0x71769
jmp 0x71608
cmpq $0x100, %rax            # imm = 0x100
je 0x71795
cmpq $0x800, %rax            # imm = 0x800
je 0x717b7
cmpq $0x100000, %rax         # imm = 0x100000
je 0x71769
jmp 0x71608
cmpq $0x10, %rax
je 0x71875
cmpq $0x20, %rax
je 0x7184a
cmpq $0x80, %rax
jne 0x71608
leaq 0x29b8bb(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b8b8(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b8b5(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x66bf6
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
je 0x7175d
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x71769
jmp 0x71608
leaq 0xaf6ff(%rip), %rdi     # 0x120e63
callq 0x5f1e8
leaq 0x29b860(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b85d(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b85a(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x67349
leaq 0x1a9928(%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 0x683cd
movl $0x1d, %edi
callq 0x5e740
xorl %edi, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5e844
leaq 0x1a97f0(%rip), %rcx    # 0x21afd4
movl (%rcx), %ecx
cmpl $0x41, %ecx
jne 0x71806
leaq 0x1a7106(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
cmpl $0x33, %edx
je 0x71769
cmpl $0x47, %edx
je 0x71769
cmpl $0x41, %ecx
sete %cl
cmpq $0x1, %rax
sete %al
andb %cl, %al
leaq 0x1a70dc(%rip), %rcx    # 0x2188f8
cmpl $0x47, (%rcx)
sete %cl
testb %cl, %al
jne 0x71769
leaq 0x1cd6fc(%rip), %rax    # 0x23ef2d
cmpb $0x0, (%rax)
jne 0x71769
leaq 0x1a70c3(%rip), %rax    # 0x218904
cmpb $0x4, (%rax)
je 0x71769
movss 0x9b77e(%rip), %xmm0    # 0x10cfd0
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 0x5d081
leaq 0x1ccb14(%rip), %rbx    # 0x23e390
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x718a2
leaq 0xb00af(%rip), %rdi     # 0x12193a
movl $0x10, %esi
movl $0x1, %edx
callq 0x9750
movq (%rbx), %rdi
callq 0x9420
xorps %xmm0, %xmm0
callq 0x63c5c
leaq 0x1a972f(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x7191b
leaq 0x29b713(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b710(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b70d(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
callq 0x67349
leaq 0xaffde(%rip), %rdi     # 0x1218c1
movl $0x12, %esi
jmp 0x71938
leaq 0x29b6df(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x29b6dc(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x29b6d9(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6811b
leaq 0xb0029(%rip), %rdi     # 0x12194b
movl $0x1d, %esi
callq 0x5ee52
leaq 0xafd0d(%rip), %rdi     # 0x121640
movl $0x13, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5ee52