// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: set_lla(double, double, double)
void set_lla(double slat, double slon, double salt)
{
S32 v1,v2,v3;
char c;
char ns,ew;
double x;
int deg,mins;
double xmins;
double secs;
char lats[256];
char lons[256];
char alts[256];

// sprintf(debug_text2, "set lla:%.9lf %.9lf %.9lf", slat*180.0/PI, slon*180.0/PI, salt);

   if(read_only) return;

   need_posns = 1;
   need_sunrise = 1;
   if(luxor) {
      lat = slat;
      lon = slon;
      alt = salt;
   }
   else if((NO_SATS || (rcvr_type == ACRON_RCVR)) && (rcvr_type != TIDE_RCVR)) {
      lat = slat;
      lon = slon;
      alt = salt;
   }
   else if(rcvr_type == ESIP_RCVR) {
      slat = slat * 180.0 / PI;
      slon = slon * 180.0 / PI;
      sprintf(out, "PERDAPI,SURVEY,3,0,0,%.7f,%.7f,%d", slat,slon,(int)salt);
      send_esip_cmd(out);
   }
   else if(rcvr_type == FURUNO_RCVR) {
      x = salt - (double) (int) salt;
      if(salt < 0.0) {
         salt = 0.0-salt;
         deg = ((int) (x*10.0) % 10);
         sprintf(out, "GPset,Z2,H-%05d.%d", (int) (0.0-salt), deg);
      }
      else {
         deg = ((int) (x*10.0) % 10);
         sprintf(out, "GPset,Z2,H%06d.%d", (int) salt, deg);
      }
      send_furuno_cmd(out);

      slat = slat * 180.0 / PI;
      if(slat < 0.0) {
         ns = 'S';
         slat = 0.0 - slat;
      }
      else ns = 'N';

      deg = (int) slat;
      x = slat - (double) deg;
      mins = (int) (x*60.0*10000.0);
      sprintf(lats, "%02d%02d.%04d,%c", deg,mins/10000,mins%10000, ns);


      slon = slon * 180.0 / PI;
      if(slon < 0.0) {
         ew = 'W';
         slon = 0.0 - slon;
      }
      else ew = 'E';

      deg = (int) slon;
      x = slon - (double) deg;
      mins = (int) (x*60.0*10000.0);
      sprintf(lons, "%03d%02d.%04d,%c", deg,mins/10000,mins%10000, ew);

      sprintf(out, "$GPGGA,%s,%s", lats,lons);
      send_nmea_cmd(out);

      send_furuno_cmd("GPsrq");
   }
   else if(rcvr_type == NVS_RCVR) {
      set_rcvr_mode(RCVR_MODE_HOLD);  // position hold mode

//    send_nvs_start(0x1D);  // could be 0x0F 0x03 
//    send_byte(0x07);
      send_nvs_start(0x0F);  // could be 0x1D 0x07 
      send_byte(0x03);
      send_double(slat);
      send_double(slon);
      send_double(salt);
      send_nvs_end();
   }
   else if(rcvr_type == MOTO_RCVR) {
      v1 = (S32) ((slat * 180.0 / PI) * 3600000.0); // radians to milliarcseconds
      v2 = (S32) ((slon * 180.0 / PI) * 3600000.0); // radians to milliarcseconds
      v3 = (S32) (salt * 100.0);  // convert meters to cm

      if(0) {
         set_rcvr_mode(RCVR_MODE_HOLD);  // position hold mode

         send_moto_start("Ad");  // !!!! (moto_chans != 12)
         send_dword(v1);
         send_moto_end();
         send_moto_start("Ae");
         send_dword(v2);
         send_moto_end();
         send_moto_start("Af");
         send_dword(v3);
         send_byte(0);
         send_moto_end();
      }

      set_rcvr_mode(RCVR_MODE_3D);  // enter 3D mode so we can set position hold lla
      Sleep(2000);

      send_moto_start("As");   // set LLA
      send_dword(v1);
      send_dword(v2);
      send_dword(v3);
      send_byte(0);
      send_moto_end();

      Sleep(1000);
      set_rcvr_mode(RCVR_MODE_HOLD);  // position hold mode
   }
   else if(rcvr_type == RFTG_RCVR) {
      v1 = (S32) ((slat * 180.0 / PI) * 3600000.0); // radians to milliarcseconds
      v2 = (S32) ((slon * 180.0 / PI) * 3600000.0); // radians to milliarcseconds
      v3 = (S32) (salt * 100.0);  // convert meters to cm

      set_rftg_lla(v1, v2, v3);

      request_rftg_sats();  // readback the position
      set_rftg_normal();

      if(have_rftg_unit && (rftg_unit == 0) && (have_rftg_lla == 0)) {  // RB unit has no GPS, use user define coords
         lat = slat;
         lon = slon;
         alt = salt;
      }
   }
   else if((rcvr_type == SCPI_RCVR) || (rcvr_type == TM4_RCVR) || (rcvr_type == UCCM_RCVR) || (rcvr_type == Z12_RCVR) || (rcvr_type == ZYFER_RCVR)) {
      x = slat * 180.0 / PI;
      if(x >= 0.0) c = 'N';
      else {
         c = 'S';
         x = 0.0 - x;
      }

      deg = (int) x;

      x -= (double) deg; // x = decimal part of degrees
      x *= 60.0;         // x = minutes
      xmins = x;
      mins = (int) x;

      x -= (double) mins; 
      secs = (x * 60.0);   // x = seconds

      if(rcvr_type == TM4_RCVR) {
         sprintf(lats, "%02d%05.2f,%c", deg,xmins,c);
      }
      else if(rcvr_type == Z12_RCVR) {
         secs = (double) mins + secs/60.0;
         sprintf(lats, "%.8f,%c", ((double)deg*100.0)+secs,c);
      }
      else if(rcvr_type == ZYFER_RCVR) {
         secs = (double) mins + secs/60.0;
         sprintf(lats, "%d,%.8f,%c", deg,secs,c);
      }
      else {
         sprintf(lats, "%c,%d,%d,%f,", c,deg,mins,secs);
      }


      x = slon * 180.0 / PI;
      if(x >= 0.0) c = 'E';
      else {
         c = 'W';
         x = 0.0 - x;
      }

      deg = (int) x;

      x -= (double) deg; // x = decimal part of degrees
      x *= 60.0;         // x = minutes
      xmins = x;
      mins = (int) x;

      x -= (double) mins; 
      secs = (x * 60.0);   // x = seconds

      if(rcvr_type == TM4_RCVR) {
         if(alt >= 0) sprintf(alts, "+%05d", (int) salt);
         else         sprintf(alts, "%06d",  (int) salt);
         sprintf(lons, "%03d%05.2f,%c,%s", deg,xmins,c,alts);
      }
      else if(rcvr_type == Z12_RCVR) {
         secs = (double) mins + secs/60.0;
         sprintf(lons, "%.8f,%c", ((double)deg*100.0)+secs,c);

         if(alt >= 0) sprintf(alts, "+%.2f", salt);
         else         sprintf(alts, "%.2f", salt);
      }
      else if(rcvr_type == ZYFER_RCVR) {
         secs = (double) mins + secs/60.0;
         sprintf(lons, "%d,%.8f,%c,%.2f", deg,secs,c, salt);
      }
      else {
         sprintf(lons, "%c,%d,%d,%f,%f", c,deg,mins,secs,salt);
      }

      extend_com_timeout(0.0);
      if(rcvr_type == TM4_RCVR) {
         sprintf(out, "#19,%s,%s", lats,lons);
         send_tm4_cmd(out);
      }
      else if(rcvr_type == Z12_RCVR) {
//sprintf(debug_text, "set lla: %s %s %s", lats,lons,alts);
      }
      else if(rcvr_type == ZYFER_RCVR) {
         send_zyfer_cmd("$TRMO,K");
         sprintf(out, "$SPOS,%s,%s", lats,lons);
         send_zyfer_cmd(out);
      }
      else if(rcvr_type == UCCM_RCVR) {
         sprintf(out, "GPS:POS %s%s", lats,lons);
         queue_uccm_cmd(out, SCPI_NULL_MSG);  // !!!!!
         Sleep(1000);
         queue_uccm_cmd("SYST:STAT?", UCCM_STATUS_MSG);
      }
      else if(scpi_type == NORTEL_TYPE) {
         sprintf(out, "GPS:POSITION %s%s", lats,lons);
         queue_scpi_cmd(out, SCPI_NULL_MSG);  // !!!!!
      }
      else {  
         sprintf(out, ":PTIM:GPS:POS %s%s", lats,lons);
         queue_scpi_cmd(out, SCPI_NULL_MSG);  // !!!!!
      }
   }
   else if(rcvr_type == TAIP_RCVR) {  // sets receiver initial position
      strcpy(lats, "SIP");
      if(slat >= 0.0) sprintf(out, "+%02d", (int) (slat*180.0/PI));
      else            sprintf(out, "%03d", (int) (slat*180.0/PI));
      strcat(lats, out);

      if(slon >= 0.0) sprintf(out, "+%03d", (int) (slon*180.0/PI));
      else            sprintf(out, "%04d", (int) (slon*180.0/PI));
      strcat(lats, out);

      if(salt >= 0.0) sprintf(out, "+%04d", (int) (salt/10.0));
      else            sprintf(out, "%05d", (int) (salt/10.0));
      strcat(lats, out);

      send_taip_cmd(lats);
   }
   else if(rcvr_type == TIDE_RCVR) {
      if((lat == 0.0) && (lon == 0.0)) {    // first time position has been set...
         new_queue(RESET_ALL_QUEUES, 5467); // clear the queues so tides scale properly
      }

      lat = slat;
      lon = slon;
      alt = salt;

      ref_lat = slat;
      ref_lon = slon;
      ref_alt = salt;

      moon_posn(jd_tt);
      sun_posn(jd_utc, 0);
   }
   else if(rcvr_type == TRUE_RCVR) {
      sprintf(out, "$SETPOS %ld %ld %ld", (long) (slat*1.0E6*180.0/PI), (long) (slon*1.0E6*180.0/PI), (long) salt);
      send_true_cmd(out);  // $SETPOS %ld %ld %ld - set position (lat lon alt in same format as $GETPOS)
      send_true_cmd("$GETPOS");
   }
   else if(rcvr_type == TSIP_RCVR) {
      send_tsip_start(0x32);
      send_single((float) slat);
      send_single((float) slon);
      send_single((float) salt);
      send_tsip_end();

      if(0 && SV6_FAMILY) {
         send_tsip_start(0x2A);   // !!!! altitude for 2D mode
         send_single((float) salt);
         send_tsip_end();
      }
   }
   else if(rcvr_type == UBX_RCVR) {
      set_ubx_config(2, slat,slon,salt);
   }
   else if(rcvr_type == VENUS_RCVR) {
      set_venus_survey(2, slat,slon,salt);
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      set_zod_config(6, slat,slon,salt, traim_threshold, 1);
   }

   need_redraw = 7780;
}

