// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: moon_posn(double)
void moon_posn(double jd_tt)
{
//************************************************************************************
//   Moon positions to a few minutes of arc
//   Derived from code by Paul Schlyter at
//       http://hotel04.ausys.se/pausch/comp/ppcomp.html
//
double Nm;
double im;
double wm;
double am;
double ecm;
double Mm;

double Ns;
double isun;
double ws;
double asun;
double ecs;
double Ms;

double Em;
double xv;
double yv;
double vm;
double rm;
double xh;
double yh;
double zh;

double mlon;
double mlat;

double dlon;
double dlat;

double Ls;
double Lm;
double dm;
double F;

double xg;
double yg;
double zg;

double ecl;
double xe;
double ye;
double ze;

double geora, geodec;        // geocentric ra and dec
double ra, dec;              // topocentric ra and dec
double xtop,ytop,ztop, rtop;

double cosha;     // for converting RA/DEC to az/el
double sinha;
double cosd;
double sind;
double cosl;
double sinl;


//
//   the time should be TT/TDT, but UT will do
//

double d;
double h;

double lst;
double ha;
double jd;

   // NOTE: Epoch used here is NOT J2000
   if(0) {
      h = jtime(hours,minutes,seconds,raw_frac);
      h += utc_delta_t();
      d = jd = jdate(year,month,day) + h;
   }
   else {
      d = jd = jd_tt;
      h = (d-0.50) - (int) (d-0.50);
   }

   d = jd - jdate(1999,12,31);
   h *= 24.0;  // convert fractional days to hours


//   moon elements

   Nm = FNrange((125.1228 - .0529538083 * d) * DEG_TO_RAD);
   im = 5.1454 * DEG_TO_RAD;
   wm = FNrange((318.0634 + .1643573223 * d) * DEG_TO_RAD);
   am = 60.2666;  // (Earth radii)
   ecm = .0549;
   Mm = FNrange((115.3654 + 13.0649929509 * d) * DEG_TO_RAD);

//   sun elements
   Ns = 0.0;
   isun = 0.0;
   ws = FNrange((282.9404 + 4.70935E-05 * d) * DEG_TO_RAD);
   asun = 1.0;        //(AU)
   ecs = .016709 - 1.151E-09 * d;
   Ms = FNrange((356.047 + .9856002585 * d) * DEG_TO_RAD);

//   position of Moon
   Em = Mm + ecm * sin(Mm) * (1.0 + ecm * cos(Mm));
   xv = am * (cos(Em) - ecm);
   yv = am * (sqrt(1.0 - ecm * ecm) * sin(Em));
   vm = FNatn2(yv, xv);
   rm = sqrt(xv * xv + yv * yv);
   xh = rm * (cos(Nm) * cos(vm + wm) - sin(Nm) * sin(vm + wm) * cos(im));
   yh = rm * (sin(Nm) * cos(vm + wm) + cos(Nm) * sin(vm + wm) * cos(im));
   zh = rm * (sin(vm + wm) * sin(im));

//   moons geocentric lon and lat
   mlon = FNatn2(yh, xh);
   mlat = FNatn2(zh, sqrt(xh*xh + yh*yh));

//   perturbations:
//   first calculate arguments below, which should be in radians
//   Ms, Mm   Mean Anomaly of the Sun and the Moon
//   Nm       Longitude of the Moon's node
//   ws, wm   Argument of perihelion for the Sun and the Moon
   Ls = Ms + ws;       //Mean Longitude of the Sun  (Ns=0)
   Lm = Mm + wm + Nm;  //Mean longitude of the Moon
   dm = Lm - Ls;       //Mean elongation of the Moon
   F = Lm - Nm;        //Argument of latitude for the Moon

// then add the following terms to the longitude
// note amplitudes are in degrees, convert at end
   dlon = -1.274 * sin(Mm - 2.0 * dm);        //(the Evection)
   dlon = dlon + .658 * sin(2.0 * dm);        //(the Variation)
   dlon = dlon - .186 * sin(Ms);            //(the Yearly Equation)
   dlon = dlon - .059 * sin(2.0 * Mm - 2.0 * dm);
   dlon = dlon - .057 * sin(Mm - 2.0 * dm + Ms);
   dlon = dlon + .053 * sin(Mm + 2.0 * dm);
   dlon = dlon + .046 * sin(2.0 * dm - Ms);
   dlon = dlon + .041 * sin(Mm - Ms);
   dlon = dlon - .035 * sin(dm);            //(the Parallactic Equation)
   dlon = dlon - .031 * sin(Mm + Ms);
   dlon = dlon - .015 * sin(2.0 * F - 2.0 * dm);
   dlon = dlon + .011 * sin(Mm - 4.0 * dm);
   mlon = dlon * DEG_TO_RAD + mlon;

//   latitude terms
   dlat = -.173 * sin(F - 2.0 * dm);
   dlat = dlat - .055 * sin(Mm - F - 2.0 * dm);
   dlat = dlat - .046 * sin(Mm + F - 2.0 * dm);
   dlat = dlat + .033 * sin(F + 2.0 * dm);
   dlat = dlat + .017 * sin(2.0 * Mm + F);
   mlat = dlat * DEG_TO_RAD + mlat;

   moon_phase_acc = (1.0 - cos((mlon*180.0/PI-sun_hlon)*DEG_TO_RAD))/2.0;

//   distance terms earth radii
   rm = rm - .58 * cos(Mm - 2.0 * dm);
   rm = rm - .46 * cos(2.0 * dm);

   moon_lat = fmod(mlat*180.0/PI, 360.0);
   if(moon_lat < 0.0) moon_lat += 360.0;
   moon_lon = fmod(mlon*180.0/PI, 360.0);
   if(moon_lon < 0.0) moon_lon += 360.0;
   moon_dist = rm * earth_radius(lat, alt)*1000.0;
//sprintf(debug_text, "moon lla: %.9f %.9f %.9f", moon_lat, moon_lon, moon_dist);

//   next find the cartesian coordinates
//   of the geocentric lunar position
   xg = rm * cos(mlon) * cos(mlat);
   yg = rm * sin(mlon) * cos(mlat);
   zg = rm * sin(mlat);
//sprintf(debug_text2, "xyzg: %.9f %.9f %.9f", xg*EQU_RADIUS,yg*EQU_RADIUS,zg*EQU_RADIUS);

//   rotate to equatorial coords
//   obliquity of ecliptic of date
// ecl = (23.4393 - 3.563E-07 * d) * DEG_TO_RAD;
   ecl = obliquity(jd, 1);
   xe = xg;
   ye = yg * cos(ecl) - zg * sin(ecl);
   ze = yg * sin(ecl) + zg * cos(ecl);
//sprintf(plot_title, "xyze: %.9f %.9f %.9f", xe*EQU_RADIUS,ye*EQU_RADIUS,ze*EQU_RADIUS);

//   geocentric RA and Dec
   geora = FNatn2(ye,xe) * RAD_TO_DEG / 15.0;
   if(xe || ye) geodec = atan(ze / sqrt(xe*xe + ye*ye)) * RAD_TO_DEG;
   else geodec = 1.0;


   // Calculate local sidereal time.
   // We adjust d by -1.5 days since d's epoch is NOT J2000 and this equation
   // assumes J2000
   lst = 100.46 + (.985647352 * (d-1.50)) + (h * 15.0) + lon*RAD_TO_DEG;
   lst = FNrange(lst*DEG_TO_RAD)*RAD_TO_DEG;
//lst =  lmst(jd_tt, 0)*15.0;
//// while(lst < 0.0) lst += 360.0;
//// while(lst > 360.0) lst -= 360.0;

   
   // calculate the moon's topocentric coords
   xtop = xe - cos(lat) * cos(lst*DEG_TO_RAD);
   ytop = ye - cos(lat) * sin(lst*DEG_TO_RAD);
   ztop = ze - sin(lat);
//sprintf(debug_text, "xyztop: %.9f %.9f %.9f", xtop,ytop,ztop);
   rtop = sqrt(xtop * xtop + ytop * ytop + ztop * ztop);
   ra = FNatn2(ytop, xtop) * RAD_TO_DEG;
   if(xtop || ytop) dec = atan(ztop / sqrt(xtop * xtop + ytop * ytop));
   else dec = 1.0;

   // convert ra and dec to az and el 
   ha = (lst - ra) * DEG_TO_RAD;
   cosha = cos(ha);
   sinha = sin(ha);
   cosd = cos(dec);
   sind = sin(dec);
   cosl = cos(lat);
   sinl = sin(lat);

   moon_az = atan2(-cosd*sinha, cosl*sind - sinl*cosd*cosha) * RAD_TO_DEG;
   if(moon_az < 0.0) moon_az = 360.0 + moon_az;

   moon_el = asin(sinl*sind + cosl*cosd*cosha);
   moon_el *= RAD_TO_DEG;

   set_sat_azel(MOON_PRN, (float) moon_az, (float) moon_el);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x380, %rsp            # imm = 0x380
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x1b8(%rbp)
movsd %xmm0, -0x198(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x33aab(%rip), %xmm1    # 0x16f090
subsd %xmm1, %xmm0
movsd -0x198(%rbp), %xmm1
movsd 0x33a97(%rip), %xmm2    # 0x16f090
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x1b8(%rbp), %xmm0
movsd %xmm0, -0x2e8(%rbp)
movl $0x7cf, %edi            # imm = 0x7CF
movl $0xc, %esi
movl $0x1f, %edx
callq 0x122140
movaps %xmm0, %xmm1
movsd -0x2e8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x198(%rbp)
movsd 0x339e4(%rip), %xmm0    # 0x16f038
mulsd -0x1a0(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x532cc(%rip), %xmm1    # 0x18e940
mulsd %xmm1, %xmm0
movsd 0x532c8(%rip), %xmm1    # 0x18e948
addsd %xmm1, %xmm0
movsd 0x36004(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x13b470
movsd %xmm0, -0x10(%rbp)
movsd 0x53296(%rip), %xmm0    # 0x18e938
movsd %xmm0, -0x18(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x53271(%rip), %xmm1    # 0x18e928
mulsd %xmm1, %xmm0
movsd 0x5326d(%rip), %xmm1    # 0x18e930
addsd %xmm1, %xmm0
movsd 0x35fc1(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x13b470
movsd %xmm0, -0x20(%rbp)
movsd 0x5323b(%rip), %xmm0    # 0x18e920
movsd %xmm0, -0x28(%rbp)
movsd 0x53106(%rip), %xmm0    # 0x18e7f8
movsd %xmm0, -0x30(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x53209(%rip), %xmm1    # 0x18e910
mulsd %xmm1, %xmm0
movsd 0x53205(%rip), %xmm1    # 0x18e918
addsd %xmm1, %xmm0
movsd 0x35f71(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x13b470
movsd %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x531b3(%rip), %xmm1    # 0x18e900
mulsd %xmm1, %xmm0
movsd 0x531af(%rip), %xmm1    # 0x18e908
addsd %xmm1, %xmm0
movsd 0x35f2b(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x13b470
movsd %xmm0, -0x50(%rbp)
movsd 0x338ed(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x58(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x53160(%rip), %xmm1    # 0x18e8f0
mulsd %xmm1, %xmm0
movsd 0x5315c(%rip), %xmm1    # 0x18e8f8
addsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x5312b(%rip), %xmm1    # 0x18e8e0
mulsd %xmm1, %xmm0
movsd 0x53127(%rip), %xmm1    # 0x18e8e8
addsd %xmm1, %xmm0
movsd 0x35ec3(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x13b470
movsd %xmm0, -0x68(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x2d0(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x2e0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x2c8(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x2d8(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x96f0
movsd -0x2d8(%rbp), %xmm2
movsd -0x2d0(%rbp), %xmm1
movaps %xmm0, %xmm3
movsd -0x2c8(%rbp), %xmm0
mulsd %xmm3, %xmm2
movsd 0x33814(%rip), %xmm3    # 0x16f068
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x2c0(%rbp)
movsd -0x70(%rbp), %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd -0x2c0(%rbp), %xmm0
subsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x2b0(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x33799(%rip), %xmm1    # 0x16f068
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0x2b8(%rbp)
movsd -0x70(%rbp), %xmm0
callq 0x9080
movsd -0x2b8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x2b0(%rbp), %xmm0
mulsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
callq 0x13b520
movsd %xmm0, -0x88(%rbp)
movsd -0x78(%rbp), %xmm0
movsd -0x78(%rbp), %xmm2
movsd -0x80(%rbp), %xmm1
mulsd -0x80(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x298(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x290(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x2a8(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x2a8(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x2a0(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x96f0
movsd -0x2a0(%rbp), %xmm2
movsd -0x298(%rbp), %xmm1
movsd -0x290(%rbp), %xmm3
movaps %xmm0, %xmm4
movsd -0x288(%rbp), %xmm0
mulsd %xmm4, %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x260(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x270(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x268(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x280(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x280(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x278(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x96f0
movsd -0x278(%rbp), %xmm2
movsd -0x270(%rbp), %xmm1
movsd -0x268(%rbp), %xmm3
movaps %xmm0, %xmm4
movsd -0x260(%rbp), %xmm0
mulsd %xmm4, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x258(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9080
movsd -0x258(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x250(%rbp), %xmm0
mulsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
callq 0x13b520
movsd %xmm0, -0xb0(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x248(%rbp)
movsd -0x98(%rbp), %xmm0
movsd -0x98(%rbp), %xmm2
movsd -0xa0(%rbp), %xmm1
mulsd -0xa0(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9280
movaps %xmm0, %xmm1
movsd -0x248(%rbp), %xmm0
callq 0x13b520
movsd %xmm0, -0xb8(%rbp)
movsd -0x68(%rbp), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
subsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xd8(%rbp), %xmm0
subsd -0x10(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd 0x52cbb(%rip), %xmm0    # 0x18e8d8
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x240(%rbp)
movsd 0x3350f(%rip), %xmm0    # 0x16f150
mulsd -0xe0(%rbp), %xmm0
callq 0x9080
movsd -0x240(%rbp), %xmm1
movsd 0x52c72(%rip), %xmm2    # 0x18e8d0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x238(%rbp)
movsd -0x68(%rbp), %xmm0
callq 0x9080
movsd -0x238(%rbp), %xmm1
movsd 0x52c30(%rip), %xmm2    # 0x18e8c8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x230(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x3348b(%rip), %xmm1    # 0x16f150
mulsd -0xe0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x230(%rbp), %xmm1
movsd 0x52bbf(%rip), %xmm2    # 0x18e8c0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
addsd -0x68(%rbp), %xmm0
callq 0x9080
movsd -0x228(%rbp), %xmm1
movsd 0x52b68(%rip), %xmm2    # 0x18e8b8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x220(%rbp), %xmm1
movsd 0x52b16(%rip), %xmm2    # 0x18e8b0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x218(%rbp)
movsd -0xe0(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x218(%rbp), %xmm1
movsd 0x52aad(%rip), %xmm2    # 0x18e8a8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x210(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0x68(%rbp), %xmm0
callq 0x9080
movsd -0x210(%rbp), %xmm1
movsd 0x52a66(%rip), %xmm2    # 0x18e8a0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x208(%rbp)
movsd -0xe0(%rbp), %xmm0
callq 0x9080
movsd -0x208(%rbp), %xmm1
movsd 0x52a21(%rip), %xmm2    # 0x18e898
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x200(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
callq 0x9080
movsd -0x200(%rbp), %xmm1
movsd 0x529da(%rip), %xmm2    # 0x18e890
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x1f8(%rbp)
movsd -0xe8(%rbp), %xmm0
movsd 0x3326a(%rip), %xmm1    # 0x16f150
mulsd -0xe0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x1f8(%rbp), %xmm1
movsd 0x52966(%rip), %xmm2    # 0x18e888
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x1f0(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
movsd 0x52929(%rip), %xmm2    # 0x18e880
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x1f0(%rbp), %xmm1
movsd 0x52904(%rip), %xmm2    # 0x18e878
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
movsd 0x356f4(%rip), %xmm2    # 0x171690
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xe8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd 0x5289c(%rip), %xmm0    # 0x18e870
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0xe8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
callq 0x9080
movsd -0x1e8(%rbp), %xmm1
movsd 0x52846(%rip), %xmm2    # 0x18e868
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0xe8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
callq 0x9080
movsd -0x1e0(%rbp), %xmm1
movsd 0x527ec(%rip), %xmm2    # 0x18e860
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1d8(%rbp)
movsd -0xe8(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x1d8(%rbp), %xmm1
movsd 0x52797(%rip), %xmm2    # 0x18e858
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1d0(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0xe8(%rbp), %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x1d0(%rbp), %xmm1
movsd 0x52745(%rip), %xmm2    # 0x18e850
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm1
movsd 0x3555d(%rip), %xmm2    # 0x171690
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x32f2d(%rip), %xmm0    # 0x16f078
mulsd -0xb0(%rbp), %xmm0
movsd 0x3546d(%rip), %xmm1    # 0x1715c8
divsd %xmm1, %xmm0
subsd 0x29ce41(%rip), %xmm0   # 0x3d8fa8
movsd 0x35521(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd 0x32ee5(%rip), %xmm0    # 0x16f068
subsd %xmm1, %xmm0
movsd 0x32fc1(%rip), %xmm1    # 0x16f150
divsd %xmm1, %xmm0
movsd %xmm0, 0x29ce05(%rip)   # 0x3d8fa0
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x1c8(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
callq 0x96f0
movsd -0x1c8(%rbp), %xmm1
movsd 0x52673(%rip), %xmm2    # 0x18e848
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x1c0(%rbp)
movsd 0x32f53(%rip), %xmm0    # 0x16f150
mulsd -0xe0(%rbp), %xmm0
callq 0x96f0
movsd -0x1c0(%rbp), %xmm1
movsd 0x52626(%rip), %xmm2    # 0x18e840
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movsd 0x32e46(%rip), %xmm0    # 0x16f078
mulsd -0xb8(%rbp), %xmm0
movsd 0x35386(%rip), %xmm1    # 0x1715c8
divsd %xmm1, %xmm0
movsd 0x468e2(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd %xmm0, 0x29e45d(%rip)   # 0x3da6b8
xorps %xmm0, %xmm0
ucomisd 0x29e452(%rip), %xmm0   # 0x3da6b8
jbe 0x13c280
movsd 0x468c0(%rip), %xmm0    # 0x182b30
addsd 0x29e440(%rip), %xmm0   # 0x3da6b8
movsd %xmm0, 0x29e438(%rip)   # 0x3da6b8
movsd 0x32df0(%rip), %xmm0    # 0x16f078
mulsd -0xb0(%rbp), %xmm0
movsd 0x35330(%rip), %xmm1    # 0x1715c8
divsd %xmm1, %xmm0
movsd 0x4688c(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd %xmm0, 0x29e40f(%rip)   # 0x3da6c0
xorps %xmm0, %xmm0
ucomisd 0x29e404(%rip), %xmm0   # 0x3da6c0
jbe 0x13c2d6
movsd 0x4686a(%rip), %xmm0    # 0x182b30
addsd 0x29e3f2(%rip), %xmm0   # 0x3da6c0
movsd %xmm0, 0x29e3ea(%rip)   # 0x3da6c0
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x348(%rbp)
leaq 0x22fec3(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
leaq 0x22fec8(%rip), %rax    # 0x36c1c0
movsd (%rax), %xmm1
callq 0x13cab0
movaps %xmm0, %xmm1
movsd -0x348(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x32d18(%rip), %xmm1    # 0x16f030
mulsd %xmm1, %xmm0
movsd %xmm0, 0x29e3a4(%rip)   # 0x3da6c8
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x340(%rbp)
movsd -0xb0(%rbp), %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd -0x340(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x338(%rbp)
movsd -0xb8(%rbp), %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd -0x338(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x330(%rbp)
movsd -0xb0(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x330(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x328(%rbp)
movsd -0xb8(%rbp), %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd -0x328(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x320(%rbp)
movsd -0xb8(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x320(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0x1b8(%rbp), %xmm0
movl $0x1, %edi
callq 0x133790
movsd %xmm0, -0x108(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x308(%rbp)
movsd -0x108(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x310(%rbp)
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x318(%rbp)
movsd -0x108(%rbp), %xmm0
callq 0x9080
movsd -0x318(%rbp), %xmm1
movsd -0x310(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x308(%rbp), %xmm0
mulsd %xmm3, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movsd -0x108(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x2f8(%rbp)
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x300(%rbp)
movsd -0x108(%rbp), %xmm0
callq 0x96f0
movsd -0x300(%rbp), %xmm1
movsd -0x2f8(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x2f0(%rbp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movsd -0x118(%rbp), %xmm0
movsd -0x110(%rbp), %xmm1
callq 0x13b520
movsd 0x32c38(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd 0x469f4(%rip), %xmm1    # 0x182f48
divsd %xmm1, %xmm0
movsd %xmm0, -0x128(%rbp)
movsd -0x110(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13c588
jp 0x13c588
movsd -0x118(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13c588
jp 0x13c588
jmp 0x13c5ef
movsd -0x120(%rbp), %xmm0
movsd %xmm0, -0x350(%rbp)
movsd -0x110(%rbp), %xmm0
movsd -0x110(%rbp), %xmm2
movsd -0x118(%rbp), %xmm1
mulsd -0x118(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9280
movaps %xmm0, %xmm1
movsd -0x350(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x92e0
movsd 0x32b9f(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd %xmm0, -0x130(%rbp)
jmp 0x13c5ff
movsd 0x32a71(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x130(%rbp)
movsd -0x198(%rbp), %xmm0
movsd 0x32ac9(%rip), %xmm1    # 0x16f0d8
subsd %xmm1, %xmm0
movsd 0x52335(%rip), %xmm1    # 0x18e950
mulsd %xmm1, %xmm0
movsd 0x52331(%rip), %xmm1    # 0x18e958
addsd %xmm1, %xmm0
movsd -0x1a0(%rbp), %xmm1
movsd 0x4690d(%rip), %xmm2    # 0x182f48
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
leaq 0x22fb6e(%rip), %rax    # 0x36c1b8
movsd (%rax), %xmm0
movsd 0x32b2a(%rip), %xmm2    # 0x16f180
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd 0x35022(%rip), %xmm0    # 0x171690
mulsd -0x1a8(%rbp), %xmm0
callq 0x13b470
movsd 0x32afd(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x378(%rbp)
leaq 0x22fb0a(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x96f0
movsd %xmm0, -0x370(%rbp)
movsd 0x34fd1(%rip), %xmm0    # 0x171690
mulsd -0x1a8(%rbp), %xmm0
callq 0x96f0
movsd -0x378(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x370(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x148(%rbp)
movsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x368(%rbp)
leaq 0x22fa93(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x96f0
movsd %xmm0, -0x360(%rbp)
movsd 0x34f5a(%rip), %xmm0    # 0x171690
mulsd -0x1a8(%rbp), %xmm0
callq 0x9080
movsd -0x368(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x360(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0x120(%rbp), %xmm0
movsd %xmm0, -0x358(%rbp)
leaq 0x22fa1c(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x358(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x148(%rbp), %xmm1
movsd -0x148(%rbp), %xmm2
movsd -0x150(%rbp), %xmm0
mulsd -0x150(%rbp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x158(%rbp), %xmm0
movsd -0x158(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0x160(%rbp)
movsd -0x150(%rbp), %xmm0
movsd -0x148(%rbp), %xmm1
callq 0x13b520
movsd 0x32962(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movsd -0x148(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13c852
jp 0x13c852
movsd -0x150(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13c852
jp 0x13c852
jmp 0x13c8ad
movsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x380(%rbp)
movsd -0x148(%rbp), %xmm0
movsd -0x148(%rbp), %xmm2
movsd -0x150(%rbp), %xmm1
mulsd -0x150(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9280
movaps %xmm0, %xmm1
movsd -0x380(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x92e0
movsd %xmm0, -0x140(%rbp)
jmp 0x13c8bd
movsd 0x327b3(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x140(%rbp)
movsd -0x1a8(%rbp), %xmm0
subsd -0x138(%rbp), %xmm0
movsd 0x34dbb(%rip), %xmm1    # 0x171690
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd -0x1b0(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x168(%rbp)
movsd -0x1b0(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x170(%rbp)
movsd -0x140(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x178(%rbp)
movsd -0x140(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x180(%rbp)
leaq 0x22f874(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x96f0
movsd %xmm0, -0x188(%rbp)
leaq 0x22f85c(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x9080
movsd %xmm0, -0x190(%rbp)
movsd -0x178(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd -0x170(%rbp), %xmm0
movsd -0x188(%rbp), %xmm1
movsd -0x180(%rbp), %xmm3
movsd -0x190(%rbp), %xmm2
mulsd -0x178(%rbp), %xmm2
mulsd -0x168(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
callq 0x9050
movsd 0x327a0(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
leaq 0x22ffdd(%rip), %rax    # 0x36c9c8
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
leaq 0x22ffcf(%rip), %rax    # 0x36c9c8
ucomisd (%rax), %xmm0
jbe 0x13ca1d
movsd 0x46129(%rip), %xmm0    # 0x182b30
leaq 0x22ffba(%rip), %rax    # 0x36c9c8
addsd (%rax), %xmm0
leaq 0x22ffaf(%rip), %rax    # 0x36c9c8
movsd %xmm0, (%rax)
movsd -0x190(%rbp), %xmm0
movsd -0x180(%rbp), %xmm2
movsd -0x188(%rbp), %xmm1
mulsd -0x178(%rbp), %xmm1
mulsd -0x168(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9640
leaq 0x22ff77(%rip), %rax    # 0x36c9d0
movsd %xmm0, (%rax)
movsd 0x3271b(%rip), %xmm0    # 0x16f180
leaq 0x22ff64(%rip), %rax    # 0x36c9d0
mulsd (%rax), %xmm0
leaq 0x22ff59(%rip), %rax    # 0x36c9d0
movsd %xmm0, (%rax)
leaq 0x22ff46(%rip), %rax    # 0x36c9c8
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
leaq 0x22ff3f(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm1
cvtsd2ss %xmm1, %xmm1
movl $0x3e9, %edi            # imm = 0x3E9
callq 0x7d450
addq $0x380, %rsp            # imm = 0x380
popq %rbp
retq
nopl (%rax)