// File: /workspace/github_cpp_makefile_star2_O3/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 0x2cfb37(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x674e9
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 0x1b3ed2(%rip), %rax    # 0x21b3e0
movb $0x1, (%rax)
leaq 0x2a6098(%rip), %rax    # 0x30d5b0
movl $0x1, (%rax)
leaq 0x1d7a19(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x67568
leaq 0x2a5a9f(%rip), %rax    # 0x30cfd0
movsd %xmm5, (%rax)
leaq 0x2a5a9c(%rip), %rax    # 0x30cfd8
movsd %xmm4, (%rax)
leaq 0x2a5a99(%rip), %rax    # 0x30cfe0
movsd %xmm3, (%rax)
leaq 0x1b12f2(%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 0x1b1361(%rip), %r12    # 0x2188d0
movq (%r12), %rdx
movabsq $0x105b8b0400, %rax     # imm = 0x105B8B0400
testq %rax, %rdx
jne 0x675a2
leaq 0x1b3a47(%rip), %rax    # 0x21afd0
cmpl $0x0, (%rax)
je 0x67663
leaq 0x2a5e2b(%rip), %rax    # 0x30d3c4
cmpl $0x0, (%rax)
jne 0x67663
cmpq $0x800000, %rdx         # imm = 0x800000
jne 0x6752a
leaq 0x2a5a1a(%rip), %rbx    # 0x30cfd0
movsd (%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
leaq 0x2a5a0f(%rip), %r14    # 0x30cfd8
jne 0x67607
jp 0x67607
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
jne 0x67607
jp 0x67607
movl $0x7, %edi
movl $0x155b, %esi           # imm = 0x155B
movapd %xmm4, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x1118c
movapd -0x50(%rbp), %xmm5
movapd -0x30(%rbp), %xmm3
movapd -0x40(%rbp), %xmm4
movsd %xmm5, (%rbx)
movsd %xmm4, (%r14)
leaq 0x2a59c9(%rip), %rax    # 0x30cfe0
movsd %xmm3, (%rax)
leaq 0x2d3cee(%rip), %rax    # 0x33b310
movsd %xmm5, (%rax)
leaq 0x2d3ceb(%rip), %rax    # 0x33b318
movsd %xmm4, (%rax)
leaq 0x2d3ce8(%rip), %rax    # 0x33b320
movsd %xmm3, (%rax)
leaq 0x2a5efd(%rip), %rax    # 0x30d540
movsd (%rax), %xmm0
callq 0xe7272
leaq 0x2a5edd(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xe823e
jmp 0x6754b
cmpq $0x400000, %rdx         # imm = 0x400000
sete %al
leaq 0x2a6340(%rip), %rbx    # 0x30d9b4
cmpl $0x0, (%rbx)
sete %cl
cmpq $0x4000, %rdx           # imm = 0x4000
je 0x6752a
andb %cl, %al
jne 0x6752a
cmpq $0x7fff, %rdx           # imm = 0x7FFF
jle 0x6773b
cmpq $0x7fffff, %rdx         # imm = 0x7FFFFF
jle 0x6777a
cmpq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
jle 0x67a12
movabsq $0x400000000, %rax      # imm = 0x400000000
cmpq %rax, %rdx
je 0x678d4
movabsq $0x100000000, %rax      # imm = 0x100000000
cmpq %rax, %rdx
je 0x678d4
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, %rdx
jne 0x6754b
movsd 0xa413e(%rip), %xmm0    # 0x10b830
mulsd %xmm0, %xmm5
movsd 0xa412a(%rip), %xmm1    # 0x10b828
divsd %xmm1, %xmm5
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
cvttsd2si %xmm3, %edx
leaq 0x2d4b0b(%rip), %rbx    # 0x33c220
leaq 0xb933f(%rip), %rsi     # 0x120a5b
movq %rbx, %rdi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movb $0x2, %al
callq 0x9060
movq %rbx, %rdi
callq 0x5ee9b
jmp 0x6754b
cmpq $0x1f, %rdx
jg 0x677a2
cmpq $0x7, %rdx
jg 0x678c4
cmpq $0x1, %rdx
je 0x67f92
cmpq $0x4, %rdx
jne 0x6754b
movl $0x2, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x682ae
jmp 0x6754b
cmpq $0x1fffff, %rdx         # imm = 0x1FFFFF
jg 0x677e1
cmpq $0x8000, %rdx           # imm = 0x8000
je 0x67e22
cmpq $0x100000, %rdx         # imm = 0x100000
je 0x678d4
jmp 0x6754b
cmpq $0xff, %rdx
jg 0x67987
cmpq $0x20, %rdx
je 0x67fdc
cmpq $0x80, %rdx
jne 0x6754b
movl $0x2, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x66d89
jmp 0x6754b
cmpq $0x200000, %rdx         # imm = 0x200000
je 0x67f22
cmpq $0x400000, %rdx         # imm = 0x400000
jne 0x6754b
movsd 0xa402d(%rip), %xmm0    # 0x10b830
movapd %xmm5, %xmm1
mulsd %xmm0, %xmm1
movsd 0xa4015(%rip), %xmm2    # 0x10b828
divsd %xmm2, %xmm1
movapd %xmm3, -0x30(%rbp)
movsd 0xb699c(%rip), %xmm3    # 0x11e1c0
mulsd %xmm3, %xmm1
cvttsd2si %xmm1, %edi
mulsd %xmm4, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %esi
movsd 0xa181c(%rip), %xmm0    # 0x109060
mulsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %edx
movapd %xmm4, -0x40(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x68258
callq 0x65965
callq 0x65885
movapd -0x50(%rbp), %xmm2
movapd -0x30(%rbp), %xmm1
movapd -0x40(%rbp), %xmm0
leaq 0x2a613c(%rip), %rax    # 0x30d9b8
cmpl $0x0, (%rax)
je 0x6754b
cmpl $0x0, (%rbx)
jne 0x6754b
leaq 0x2a620b(%rip), %rax    # 0x30daa0
cmpl $0x0, (%rax)
jne 0x6754b
leaq 0x2a572b(%rip), %rax    # 0x30cfd0
movsd %xmm2, (%rax)
leaq 0x2a5728(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
leaq 0x2a5725(%rip), %rax    # 0x30cfe0
movsd %xmm1, (%rax)
jmp 0x6754b
cmpq $0x8, %rdx
je 0x678d4
cmpq $0x10, %rdx
jne 0x6754b
mulsd 0xa3f54(%rip), %xmm5    # 0x10b830
divsd 0xa3f44(%rip), %xmm5    # 0x10b828
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
ucomisd %xmm0, %xmm5
setb %cl
jae 0x678fb
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 0xa16ef(%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 0x67c30
movabsq $0x100000000, %rsi      # imm = 0x100000000
cmpq %rsi, %rdx
je 0x67bfb
movabsq $0x400000000, %rsi      # imm = 0x400000000
cmpq %rsi, %rdx
jne 0x67c55
leaq 0xb9165(%rip), %rsi     # 0x120ada
leaq -0x150(%rbp), %rdi
movl %eax, %edx
movapd %xmm5, %xmm0
jmp 0x67c4c
cmpq $0x100, %rdx            # imm = 0x100
je 0x680b7
cmpq $0x800, %rdx            # imm = 0x800
jne 0x6754b
movss 0xa56bf(%rip), %xmm0    # 0x10d068
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 0x5cf59
movl $0xf, %edi
callq 0x5e6be
movl $0x3, %edi
callq 0x590f7
movaps -0x50(%rbp), %xmm0
callq 0x593bd
movaps -0x40(%rbp), %xmm0
callq 0x593bd
movapd -0x30(%rbp), %xmm0
callq 0x593bd
callq 0x5e7c0
jmp 0x6754b
cmpq $0x800000, %rdx         # imm = 0x800000
je 0x675af
cmpq $0x20000000, %rdx       # imm = 0x20000000
jne 0x6754b
movapd %xmm4, -0x40(%rbp)
cvttsd2si %xmm3, %edx
cvttpd2dq %xmm3, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
mulsd 0xa165b(%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 0xb8fff(%rip), %rax     # 0x120a7d
leaq 0xb900b(%rip), %rsi     # 0x120a90
cmovaq %rax, %rsi
leaq 0x2d4790(%rip), %rbx    # 0x33c220
movq %rbx, %rdi
xorl %eax, %eax
movapd %xmm5, -0x50(%rbp)
callq 0x9060
movq %rbx, %rdi
callq 0x5eff8
xorpd %xmm0, %xmm0
movapd -0x50(%rbp), %xmm1
mulsd 0xa3d78(%rip), %xmm1    # 0x10b830
divsd 0xa3d68(%rip), %xmm1    # 0x10b828
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %cl
jbe 0x67ad3
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 0xa1513(%rip), %xmm1    # 0x109008
mulsd 0xa15db(%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 0xb8f7a(%rip), %rsi     # 0x120aa2
leaq -0x150(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movapd -0x40(%rbp), %xmm1
mulsd 0xa3cea(%rip), %xmm1    # 0x10b830
divsd 0xa3cda(%rip), %xmm1    # 0x10b828
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x67b60
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 0xa1481(%rip), %xmm1    # 0x109008
mulsd 0xa1549(%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 0xb8ef9(%rip), %rsi     # 0x120ab3
leaq -0x250(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0xb8ef2(%rip), %rsi     # 0x120ac4
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f0e5
leaq 0xb8ee0(%rip), %rdi     # 0x120ad1
callq 0x5eff8
jmp 0x6754b
divsd 0xa1405(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
mulsd 0xa1451(%rip), %xmm1    # 0x109060
addsd %xmm0, %xmm1
leaq 0xb8ed1(%rip), %rsi     # 0x120aeb
leaq -0x150(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ecx, %edx
movb $0x1, %al
callq 0x9060
jmp 0x67c73
divsd 0xa13d0(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
leaq 0xb8ea5(%rip), %rsi     # 0x120ae8
leaq -0x150(%rbp), %rdi
movl %eax, %edx
movb $0x1, %al
callq 0x9060
jmp 0x67c73
cvttsd2si %xmm5, %r8d
leaq 0xb8e92(%rip), %rsi     # 0x120af3
leaq -0x150(%rbp), %rdi
movl %ecx, %edx
movl %eax, %ecx
movb $0x1, %al
callq 0x9060
movapd -0x40(%rbp), %xmm3
mulsd 0xa3bb0(%rip), %xmm3    # 0x10b830
divsd 0xa3ba0(%rip), %xmm3    # 0x10b828
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
movl $0x57, %eax
movl $0x45, %ebx
cmovbl %eax, %ebx
jae 0x67ca7
subsd %xmm3, %xmm0
movapd %xmm0, %xmm3
movsd 0xa1359(%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 0x67dc9
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
je 0x67d71
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
jne 0x67df9
leaq 0x2a52cf(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
cvttsd2si -0x30(%rbp), %edx
leaq 0xb9324(%rip), %rax     # 0x12104d
leaq 0xb93e2(%rip), %rsi     # 0x121112
cmovbq %rax, %rsi
leaq -0x350(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
movapd %xmm3, -0x40(%rbp)
callq 0x9060
leaq 0xb8daf(%rip), %rsi     # 0x120b00
leaq -0x250(%rbp), %rdi
movl %r14d, %edx
movapd -0x40(%rbp), %xmm0
movl %ebx, %ecx
movq %r15, %r8
movb $0x1, %al
callq 0x9060
jmp 0x680f5
divsd 0xa128f(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
mulsd 0xa12db(%rip), %xmm1    # 0x109060
addsd %xmm0, %xmm1
leaq 0xb8d5b(%rip), %rsi     # 0x120aeb
leaq -0x250(%rbp), %rdi
movapd %xmm1, %xmm0
movl %ebx, %edx
movb $0x1, %al
callq 0x9060
leaq 0x2a5235(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x680db
leaq 0xbc188(%rip), %rsi     # 0x123f4c
jmp 0x680e2
divsd 0xa1237(%rip), %xmm0    # 0x109008
addsd %xmm2, %xmm0
leaq 0xb8d3b(%rip), %rsi     # 0x120b17
leaq -0x250(%rbp), %rdi
movl %r14d, %edx
movl %ebx, %ecx
movapd -0x30(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x680f5
cvttsd2si %xmm3, %r8d
leaq 0xb8d22(%rip), %rsi     # 0x120b27
leaq -0x250(%rbp), %rdi
movl %ebx, %edx
movl %r14d, %ecx
movapd -0x30(%rbp), %xmm1
movb $0x2, %al
callq 0x9060
jmp 0x680f5
leaq -0x150(%rbp), %rbx
movl $0x504953, (%rbx)       # imm = 0x504953
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
mulsd 0xa39f1(%rip), %xmm5    # 0x10b830
divsd 0xa39e1(%rip), %xmm5    # 0x10b828
cvttsd2si %xmm5, %edx
leaq 0xbbb61(%rip), %rax     # 0x1239b3
leaq 0xb97ae(%rip), %rsi     # 0x121607
cmovbq %rax, %rsi
leaq 0x2d43bc(%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 0xa1288(%rip), %xmm0    # 0x109118
leaq 0xc673d(%rip), %rax     # 0x12e5d4
leaq 0xbbb14(%rip), %rsi     # 0x1239b2
cmovbq %rax, %rsi
mulsd 0xa3986(%rip), %xmm0    # 0x10b830
divsd 0xa3976(%rip), %xmm0    # 0x10b828
cvttsd2si %xmm0, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
movapd -0x30(%rbp), %xmm0
ucomisd 0xa1240(%rip), %xmm0    # 0x109118
leaq 0xb9234(%rip), %rax     # 0x121113
leaq 0xb8c93(%rip), %rsi     # 0x120b79
cmovbq %rax, %rsi
divsd 0xa11b6(%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 0xa3914
movl $0x1, %edi
callq 0xa39a0
jmp 0x6754b
movsd 0xa1126(%rip), %xmm0    # 0x109050
mulsd %xmm0, %xmm5
movsd 0xa38fa(%rip), %xmm1    # 0x10b830
mulsd %xmm1, %xmm5
movsd 0xa38e6(%rip), %xmm2    # 0x10b828
divsd %xmm2, %xmm5
cvttsd2si %xmm5, %rdx
mulsd %xmm0, %xmm4
mulsd %xmm1, %xmm4
divsd %xmm2, %xmm4
cvttsd2si %xmm4, %rcx
cvttsd2si %xmm3, %r8
leaq 0x2d42b8(%rip), %rbx    # 0x33c220
leaq 0xb8c10(%rip), %rsi     # 0x120b7f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f228
leaq 0xb89f1(%rip), %rdi     # 0x120979
callq 0x5f228
jmp 0x6754b
movl $0x32, %edi
movapd %xmm4, -0x40(%rbp)
movapd %xmm3, -0x30(%rbp)
movapd %xmm5, -0x50(%rbp)
callq 0x5e6be
xorps %xmm0, %xmm0
cvtsd2ss -0x50(%rbp), %xmm0
callq 0x59376
xorps %xmm0, %xmm0
cvtsd2ss -0x40(%rbp), %xmm0
callq 0x59376
xorps %xmm0, %xmm0
cvtsd2ss -0x30(%rbp), %xmm0
callq 0x59376
callq 0x5e73c
jmp 0x6754b
movsd 0xa384c(%rip), %xmm0    # 0x10b830
mulsd %xmm0, %xmm5
movsd 0xa3838(%rip), %xmm1    # 0x10b828
divsd %xmm1, %xmm5
movsd 0xb61c4(%rip), %xmm2    # 0x11e1c0
mulsd %xmm2, %xmm5
cvttsd2si %xmm5, %ebx
mulsd %xmm0, %xmm4
divsd %xmm1, %xmm4
mulsd %xmm2, %xmm4
cvttsd2si %xmm4, %r15d
mulsd 0xa1043(%rip), %xmm3    # 0x109060
cvttsd2si %xmm3, %r14d
movss 0xa503e(%rip), %xmm0    # 0x10d068
movl $0x4, %edi
movl $0xff, %esi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movl $0xff, %edx
callq 0x5cf59
movl $0x7d0, %edi            # imm = 0x7D0
callq 0xafe8
leaq 0xb8a7f(%rip), %rdi     # 0x120ad7
callq 0x6160d
movl %ebx, %edi
callq 0x592eb
movl %r15d, %edi
callq 0x592eb
movl %r14d, %edi
callq 0x592eb
xorl %edi, %edi
callq 0x590f7
callq 0x61688
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xafe8
movl $0x7, %edi
movl $0xff, %esi
movss 0xa4fcc(%rip), %xmm0    # 0x10d068
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd %xmm0, %xmm3
movl $0xff, %edx
callq 0x5cf59
jmp 0x6754b
leaq 0x1b3006(%rip), %rax    # 0x21b0c4
movl (%rax), %esi
movl $0x6, %edi
movapd %xmm5, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
callq 0x68563
jmp 0x6754b
leaq 0xb8a2f(%rip), %rsi     # 0x120b11
leaq -0x350(%rbp), %rdi
movapd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
xorpd %xmm0, %xmm0
callq 0x63ce2
movq (%r12), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jg 0x68164
cmpq $0x8, %rax
je 0x681d5
cmpq $0x100000, %rax         # imm = 0x100000
jne 0x681b9
leaq 0xb8a18(%rip), %rdi     # 0x120b41
callq 0x5f0e5
leaq 0x2d40eb(%rip), %rbx    # 0x33c220
leaq 0xb8a0c(%rip), %rsi     # 0x120b48
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
incq %rbx
movq %rbx, %rdi
callq 0x5f0e5
jmp 0x6754b
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
je 0x6754b
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
jne 0x681b9
leaq 0x2d4093(%rip), %rbx    # 0x33c220
leaq 0xb89a2(%rip), %rsi     # 0x120b36
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f170
jmp 0x6754b
leaq 0x1b2e20(%rip), %rax    # 0x21afe0
cmpl $0x4e, (%rax)
jne 0x68220
leaq 0x2d4054(%rip), %rbx    # 0x33c220
leaq 0xb8981(%rip), %rsi     # 0x120b54
jmp 0x6822e
leaq 0x2d4044(%rip), %rbx    # 0x33c220
leaq 0xb8989(%rip), %rsi     # 0x120b6c
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5edda
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xafe8
leaq 0xbbf75(%rip), %rdi     # 0x12418e
movl $0x65, %esi
jmp 0x6824e
leaq 0x2d3ff9(%rip), %rbx    # 0x33c220
leaq 0xb8938(%rip), %rsi     # 0x120b66
leaq -0x150(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5edda
jmp 0x6754b