// File: /workspace/github_cpp_makefile_star2_O1/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 0x2cfcca(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x67356
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x330, %rsp            # imm = 0x330
movapd %xmm2, %xmm3
movapd %xmm1, %xmm4
movapd %xmm0, %xmm5
leaq 0x1b4065(%rip), %rax    # 0x21b3e0
movb $0x1, (%rax)
leaq 0x2a622b(%rip), %rax    # 0x30d5b0
movl $0x1, (%rax)
leaq 0x1d7bac(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x673d5
leaq 0x2a5c32(%rip), %rax    # 0x30cfd0
movsd %xmm5, (%rax)
leaq 0x2a5c2f(%rip), %rax    # 0x30cfd8
movsd %xmm4, (%rax)
leaq 0x2a5c2c(%rip), %rax    # 0x30cfe0
movsd %xmm3, (%rax)
leaq 0x1b1485(%rip), %rax    # 0x218844
movl $0x1e64, (%rax)         # imm = 0x1E64
addq $0x330, %rsp            # imm = 0x330
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b14f4(%rip), %r12    # 0x2188d0
movq (%r12), %rdx
movabsq $0x105b8b0400, %rax     # imm = 0x105B8B0400
testq %rax, %rdx
jne 0x6740f
leaq 0x1b3bda(%rip), %rax    # 0x21afd0
cmpl $0x0, (%rax)
je 0x674d0
leaq 0x2a5fbe(%rip), %rax    # 0x30d3c4
cmpl $0x0, (%rax)
jne 0x674d0
cmpq $0x800000, %rdx         # imm = 0x800000
jne 0x67397
leaq 0x2a5bad(%rip), %rbx    # 0x30cfd0
movsd (%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
leaq 0x2a5ba2(%rip), %r14    # 0x30cfd8
jne 0x67474
jp 0x67474
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
jne 0x67474
jp 0x67474
movl $0x7, %edi
movl $0x155b, %esi           # imm = 0x155B
movapd %xmm4, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x1120f
movapd -0x50(%rbp), %xmm5
movapd -0x30(%rbp), %xmm3
movapd -0x40(%rbp), %xmm4
movsd %xmm5, (%rbx)
movsd %xmm4, (%r14)
leaq 0x2a5b5c(%rip), %rax    # 0x30cfe0
movsd %xmm3, (%rax)
leaq 0x2d3e81(%rip), %rax    # 0x33b310
movsd %xmm5, (%rax)
leaq 0x2d3e7e(%rip), %rax    # 0x33b318
movsd %xmm4, (%rax)
leaq 0x2d3e7b(%rip), %rax    # 0x33b320
movsd %xmm3, (%rax)
leaq 0x2a6090(%rip), %rax    # 0x30d540
movsd (%rax), %xmm0
callq 0xe6724
leaq 0x2a6070(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xe77bd
jmp 0x673b8
cmpq $0x400000, %rdx         # imm = 0x400000
sete %al
leaq 0x2a64d3(%rip), %rbx    # 0x30d9b4
cmpl $0x0, (%rbx)
sete %cl
cmpq $0x4000, %rdx           # imm = 0x4000
je 0x67397
andb %cl, %al
jne 0x67397
cmpq $0x7fff, %rdx           # imm = 0x7FFF
jle 0x675a8
cmpq $0x7fffff, %rdx         # imm = 0x7FFFFF
jle 0x675e7
cmpq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
jle 0x6787f
movabsq $0x400000000, %rax      # imm = 0x400000000
cmpq %rax, %rdx
je 0x67741
movabsq $0x100000000, %rax      # imm = 0x100000000
cmpq %rax, %rdx
je 0x67741
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, %rdx
jne 0x673b8
movsd 0xa42c1(%rip), %xmm0    # 0x10b820
mulsd %xmm0, %xmm5
movsd 0xa42ad(%rip), %xmm1    # 0x10b818
divsd %xmm1, %xmm5
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
cvttsd2si %xmm3, %edx
leaq 0x2d4c9e(%rip), %rbx    # 0x33c220
leaq 0xb93f2(%rip), %rsi     # 0x12097b
movq %rbx, %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movb $0x2, %al
callq 0x9060
movq %rbx, %rdi
callq 0x5ef13
jmp 0x673b8
cmpq $0x1f, %rdx
jg 0x6760f
cmpq $0x7, %rdx
jg 0x67731
cmpq $0x1, %rdx
je 0x67dff
cmpq $0x4, %rdx
jne 0x673b8
movl $0x2, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x6811b
jmp 0x673b8
cmpq $0x1fffff, %rdx         # imm = 0x1FFFFF
jg 0x6764e
cmpq $0x8000, %rdx           # imm = 0x8000
je 0x67c8f
cmpq $0x100000, %rdx         # imm = 0x100000
je 0x67741
jmp 0x673b8
cmpq $0xff, %rdx
jg 0x677f4
cmpq $0x20, %rdx
je 0x67e49
cmpq $0x80, %rdx
jne 0x673b8
movl $0x2, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x66bf6
jmp 0x673b8
cmpq $0x200000, %rdx         # imm = 0x200000
je 0x67d8f
cmpq $0x400000, %rdx         # imm = 0x400000
jne 0x673b8
movsd 0xa41b0(%rip), %xmm0    # 0x10b820
movapd %xmm5, %xmm1
mulsd %xmm0, %xmm1
movsd 0xa4198(%rip), %xmm2    # 0x10b818
divsd %xmm2, %xmm1
movapd %xmm3, -0x30(%rbp)
movsd 0xb6a87(%rip), %xmm3    # 0x11e118
mulsd %xmm3, %xmm1
cvttsd2si %xmm1, %edi
mulsd %xmm4, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %esi
movsd 0xa19af(%rip), %xmm0    # 0x109060
mulsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %edx
movapd %xmm4, -0x40(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x680c5
callq 0x6579c
callq 0x656bc
movapd -0x50(%rbp), %xmm2
movapd -0x30(%rbp), %xmm1
movapd -0x40(%rbp), %xmm0
leaq 0x2a62cf(%rip), %rax    # 0x30d9b8
cmpl $0x0, (%rax)
je 0x673b8
cmpl $0x0, (%rbx)
jne 0x673b8
leaq 0x2a639e(%rip), %rax    # 0x30daa0
cmpl $0x0, (%rax)
jne 0x673b8
leaq 0x2a58be(%rip), %rax    # 0x30cfd0
movsd %xmm2, (%rax)
leaq 0x2a58bb(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
leaq 0x2a58b8(%rip), %rax    # 0x30cfe0
movsd %xmm1, (%rax)
jmp 0x673b8
cmpq $0x8, %rdx
je 0x67741
cmpq $0x10, %rdx
jne 0x673b8
mulsd 0xa40d7(%rip), %xmm5    # 0x10b820
divsd 0xa40c7(%rip), %xmm5    # 0x10b818
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
ucomisd %xmm0, %xmm5
setb %cl
jae 0x67768
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 0xa1882(%rip), %xmm6    # 0x109008
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, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
je 0x67a9d
movabsq $0x100000000, %rsi      # imm = 0x100000000
cmpq %rsi, %rdx
je 0x67a68
movabsq $0x400000000, %rsi      # imm = 0x400000000
cmpq %rsi, %rdx
jne 0x67ac2
leaq 0xb9218(%rip), %rsi     # 0x1209fa
leaq -0x150(%rbp), %rdi
movl %eax, %edx
movapd %xmm5, %xmm0
jmp 0x67ab9
cmpq $0x100, %rdx            # imm = 0x100
je 0x67f24
cmpq $0x800, %rdx            # imm = 0x800
jne 0x673b8
movss 0xa57ba(%rip), %xmm0    # 0x10cfd0
movl $0x7, %edi
movl $0xff, %esi
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd %xmm3, -0x30(%rbp)
movapd %xmm0, %xmm3
movl $0xff, %edx
movapd %xmm4, -0x40(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x5d081
movl $0xf, %edi
callq 0x5e740
movl $0x3, %edi
callq 0x591af
movaps -0x50(%rbp), %xmm0
callq 0x59487
movaps -0x40(%rbp), %xmm0
callq 0x59487
movapd -0x30(%rbp), %xmm0
callq 0x59487
callq 0x5e844
jmp 0x673b8
cmpq $0x800000, %rdx         # imm = 0x800000
je 0x6741c
cmpq $0x20000000, %rdx       # imm = 0x20000000
jne 0x673b8
movapd %xmm4, -0x40(%rbp)
cvttsd2si %xmm3, %edx
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
mulsd 0xa17ee(%rip), %xmm1    # 0x1090a8
cvttsd2si %xmm1, %eax
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rax, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rax
addl %esi, %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
subl %eax, %ecx
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm0
leaq 0xb90b2(%rip), %rax     # 0x12099d
leaq 0xb90be(%rip), %rsi     # 0x1209b0
cmovaq %rax, %rsi
leaq 0x2d4923(%rip), %rbx    # 0x33c220
movq %rbx, %rdi
xorl %eax, %eax
movapd %xmm5, -0x50(%rbp)
callq 0x9060
movq %rbx, %rdi
callq 0x5f070
xorpd %xmm0, %xmm0
movapd -0x50(%rbp), %xmm1
mulsd 0xa3efb(%rip), %xmm1    # 0x10b820
divsd 0xa3eeb(%rip), %xmm1    # 0x10b818
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %cl
jbe 0x67940
subsd %xmm1, %xmm0
movapd %xmm0, %xmm1
movb %cl, %al
cvttsd2si %xmm1, %edx
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
leal (%rax,%rax,4), %r9d
addl $0x4e, %r9d
subsd %xmm0, %xmm1
mulsd 0xa16a6(%rip), %xmm1    # 0x109008
mulsd 0xa176e(%rip), %xmm1    # 0x1090d8
cvttsd2si %xmm1, %eax
movslq %eax, %r8
imulq $0x68db8bad, %r8, %rcx  # imm = 0x68DB8BAD
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x2c, %rcx
addl %eax, %ecx
imull $0x2710, %ecx, %eax     # imm = 0x2710
subl %eax, %r8d
leaq 0xb902d(%rip), %rsi     # 0x1209c2
leaq -0x150(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movapd -0x40(%rbp), %xmm1
mulsd 0xa3e6d(%rip), %xmm1    # 0x10b820
divsd 0xa3e5d(%rip), %xmm1    # 0x10b818
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x679cd
subsd %xmm1, %xmm0
movapd %xmm0, %xmm1
movl $0x57, %eax
movl $0x45, %r9d
cmoval %eax, %r9d
cvttsd2si %xmm1, %edx
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
subsd %xmm0, %xmm1
mulsd 0xa1614(%rip), %xmm1    # 0x109008
mulsd 0xa16dc(%rip), %xmm1    # 0x1090d8
cvttsd2si %xmm1, %eax
movslq %eax, %r8
imulq $0x68db8bad, %r8, %rcx  # imm = 0x68DB8BAD
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x2c, %rcx
addl %eax, %ecx
imull $0x2710, %ecx, %eax     # imm = 0x2710
subl %eax, %r8d
leaq 0xb8fac(%rip), %rsi     # 0x1209d3
leaq -0x250(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0xb8fa5(%rip), %rsi     # 0x1209e4
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f15d
leaq 0xb8f93(%rip), %rdi     # 0x1209f1
callq 0x5f070
jmp 0x673b8
divsd 0xa1598(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
mulsd 0xa15e4(%rip), %xmm1    # 0x109060
addsd %xmm0, %xmm1
leaq 0xb8f84(%rip), %rsi     # 0x120a0b
leaq -0x150(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ecx, %edx
movb $0x1, %al
callq 0x9060
jmp 0x67ae0
divsd 0xa1563(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
leaq 0xb8f58(%rip), %rsi     # 0x120a08
leaq -0x150(%rbp), %rdi
movl %eax, %edx
movb $0x1, %al
callq 0x9060
jmp 0x67ae0
cvttsd2si %xmm5, %r8d
leaq 0xb8f45(%rip), %rsi     # 0x120a13
leaq -0x150(%rbp), %rdi
movl %ecx, %edx
movl %eax, %ecx
movb $0x1, %al
callq 0x9060
movapd -0x40(%rbp), %xmm3
mulsd 0xa3d33(%rip), %xmm3    # 0x10b820
divsd 0xa3d23(%rip), %xmm3    # 0x10b818
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
movl $0x57, %eax
movl $0x45, %ebx
cmovbl %eax, %ebx
jae 0x67b14
subsd %xmm3, %xmm0
movapd %xmm0, %xmm3
movsd 0xa14ec(%rip), %xmm4    # 0x109008
cvttsd2si %xmm3, %r14d
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm1
subsd %xmm1, %xmm3
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 0x67c36
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
je 0x67bde
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
jne 0x67c66
leaq 0x2a5462(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
cvttsd2si -0x30(%rbp), %edx
leaq 0xb93d7(%rip), %rax     # 0x120f6d
leaq 0xb9495(%rip), %rsi     # 0x121032
cmovbq %rax, %rsi
leaq -0x350(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
movapd %xmm3, -0x40(%rbp)
callq 0x9060
leaq 0xb8e62(%rip), %rsi     # 0x120a20
leaq -0x250(%rbp), %rdi
movl %r14d, %edx
movapd -0x40(%rbp), %xmm0
movl %ebx, %ecx
movq %r15, %r8
movb $0x1, %al
callq 0x9060
jmp 0x67f62
divsd 0xa1422(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
mulsd 0xa146e(%rip), %xmm1    # 0x109060
addsd %xmm0, %xmm1
leaq 0xb8e0e(%rip), %rsi     # 0x120a0b
leaq -0x250(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ebx, %edx
movb $0x1, %al
callq 0x9060
leaq 0x2a53c8(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x67f48
leaq 0xbc23b(%rip), %rsi     # 0x123e6c
jmp 0x67f4f
divsd 0xa13ca(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
leaq 0xb8dee(%rip), %rsi     # 0x120a37
leaq -0x250(%rbp), %rdi
movl %r14d, %edx
movl %ebx, %ecx
movapd -0x30(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x67f62
cvttsd2si %xmm3, %r8d
leaq 0xb8dd5(%rip), %rsi     # 0x120a47
leaq -0x250(%rbp), %rdi
movl %ebx, %edx
movl %r14d, %ecx
movapd -0x30(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x67f62
leaq -0x150(%rbp), %rbx
movl $0x504953, (%rbx)       # imm = 0x504953
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
mulsd 0xa3b74(%rip), %xmm5    # 0x10b820
divsd 0xa3b64(%rip), %xmm5    # 0x10b818
cvttsd2si %xmm5, %edx
leaq 0xbbc14(%rip), %rax     # 0x1238d3
leaq 0xb9861(%rip), %rsi     # 0x121527
cmovbq %rax, %rsi
leaq 0x2d454f(%rip), %r14    # 0x33c220
movq %r14, %rdi
xorl %eax, %eax
movapd %xmm4, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movapd -0x40(%rbp), %xmm0
ucomisd 0xa141b(%rip), %xmm0    # 0x109118
leaq 0xc67e0(%rip), %rax     # 0x12e4e4
leaq 0xbbbc7(%rip), %rsi     # 0x1238d2
cmovbq %rax, %rsi
mulsd 0xa3b09(%rip), %xmm0    # 0x10b820
divsd 0xa3af9(%rip), %xmm0    # 0x10b818
cvttsd2si %xmm0, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movapd -0x30(%rbp), %xmm0
ucomisd 0xa13d3(%rip), %xmm0    # 0x109118
leaq 0xb92e7(%rip), %rax     # 0x121033
leaq 0xb8d46(%rip), %rsi     # 0x120a99
cmovbq %rax, %rsi
divsd 0xa1349(%rip), %xmm0    # 0x1090a8
cvttsd2si %xmm0, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movq %rbx, %rdi
callq 0xa36fd
movl $0x1, %edi
callq 0xa3789
jmp 0x673b8
movsd 0xa12b9(%rip), %xmm0    # 0x109050
mulsd %xmm0, %xmm5
movsd 0xa3a7d(%rip), %xmm1    # 0x10b820
mulsd %xmm1, %xmm5
movsd 0xa3a69(%rip), %xmm2    # 0x10b818
divsd %xmm2, %xmm5
cvttsd2si %xmm5, %rdx
mulsd %xmm0, %xmm4
mulsd %xmm1, %xmm4
divsd %xmm2, %xmm4
cvttsd2si %xmm4, %rcx
cvttsd2si %xmm3, %r8
leaq 0x2d444b(%rip), %rbx    # 0x33c220
leaq 0xb8cc3(%rip), %rsi     # 0x120a9f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f2a0
leaq 0xb8aa4(%rip), %rdi     # 0x120899
callq 0x5f2a0
jmp 0x673b8
movl $0x32, %edi
movapd %xmm4, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x5e740
xorps %xmm0, %xmm0
cvtsd2ss -0x50(%rbp), %xmm0
callq 0x59440
xorps %xmm0, %xmm0
cvtsd2ss -0x40(%rbp), %xmm0
callq 0x59440
xorps %xmm0, %xmm0
cvtsd2ss -0x30(%rbp), %xmm0
callq 0x59440
callq 0x5e7c0
jmp 0x673b8
movsd 0xa39cf(%rip), %xmm0    # 0x10b820
mulsd %xmm0, %xmm5
movsd 0xa39bb(%rip), %xmm1    # 0x10b818
divsd %xmm1, %xmm5
movsd 0xb62af(%rip), %xmm2    # 0x11e118
mulsd %xmm2, %xmm5
cvttsd2si %xmm5, %ebx
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
mulsd %xmm2, %xmm4
cvttsd2si %xmm4, %r15d
mulsd 0xa11d6(%rip), %xmm3    # 0x109060
cvttsd2si %xmm3, %r14d
movss 0xa5139(%rip), %xmm0    # 0x10cfd0
movl $0x4, %edi
movl $0xff, %esi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movl $0xff, %edx
callq 0x5d081
movl $0x7d0, %edi            # imm = 0x7D0
callq 0xaff7
leaq 0xb8b32(%rip), %rdi     # 0x1209f7
callq 0x61694
movl %ebx, %edi
callq 0x593b5
movl %r15d, %edi
callq 0x593b5
movl %r14d, %edi
callq 0x593b5
xorl %edi, %edi
callq 0x591af
callq 0x6170f
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xaff7
movl $0x7, %edi
movl $0xff, %esi
movss 0xa50c7(%rip), %xmm0    # 0x10cfd0
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd %xmm0, %xmm3
movl $0xff, %edx
callq 0x5d081
jmp 0x673b8
leaq 0x1b3199(%rip), %rax    # 0x21b0c4
movl (%rax), %esi
movl $0x6, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x683cd
jmp 0x673b8
leaq 0xb8ae2(%rip), %rsi     # 0x120a31
leaq -0x350(%rbp), %rdi
movapd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
xorpd %xmm0, %xmm0
callq 0x63c5c
movq (%r12), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jg 0x67fd1
cmpq $0x8, %rax
je 0x68042
cmpq $0x100000, %rax         # imm = 0x100000
jne 0x68026
leaq 0xb8acb(%rip), %rdi     # 0x120a61
callq 0x5f15d
leaq 0x2d427e(%rip), %rbx    # 0x33c220
leaq 0xb8abf(%rip), %rsi     # 0x120a68
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
incq %rbx
movq %rbx, %rdi
callq 0x5f15d
jmp 0x673b8
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
je 0x673b8
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
jne 0x68026
leaq 0x2d4226(%rip), %rbx    # 0x33c220
leaq 0xb8a55(%rip), %rsi     # 0x120a56
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f1e8
jmp 0x673b8
leaq 0x1b2fb3(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x6808d
leaq 0x2d41e7(%rip), %rbx    # 0x33c220
leaq 0xb8a34(%rip), %rsi     # 0x120a74
jmp 0x6809b
leaq 0x2d41d7(%rip), %rbx    # 0x33c220
leaq 0xb8a3c(%rip), %rsi     # 0x120a8c
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5ee52
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xaff7
leaq 0xbc028(%rip), %rdi     # 0x1240ae
movl $0x65, %esi
jmp 0x680bb
leaq 0x2d418c(%rip), %rbx    # 0x33c220
leaq 0xb89eb(%rip), %rsi     # 0x120a86
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5ee52
jmp 0x673b8