// Assembly:
leaq 0x2c23a3(%rip), %rax    # 0x32101a
cmpb $0x0, (%rax)
je 0x5ec7d
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movapd %xmm2, %xmm3
movapd %xmm1, %xmm4
movapd %xmm0, %xmm5
leaq 0x1a673c(%rip), %rax    # 0x2053e0
movb $0x1, (%rax)
leaq 0x298902(%rip), %rax    # 0x2f75b0
movl $0x1, (%rax)
leaq 0x1ca283(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
je 0x5ed00
leaq 0x298309(%rip), %rax    # 0x2f6fd0
movsd %xmm5, (%rax)
leaq 0x298306(%rip), %rax    # 0x2f6fd8
movsd %xmm4, (%rax)
leaq 0x298303(%rip), %rax    # 0x2f6fe0
movsd %xmm3, (%rax)
leaq 0x1a3b5c(%rip), %rax    # 0x202844
movl $0x1e64, (%rax)         # imm = 0x1E64
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a3bc9(%rip), %r12    # 0x2028d0
movq (%r12), %rdx
movabsq $0x105b8b0400, %rax     # imm = 0x105B8B0400
testq %rax, %rdx
jne 0x5ed3a
leaq 0x1a62af(%rip), %rax    # 0x204fd0
cmpl $0x0, (%rax)
je 0x5edf9
leaq 0x298693(%rip), %rax    # 0x2f73c4
cmpl $0x0, (%rax)
jne 0x5edf9
cmpq $0x800000, %rdx         # imm = 0x800000
jne 0x5ecc0
leaq 0x298282(%rip), %rbx    # 0x2f6fd0
movsd (%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
leaq 0x298277(%rip), %r14    # 0x2f6fd8
jne 0x5ed9d
jp 0x5ed9d
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
jne 0x5ed9d
jp 0x5ed9d
pushq $0x7
popq %rdi
movl $0x155b, %esi           # imm = 0x155B
movapd %xmm4, -0x50(%rbp)
movapd %xmm3, -0x40(%rbp)
movapd %xmm5, -0x60(%rbp)
callq 0x10a99
movapd -0x60(%rbp), %xmm5
movapd -0x40(%rbp), %xmm3
movapd -0x50(%rbp), %xmm4
movsd %xmm5, (%rbx)
movsd %xmm4, (%r14)
leaq 0x298233(%rip), %rax    # 0x2f6fe0
movsd %xmm3, (%rax)
leaq 0x2c6558(%rip), %rax    # 0x325310
movsd %xmm5, (%rax)
leaq 0x2c6555(%rip), %rax    # 0x325318
movsd %xmm4, (%rax)
leaq 0x2c6552(%rip), %rax    # 0x325320
movsd %xmm3, (%rax)
leaq 0x298767(%rip), %rax    # 0x2f7540
movsd (%rax), %xmm0
callq 0xd3202
leaq 0x298747(%rip), %rax    # 0x2f7530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xd3da7
jmp 0x5ece1
cmpq $0x400000, %rdx         # imm = 0x400000
sete %al
leaq 0x298baa(%rip), %rbx    # 0x2f79b4
cmpl $0x0, (%rbx)
sete %cl
cmpq $0x4000, %rdx           # imm = 0x4000
je 0x5ecc0
andb %cl, %al
jne 0x5ecc0
cmpq $0x1, %rdx
je 0x5f542
cmpq $0x4, %rdx
je 0x5f1f2
movabsq $0x100000000, %r13      # imm = 0x100000000
movabsq $0x400000000, %r15      # imm = 0x400000000
cmpq $0x8, %rdx
je 0x5ef49
cmpq $0x10, %rdx
je 0x5ef49
cmpq $0x20, %rdx
je 0x5f581
cmpq $0x80, %rdx
je 0x5f3c3
cmpq $0x100, %rdx            # imm = 0x100
je 0x5f20b
cmpq $0x800, %rdx            # imm = 0x800
je 0x5f721
cmpq $0x8000, %rdx           # imm = 0x8000
je 0x5f3dc
cmpq $0x100000, %rdx         # imm = 0x100000
je 0x5ef49
cmpq $0x200000, %rdx         # imm = 0x200000
je 0x5f4d2
cmpq $0x400000, %rdx         # imm = 0x400000
je 0x5f658
cmpq $0x800000, %rdx         # imm = 0x800000
je 0x5ed47
cmpq $0x20000000, %rdx       # imm = 0x20000000
je 0x5f22d
cmpq %r15, %rdx
je 0x5ef49
cmpq %r13, %rdx
je 0x5ef49
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, %rdx
jne 0x5ece1
movsd 0x969a8(%rip), %xmm0    # 0xf58a8
mulsd %xmm0, %xmm5
movsd 0x96994(%rip), %xmm1    # 0xf58a0
divsd %xmm1, %xmm5
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
cvttsd2si %xmm3, %edx
leaq 0x2c72fd(%rip), %rbx    # 0x326220
leaq 0xaba79(%rip), %rsi     # 0x10a9a3
movq %rbx, %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movb $0x2, %al
callq 0x9060
movq %rbx, %rdi
callq 0x57791
jmp 0x5ece1
mulsd 0x96957(%rip), %xmm5    # 0xf58a8
divsd 0x96947(%rip), %xmm5    # 0xf58a0
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
ucomisd %xmm0, %xmm5
setb %cl
jae 0x5ef70
subsd %xmm5, %xmm0
movapd %xmm0, %xmm5
cvttsd2si %xmm5, %eax
cvttpd2dq %xmm5, %xmm0
cvtdq2pd %xmm0, %xmm1
leal (%rcx,%rcx,4), %ecx
addl $0x4e, %ecx
subsd %xmm1, %xmm5
movsd 0x9407a(%rip), %xmm6    # 0xf3008
mulsd %xmm6, %xmm5
cvttpd2dq %xmm5, %xmm0
cvtdq2pd %xmm0, %xmm2
movapd %xmm5, %xmm0
subsd %xmm2, %xmm0
mulsd %xmm6, %xmm0
cmpq $0x100000, %rdx         # imm = 0x100000
movapd %xmm4, -0x50(%rbp)
movapd %xmm3, -0x40(%rbp)
je 0x5f00e
cmpq %r13, %rdx
je 0x5efd9
cmpq %r15, %rdx
jne 0x5f033
leaq 0xaba58(%rip), %rsi     # 0x10aa22
leaq -0x160(%rbp), %rdi
movl %eax, %edx
movapd %xmm5, %xmm0
jmp 0x5f02a
divsd 0x94027(%rip), %xmm0    # 0xf3008
addsd %xmm2, %xmm0
mulsd 0x94073(%rip), %xmm1    # 0xf3060
addsd %xmm0, %xmm1
leaq 0xaba3b(%rip), %rsi     # 0x10aa33
leaq -0x160(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ecx, %edx
movb $0x1, %al
callq 0x9060
jmp 0x5f051
divsd 0x93ff2(%rip), %xmm0    # 0xf3008
addsd %xmm2, %xmm0
leaq 0xaba0f(%rip), %rsi     # 0x10aa30
leaq -0x160(%rbp), %rdi
movl %eax, %edx
movb $0x1, %al
callq 0x9060
jmp 0x5f051
cvttsd2si %xmm5, %r8d
leaq 0xab9fc(%rip), %rsi     # 0x10aa3b
leaq -0x160(%rbp), %rdi
movl %ecx, %edx
movl %eax, %ecx
movb $0x1, %al
callq 0x9060
movapd -0x50(%rbp), %xmm3
mulsd 0x9684a(%rip), %xmm3    # 0xf58a8
divsd 0x9683a(%rip), %xmm3    # 0xf58a0
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
pushq $0x57
popq %rax
pushq $0x45
popq %rbx
cmovbl %eax, %ebx
jae 0x5f081
subsd %xmm3, %xmm0
movapd %xmm0, %xmm3
cvttsd2si %xmm3, %r14d
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm1
subsd %xmm1, %xmm3
movsd 0x93f6e(%rip), %xmm4    # 0xf3008
mulsd %xmm4, %xmm3
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm2
movapd %xmm3, %xmm0
subsd %xmm2, %xmm0
mulsd %xmm4, %xmm0
movq (%r12), %rax
cmpq $0x100000, %rax         # imm = 0x100000
je 0x5f199
cmpq %r13, %rax
je 0x5f141
cmpq %r15, %rax
jne 0x5f1c9
leaq 0x297f09(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
cvttsd2si -0x40(%rbp), %edx
leaq 0xabea6(%rip), %rax     # 0x10af95
leaq 0xabf64(%rip), %rsi     # 0x10b05a
cmovbq %rax, %rsi
leaq -0x360(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
movapd %xmm3, -0x50(%rbp)
callq 0x9060
leaq 0xab931(%rip), %rsi     # 0x10aa48
leaq -0x260(%rbp), %rdi
movl %r14d, %edx
movapd -0x50(%rbp), %xmm0
movl %ebx, %ecx
movq %r15, %r8
movabsq $0x400000000, %r15      # imm = 0x400000000
movb $0x1, %al
callq 0x9060
jmp 0x5f7a6
divsd 0x93ebf(%rip), %xmm0    # 0xf3008
addsd %xmm2, %xmm0
mulsd 0x93f0b(%rip), %xmm1    # 0xf3060
addsd %xmm0, %xmm1
leaq 0xab8d3(%rip), %rsi     # 0x10aa33
leaq -0x260(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ebx, %edx
movb $0x1, %al
callq 0x9060
leaq 0x297e65(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x5f78c
leaq 0xaed00(%rip), %rsi     # 0x10de94
jmp 0x5f793
divsd 0x93e67(%rip), %xmm0    # 0xf3008
addsd %xmm2, %xmm0
leaq 0xab8b3(%rip), %rsi     # 0x10aa5f
leaq -0x260(%rbp), %rdi
movl %r14d, %edx
movl %ebx, %ecx
movapd -0x40(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x5f7a6
cvttsd2si %xmm3, %r8d
leaq 0xab89a(%rip), %rsi     # 0x10aa6f
leaq -0x260(%rbp), %rdi
movl %ebx, %edx
movl %r14d, %ecx
movapd -0x40(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x5f7a6
pushq $0x2
popq %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x5f939
jmp 0x5ece1
leaq 0x1a5eb2(%rip), %rax    # 0x2050c4
movl (%rax), %esi
pushq $0x6
popq %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x5faee
jmp 0x5ece1
movapd %xmm4, -0x50(%rbp)
cvttsd2si %xmm3, %r8d
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
mulsd 0x93e59(%rip), %xmm1    # 0xf30a8
cvttsd2si %xmm1, %eax
pushq $0xa
popq %rcx
cltd
idivl %ecx
movl %edx, %ecx
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm0
leaq 0xab75b(%rip), %rax     # 0x10a9c5
leaq 0xab767(%rip), %rsi     # 0x10a9d8
cmovaq %rax, %rsi
leaq 0x2c6fa4(%rip), %rbx    # 0x326220
movq %rbx, %rdi
movl %r8d, %edx
xorl %eax, %eax
movapd %xmm5, -0x60(%rbp)
callq 0x9060
movq %rbx, %rdi
callq 0x578d5
movapd -0x60(%rbp), %xmm1
mulsd 0x96605(%rip), %xmm1    # 0xf58a8
divsd 0x965f5(%rip), %xmm1    # 0xf58a0
xorl %esi, %esi
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
seta %dl
jbe 0x5f2c2
subsd %xmm1, %xmm0
movapd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
subsd %xmm0, %xmm1
mulsd 0x93d2e(%rip), %xmm1    # 0xf3008
mulsd 0x93df6(%rip), %xmm1    # 0xf30d8
cvttsd2si %xmm1, %eax
movb %dl, %sil
movl $0x2710, %r15d          # imm = 0x2710
cltd
idivl %r15d
movl %edx, %r8d
leal (%rsi,%rsi,4), %r9d
addl $0x4e, %r9d
leaq 0xab6e5(%rip), %rsi     # 0x10a9ea
leaq -0x160(%rbp), %r14
movq %r14, %rdi
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x9060
movapd -0x50(%rbp), %xmm1
mulsd 0x96581(%rip), %xmm1    # 0xf58a8
divsd 0x96571(%rip), %xmm1    # 0xf58a0
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5f341
subsd %xmm1, %xmm0
movapd %xmm0, %xmm1
pushq $0x57
popq %rax
pushq $0x45
popq %r9
cmoval %eax, %r9d
cvttsd2si %xmm1, %ecx
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
subsd %xmm0, %xmm1
mulsd 0x93ca4(%rip), %xmm1    # 0xf3008
mulsd 0x93d6c(%rip), %xmm1    # 0xf30d8
cvttsd2si %xmm1, %eax
cltd
idivl %r15d
movl %edx, %r8d
leaq 0xab67d(%rip), %rsi     # 0x10a9fb
leaq -0x260(%rbp), %r15
movq %r15, %rdi
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x9060
leaq 0xab672(%rip), %rsi     # 0x10aa0c
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x579af
leaq 0xab660(%rip), %rdi     # 0x10aa19
callq 0x578d5
jmp 0x5ece1
pushq $0x2
popq %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x5e5b2
jmp 0x5ece1
leaq -0x160(%rbp), %rbx
movl $0x504953, (%rbx)       # imm = 0x504953
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
mulsd 0x964af(%rip), %xmm5    # 0xf58a8
divsd 0x9649f(%rip), %xmm5    # 0xf58a0
cvttsd2si %xmm5, %edx
leaq 0xae4ef(%rip), %rax     # 0x10d8fb
leaq 0xac13c(%rip), %rsi     # 0x10b54f
cmovbq %rax, %rsi
leaq 0x2c6e02(%rip), %r14    # 0x326220
movq %r14, %rdi
xorl %eax, %eax
movapd %xmm4, -0x50(%rbp)
movapd %xmm3, -0x40(%rbp)
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movapd -0x50(%rbp), %xmm0
ucomisd 0x93cce(%rip), %xmm0    # 0xf3118
leaq 0xb90a3(%rip), %rax     # 0x1184f4
leaq 0xae4a2(%rip), %rsi     # 0x10d8fa
cmovbq %rax, %rsi
mulsd 0x96444(%rip), %xmm0    # 0xf58a8
divsd 0x96434(%rip), %xmm0    # 0xf58a0
cvttsd2si %xmm0, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movapd -0x40(%rbp), %xmm0
ucomisd 0x93c86(%rip), %xmm0    # 0xf3118
leaq 0xabbc2(%rip), %rax     # 0x10b05b
leaq 0xab621(%rip), %rsi     # 0x10aac1
cmovbq %rax, %rsi
divsd 0x93bfc(%rip), %xmm0    # 0xf30a8
cvttsd2si %xmm0, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movq %rbx, %rdi
callq 0x5c473
jmp 0x5ece1
movsd 0x93b76(%rip), %xmm0    # 0xf3050
mulsd %xmm0, %xmm5
movsd 0x963c2(%rip), %xmm1    # 0xf58a8
mulsd %xmm1, %xmm5
movsd 0x963ae(%rip), %xmm2    # 0xf58a0
divsd %xmm2, %xmm5
cvttsd2si %xmm5, %rdx
mulsd %xmm0, %xmm4
mulsd %xmm1, %xmm4
divsd %xmm2, %xmm4
cvttsd2si %xmm4, %rcx
cvttsd2si %xmm3, %r8
leaq 0x2c6d08(%rip), %rbx    # 0x326220
leaq 0xab5a8(%rip), %rsi     # 0x10aac7
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x57acc
leaq 0xab389(%rip), %rdi     # 0x10a8c1
callq 0x57acc
jmp 0x5ece1
pushq $0x32
popq %rdi
movapd %xmm4, -0x50(%rbp)
movapd %xmm3, -0x40(%rbp)
movapd %xmm5, -0x60(%rbp)
callq 0x5707f
cvtsd2ss -0x60(%rbp), %xmm0
callq 0x52673
cvtsd2ss -0x50(%rbp), %xmm0
callq 0x52673
cvtsd2ss -0x40(%rbp), %xmm0
callq 0x52673
callq 0x570f8
jmp 0x5ece1
movsd 0x9631f(%rip), %xmm0    # 0xf58a8
mulsd %xmm0, %xmm5
movsd 0x9630b(%rip), %xmm1    # 0xf58a0
divsd %xmm1, %xmm5
movsd 0xa8c97(%rip), %xmm2    # 0x108238
mulsd %xmm2, %xmm5
cvttsd2si %xmm5, %ebx
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
mulsd %xmm2, %xmm4
cvttsd2si %xmm4, %r15d
mulsd 0x93a9e(%rip), %xmm3    # 0xf3060
cvttsd2si %xmm3, %r14d
pushq $0x4
popq %rdi
movss 0x97b16(%rip), %xmm0    # 0xf70e8
movl $0xff, %esi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movl $0xff, %edx
callq 0x55b65
movl $0x7d0, %edi            # imm = 0x7D0
callq 0xae83
leaq 0xab424(%rip), %rdi     # 0x10aa1f
callq 0x59a28
movl %ebx, %edi
callq 0x525e2
movl %r15d, %edi
callq 0x525e2
movl %r14d, %edi
callq 0x525e2
xorl %edi, %edi
callq 0x523f2
callq 0x59aab
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xae83
pushq $0x7
popq %rdi
movl $0xff, %esi
movss 0x97aab(%rip), %xmm0    # 0xf70e8
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd %xmm0, %xmm3
movl $0xff, %edx
callq 0x55b65
jmp 0x5ece1
movsd 0x96248(%rip), %xmm0    # 0xf58a8
movapd %xmm5, %xmm1
mulsd %xmm0, %xmm1
movsd 0x96230(%rip), %xmm2    # 0xf58a0
divsd %xmm2, %xmm1
movapd %xmm3, -0x40(%rbp)
movsd 0xa8bb7(%rip), %xmm3    # 0x108238
mulsd %xmm3, %xmm1
cvttsd2si %xmm1, %edi
mulsd %xmm4, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %esi
movsd 0x939bf(%rip), %xmm0    # 0xf3060
mulsd -0x40(%rbp), %xmm0
cvttsd2si %xmm0, %edx
movapd %xmm4, -0x50(%rbp)
movapd %xmm5, -0x60(%rbp)
callq 0x5f8e5
callq 0x5d5a6
callq 0x5d4f6
movapd -0x60(%rbp), %xmm2
movapd -0x40(%rbp), %xmm1
movapd -0x50(%rbp), %xmm0
leaq 0x2982df(%rip), %rax    # 0x2f79b8
cmpl $0x0, (%rax)
je 0x5ece1
cmpl $0x0, (%rbx)
jne 0x5ece1
leaq 0x2983ae(%rip), %rax    # 0x2f7aa0
cmpl $0x0, (%rax)
jne 0x5ece1
leaq 0x2978ce(%rip), %rax    # 0x2f6fd0
movsd %xmm2, (%rax)
leaq 0x2978cb(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
leaq 0x2978c8(%rip), %rax    # 0x2f6fe0
movsd %xmm1, (%rax)
jmp 0x5ece1
pushq $0x7
popq %rdi
movss 0x979bc(%rip), %xmm0    # 0xf70e8
movl $0xff, %esi
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd %xmm3, -0x40(%rbp)
movapd %xmm0, %xmm3
movl $0xff, %edx
movapd %xmm4, -0x50(%rbp)
movapd %xmm5, -0x60(%rbp)
callq 0x55b65
pushq $0xf
popq %rdi
callq 0x5707f
pushq $0x3
popq %rdi
callq 0x523f2
movaps -0x60(%rbp), %xmm0
callq 0x526bd
movaps -0x50(%rbp), %xmm0
callq 0x526bd
movapd -0x40(%rbp), %xmm0
callq 0x526bd
callq 0x57171
jmp 0x5ece1
leaq 0xab2c6(%rip), %rsi     # 0x10aa59
leaq -0x360(%rbp), %rdi
movapd -0x40(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
xorpd %xmm0, %xmm0
callq 0x5bd83
movq (%r12), %rax
cmpq $0x8, %rax
je 0x5f84c
cmpq $0x100000, %rax         # imm = 0x100000
je 0x5f80a
cmpq %r13, %rax
je 0x5ece1
cmpq %r15, %rax
jne 0x5f893
leaq 0x2c6a42(%rip), %rbx    # 0x326220
leaq 0xab299(%rip), %rsi     # 0x10aa7e
leaq -0x160(%rbp), %rdx
leaq -0x260(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x57a21
jmp 0x5ece1
leaq 0xab278(%rip), %rdi     # 0x10aa89
callq 0x579af
leaq 0x2c6a03(%rip), %rbx    # 0x326220
leaq 0xab26c(%rip), %rsi     # 0x10aa90
leaq -0x160(%rbp), %rdx
leaq -0x260(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
incq %rbx
movq %rbx, %rdi
callq 0x579af
jmp 0x5ece1
leaq 0x2c69cd(%rip), %rbx    # 0x326220
leaq 0xab25a(%rip), %rsi     # 0x10aab4
leaq -0x160(%rbp), %rdx
leaq -0x260(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x576d4
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xae83
leaq 0xae848(%rip), %rdi     # 0x10e0d6
pushq $0x65
popq %rsi
jmp 0x5f8db
leaq 0x1a5746(%rip), %rax    # 0x204fe0
cmpl $0x4e, (%rax)
jne 0x5f8af
leaq 0x2c697a(%rip), %rbx    # 0x326220
leaq 0xab1ef(%rip), %rsi     # 0x10aa9c
jmp 0x5f8bd
leaq 0x2c696a(%rip), %rbx    # 0x326220
leaq 0xab1f1(%rip), %rsi     # 0x10aaae
leaq -0x160(%rbp), %rdx
leaq -0x260(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x576d4
jmp 0x5ece1