// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: adjust_tz(int)
int adjust_tz(int why)
{
double st;
double jd;
int round_time;
static int last_why;

   // This routine adjusts the receiver time for the time zone and
   // various astronomical time scales. It sets the pri_xxxx variables to
   // the desired local time / astronomical time.
   //
//jd_utc = jdate(1873,12,29) + 0.50;
//jd_gps = jd_utc + jtime(0,0,utc_offset,0.0);


// dst_ofs = 0;
   jd = 0.0;
   round_time = 0;
   have_local_time = 0;

   jd_astro = jd_display = jd_local;
   if(use_gmst || use_lmst || use_merc || use_msd || use_pluto || use_ven || use_bessel) {
      if(use_msd) {
         st = jd_astro = mars_date(jd_tt);
         st = st - (int) st;
         st *= 24.0;
      }
      else if(use_ven || use_merc || use_pluto) {
         st = jd_astro = planet_date(jd_gps+jtime(0,0,0,TSX_TWEAK));
         st = st - (int) st;
         st *= 24.0;
      }
      else if(use_bessel) {
         st = bessel_date(jd_utc);  // bessel_date returns bessel date offset by year 1900
         jd_astro = 1900.0 + st;    // true bessel date

         st = st - (int) st;
         gregorian(0, jd_utc);
         st = jdate(g_year, 1, 1) + (st * 365.242198781);

         st = st - (int) st;
         st *= 24.0;
      }
      else if(use_gmst) st = gmst(jd_utc+jtime(0,0,0,TSX_TWEAK), use_gmst-1);
      else              st = lmst(jd_utc+jtime(0,0,0,TSX_TWEAK), use_lmst-1);

      pri_hours = (int) st;
      st = (st - pri_hours);       // decimal hour
      st *= 60.0;

      pri_minutes = (int) st;
      st = (st - pri_minutes);     // decimal minutes
      st *= 60.0;

      pri_seconds = (int) st;
      st = (st - pri_seconds);     // decimal seconds
      st_secs = st;                // remainder seconds

      pri_frac = st_secs;

      strcpy(tz_string, std_string);
      round_time = 1;
   }
   else {
//pri_year = 2006;  // Astronomical time scale test data from SOFA
//pri_month= 1;
//pri_day= 15;
//pri_hours = 21;
//pri_minutes = 24;
//pri_seconds = 37+14;
//pri_frac = 0.50;
      if(use_tai) {
         jd = tai_time(jd_gps);
         strcpy(tz_string, std_string);
      }
      else if(use_tt) {
         jd = jd_tt;  // TT is 51.184 seconds ahead of GPS
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_ut1) {
         delta_ut1 = (jtime(0, 0, 51+utc_offset, 0.184) - utc_delta_t());
//sprintf(debug_text3, "delta_ut1:%f", delta_ut1*24.0*3600.0);
         jd = jd_utc + delta_ut1;
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_tcg) {
         jd = tcg_time(jd_tt);
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_tdb) {  // accurate to < 50 uS
         jd = tdb_time(jd_tt);
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_tcb) {
         jd = tcb_time(jd_tt);

//jd = jd + (1.550519768e-8*(now - 2443144.5003725)*86400.0 + (-6.55e-5)); // calc TCB
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_hjd) {
         jd = jd_astro = get_hjd(jd_utc+jtime(0,0,0,TSX_TWEAK));
         strcpy(tz_string, std_string);
         round_time = 1;
      }
      else if(use_loran) {
         jd = loran_time(jd_gps);
         strcpy(tz_string, std_string);
         have_local_time = 1;
      }
      else if(use_gps) {
         jd = jd_gps;
         strcpy(tz_string, std_string);
         have_local_time = 2;
      }
      else if(use_utc) {
         jd = jd_utc;
         strcpy(tz_string, std_string);
         have_local_time = 3;
      }
      else if(solar_time) {
         jd = jd_utc + jtime(0,0,0,TSX_TWEAK);  // adjust time for receiver message delays
         jd += (eot(jd_utc) / (24.0*60.0));
         round_time = 1;
      }
      else {
         if(time_flags & TFLAGS_UTC) jd = jd_utc;  // we want UTC based times
         else                        jd = jd_gps;  // displaying GPS based times

         if((leap_time || leap_sixty) && (TSX_TWEAK < 0.0)) ;  // negative TSX_TWEAK would mess up leap second display
         else jd += jtime(0,0,0,TSX_TWEAK);    // adjust time for receiver message delays

         if(!solar_time) jd += time_zone();    // adjust time for the time zone

         have_local_time = 4;
      }


      if(leap_sixty) {  // receiver sent a time of xx:59:60
         gregorian(0, jd - jtime(0,0,1,0.0));   // convert adjusted Julian back to Gregorian
         g_seconds = 60;  // display leapsecond time to xx:59:60
      }
      else {
         gregorian(0, jd);
      }

round_time = 0;  // we no longer do time rounding
      if(round_time) {       // round time up to nearest second;
         jd += jtime(0,0,0, 0.5);
      }

      jd_display = jd;
      pri_day = g_day;         // set local time values to the adjusted time
      pri_month = g_month;
      pri_year = g_year;
      pri_hours = g_hours;        
      pri_minutes = g_minutes;
      pri_seconds = g_seconds;
      pri_frac = g_frac;       // note: usually 1msec fast due to rounding compensation in gregorian(0, )
      if(round_time) {
         pri_frac = g_frac = 0;
      }
   }

   last_why = why;
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
leaq 0x23721b(%rip), %rax    # 0x36c82c
movl $0x0, (%rax)
leaq 0x23710a(%rip), %rax    # 0x36c728
movsd (%rax), %xmm0
leaq 0x237107(%rip), %rax    # 0x36c730
movsd %xmm0, (%rax)
leaq 0x237104(%rip), %rax    # 0x36c738
movsd %xmm0, (%rax)
leaq 0x2374a1(%rip), %rax    # 0x36cae0
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237496(%rip), %rax    # 0x36cae1
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237496(%rip), %rax    # 0x36caed
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237489(%rip), %rax    # 0x36caec
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237480(%rip), %rax    # 0x36caef
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237473(%rip), %rax    # 0x36caee
cmpb $0x0, (%rax)
jne 0x135690
leaq 0x237469(%rip), %rax    # 0x36caf0
cmpb $0x0, (%rax)
je 0x1359f5
leaq 0x237455(%rip), %rax    # 0x36caec
cmpb $0x0, (%rax)
je 0x1356ea
leaq 0x23707d(%rip), %rax    # 0x36c720
movsd (%rax), %xmm0
callq 0x134f10
leaq 0x237085(%rip), %rax    # 0x36c738
movsd %xmm0, (%rax)
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x3995d(%rip), %xmm0    # 0x16f038
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x135917
leaq 0x2373fd(%rip), %rax    # 0x36caee
cmpb $0x0, (%rax)
jne 0x135712
leaq 0x2373f0(%rip), %rax    # 0x36caed
cmpb $0x0, (%rax)
jne 0x135712
leaq 0x2373e6(%rip), %rax    # 0x36caef
cmpb $0x0, (%rax)
je 0x135793
leaq 0x236fff(%rip), %rax    # 0x36c718
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
leaq 0x23797f(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x398fb(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x134f60
leaq 0x236fdc(%rip), %rax    # 0x36c738
movsd %xmm0, (%rax)
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x398b4(%rip), %xmm0    # 0x16f038
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x135915
leaq 0x237356(%rip), %rax    # 0x36caf0
cmpb $0x0, (%rax)
je 0x135859
leaq 0x236f66(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
callq 0x134fa0
movsd %xmm0, -0x10(%rbp)
movsd 0x58f30(%rip), %xmm0    # 0x18e6f0
addsd -0x10(%rbp), %xmm0
leaq 0x236f6c(%rip), %rax    # 0x36c738
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x236f22(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0x11dd00
leaq 0x237084(%rip), %rax    # 0x36c884
movl (%rax), %edi
movl $0x1, %edx
movl %edx, %esi
callq 0x122140
movaps %xmm0, %xmm1
movsd -0x10(%rbp), %xmm0
movsd 0x58e32(%rip), %xmm2    # 0x18e650
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x397ee(%rip), %xmm0    # 0x16f038
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x135913
leaq 0x237280(%rip), %rax    # 0x36cae0
cmpb $0x0, (%rax)
je 0x1358bc
leaq 0x236ea4(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x23782c(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x397a8(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq 0x237236(%rip), %rax    # 0x36cae0
movzbl (%rax), %edi
subl $0x1, %edi
callq 0x134fd0
movsd %xmm0, -0x10(%rbp)
jmp 0x135911
leaq 0x236e4d(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x2377d5(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x39751(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq 0x2371e0(%rip), %rax    # 0x36cae1
movzbl (%rax), %edi
subl $0x1, %edi
callq 0x135210
movsd %xmm0, -0x10(%rbp)
jmp 0x135913
jmp 0x135915
jmp 0x135917
cvttsd2si -0x10(%rbp), %ecx
leaq 0x236dc5(%rip), %rax    # 0x36c6e8
movl %ecx, (%rax)
movsd -0x10(%rbp), %xmm0
leaq 0x236db7(%rip), %rax    # 0x36c6e8
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x396d2(%rip), %xmm0    # 0x16f018
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
cvttsd2si -0x10(%rbp), %ecx
leaq 0x236d88(%rip), %rax    # 0x36c6e4
movl %ecx, (%rax)
movsd -0x10(%rbp), %xmm0
leaq 0x236d7a(%rip), %rax    # 0x36c6e4
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x39699(%rip), %xmm0    # 0x16f018
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
cvttsd2si -0x10(%rbp), %ecx
leaq 0x236d4b(%rip), %rax    # 0x36c6e0
movl %ecx, (%rax)
movsd -0x10(%rbp), %xmm0
leaq 0x236d3d(%rip), %rax    # 0x36c6e0
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
leaq 0x23713c(%rip), %rax    # 0x36caf8
movsd %xmm0, (%rax)
leaq 0x237131(%rip), %rax    # 0x36caf8
movsd (%rax), %xmm0
leaq 0x236d26(%rip), %rax    # 0x36c6f8
movsd %xmm0, (%rax)
leaq 0x23712f(%rip), %rdi    # 0x36cb0c
leaq 0x23711c(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135f7e
leaq 0x2370e7(%rip), %rax    # 0x36cae3
cmpb $0x0, (%rax)
je 0x135a2e
leaq 0x236d10(%rip), %rax    # 0x36c718
movsd (%rax), %xmm0
callq 0x135340
movsd %xmm0, -0x18(%rbp)
leaq 0x2370ef(%rip), %rdi    # 0x36cb0c
leaq 0x2370dc(%rip), %rsi    # 0x36cb00
callq 0x9350
jmp 0x135e49
leaq 0x2370af(%rip), %rax    # 0x36cae4
cmpb $0x0, (%rax)
je 0x135a69
leaq 0x236cdf(%rip), %rax    # 0x36c720
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x2370bb(%rip), %rdi    # 0x36cb0c
leaq 0x2370a8(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e47
leaq 0x237072(%rip), %rax    # 0x36cae2
cmpb $0x0, (%rax)
je 0x135aed
leaq 0x236e8c(%rip), %rax    # 0x36c908
movl (%rax), %edx
addl $0x33, %edx
xorl %esi, %esi
movsd 0x5882d(%rip), %xmm0    # 0x18e2b8
movl %esi, %edi
callq 0x122210
movsd %xmm0, -0x40(%rbp)
callq 0x119920
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
leaq 0x236c29(%rip), %rax    # 0x36c6d8
movsd %xmm0, (%rax)
leaq 0x236c56(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
leaq 0x236c13(%rip), %rax    # 0x36c6d8
addsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x237037(%rip), %rdi    # 0x36cb0c
leaq 0x237024(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e45
leaq 0x236ff1(%rip), %rax    # 0x36cae5
cmpb $0x0, (%rax)
je 0x135b2d
leaq 0x236c20(%rip), %rax    # 0x36c720
movsd (%rax), %xmm0
callq 0x135390
movsd %xmm0, -0x18(%rbp)
leaq 0x236ff7(%rip), %rdi    # 0x36cb0c
leaq 0x236fe4(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e43
leaq 0x236fb2(%rip), %rax    # 0x36cae6
cmpb $0x0, (%rax)
je 0x135b6d
leaq 0x236be0(%rip), %rax    # 0x36c720
movsd (%rax), %xmm0
callq 0x1353d0
movsd %xmm0, -0x18(%rbp)
leaq 0x236fb7(%rip), %rdi    # 0x36cb0c
leaq 0x236fa4(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e41
leaq 0x236f73(%rip), %rax    # 0x36cae7
cmpb $0x0, (%rax)
je 0x135bad
leaq 0x236ba0(%rip), %rax    # 0x36c720
movsd (%rax), %xmm0
callq 0x135490
movsd %xmm0, -0x18(%rbp)
leaq 0x236f77(%rip), %rdi    # 0x36cb0c
leaq 0x236f64(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e3f
leaq 0x236f34(%rip), %rax    # 0x36cae8
cmpb $0x0, (%rax)
je 0x135c2b
leaq 0x236b50(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq 0x2374d8(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x39454(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x134d70
leaq 0x236b35(%rip), %rax    # 0x36c738
movsd %xmm0, (%rax)
movsd %xmm0, -0x18(%rbp)
leaq 0x236ef9(%rip), %rdi    # 0x36cb0c
leaq 0x236ee6(%rip), %rsi    # 0x36cb00
callq 0x9350
movl $0x1, -0x1c(%rbp)
jmp 0x135e3d
leaq 0x236eb7(%rip), %rax    # 0x36cae9
cmpb $0x0, (%rax)
je 0x135c71
leaq 0x236ada(%rip), %rax    # 0x36c718
movsd (%rax), %xmm0
callq 0x1355a0
movsd %xmm0, -0x18(%rbp)
leaq 0x236eb9(%rip), %rdi    # 0x36cb0c
leaq 0x236ea6(%rip), %rsi    # 0x36cb00
callq 0x9350
leaq 0x236bc6(%rip), %rax    # 0x36c82c
movl $0x1, (%rax)
jmp 0x135e3b
leaq 0x236e72(%rip), %rax    # 0x36caea
cmpb $0x0, (%rax)
je 0x135cb2
leaq 0x236a94(%rip), %rax    # 0x36c718
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x236e78(%rip), %rdi    # 0x36cb0c
leaq 0x236e65(%rip), %rsi    # 0x36cb00
callq 0x9350
leaq 0x236b85(%rip), %rax    # 0x36c82c
movl $0x2, (%rax)
jmp 0x135e39
leaq 0x236e32(%rip), %rax    # 0x36caeb
cmpb $0x0, (%rax)
je 0x135cf3
leaq 0x236a4b(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x236e37(%rip), %rdi    # 0x36cb0c
leaq 0x236e24(%rip), %rsi    # 0x36cb00
callq 0x9350
leaq 0x236b44(%rip), %rax    # 0x36c82c
movl $0x3, (%rax)
jmp 0x135e37
leaq 0x236df7(%rip), %rax    # 0x36caf1
cmpb $0x0, (%rax)
je 0x135d74
leaq 0x236a0a(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq 0x237392(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x3930e(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x2369c7(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
callq 0x134540
movsd 0x3951e(%rip), %xmm1    # 0x16f278
divsd %xmm1, %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0x135e35
leaq 0x236909(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x135d97
leaq 0x236984(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x135da7
leaq 0x23697a(%rip), %rax    # 0x36c718
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x236882(%rip), %rax    # 0x36c630
cmpb $0x0, (%rax)
jne 0x135dbf
leaq 0x23664e(%rip), %rax    # 0x36c408
cmpl $0x0, (%rax)
je 0x135de1
leaq 0x2372e2(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm1
movsd 0x3925e(%rip), %xmm0    # 0x16f030
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x135de1
jmp 0x135e0d
leaq 0x2372c0(%rip), %rax    # 0x36d0a8
movsd (%rax), %xmm0
movsd 0x3923c(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x122210
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x236cdd(%rip), %rax    # 0x36caf1
cmpb $0x0, (%rax)
jne 0x135e28
callq 0x133f80
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x2369fd(%rip), %rax    # 0x36c82c
movl $0x4, (%rax)
jmp 0x135e37
jmp 0x135e39
jmp 0x135e3b
jmp 0x135e3d
jmp 0x135e3f
jmp 0x135e41
jmp 0x135e43
jmp 0x135e45
jmp 0x135e47
jmp 0x135e49
leaq 0x2365b8(%rip), %rax    # 0x36c408
cmpl $0x0, (%rax)
je 0x135e92
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
xorl %esi, %esi
movl $0x1, %edx
xorps %xmm0, %xmm0
movl %esi, %edi
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
subsd %xmm1, %xmm0
xorl %edi, %edi
callq 0x11dd00
leaq 0x236a06(%rip), %rax    # 0x36c890
movl $0x3c, (%rax)
jmp 0x135e9e
movsd -0x18(%rbp), %xmm0
xorl %edi, %edi
callq 0x11dd00
movl $0x0, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x135ec8
xorl %edx, %edx
movsd 0x391db(%rip), %xmm0    # 0x16f090
movl %edx, %edi
movl %edx, %esi
callq 0x122210
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
leaq 0x23685c(%rip), %rax    # 0x36c730
movsd %xmm0, (%rax)
leaq 0x2369a1(%rip), %rax    # 0x36c880
movl (%rax), %ecx
leaq 0x236804(%rip), %rax    # 0x36c6ec
movl %ecx, (%rax)
leaq 0x23698b(%rip), %rax    # 0x36c87c
movl (%rax), %ecx
leaq 0x2367f6(%rip), %rax    # 0x36c6f0
movl %ecx, (%rax)
leaq 0x236981(%rip), %rax    # 0x36c884
movl (%rax), %ecx
leaq 0x2367e8(%rip), %rax    # 0x36c6f4
movl %ecx, (%rax)
leaq 0x236973(%rip), %rax    # 0x36c888
movl (%rax), %ecx
leaq 0x2367ca(%rip), %rax    # 0x36c6e8
movl %ecx, (%rax)
leaq 0x236965(%rip), %rax    # 0x36c88c
movl (%rax), %ecx
leaq 0x2367b4(%rip), %rax    # 0x36c6e4
movl %ecx, (%rax)
leaq 0x236957(%rip), %rax    # 0x36c890
movl (%rax), %ecx
leaq 0x23679e(%rip), %rax    # 0x36c6e0
movl %ecx, (%rax)
leaq 0x23694d(%rip), %rax    # 0x36c898
movsd (%rax), %xmm0
leaq 0x2367a2(%rip), %rax    # 0x36c6f8
movsd %xmm0, (%rax)
cmpl $0x0, -0x1c(%rbp)
je 0x135f7c
leaq 0x236931(%rip), %rax    # 0x36c898
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
leaq 0x236783(%rip), %rax    # 0x36c6f8
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x135f7e
movl -0x4(%rbp), %eax
movl %eax, 0x2a3cf5(%rip)    # 0x3d9c7c
movl $0x1, %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)