// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rbx
subq $0x98, %rsp
movsd %xmm0, -0x88(%rbp)
movsd 0x227e2(%rip), %xmm1    # 0xf5a00
addsd %xmm0, %xmm1
cvttpd2dq %xmm1, %xmm2
cvtdq2pd %xmm2, %xmm2
subsd %xmm2, %xmm1
movsd 0x42a62(%rip), %xmm2    # 0x115c98
addsd %xmm0, %xmm2
movsd %xmm2, -0x50(%rbp)
mulsd 0x1fdf9(%rip), %xmm1    # 0xf3040
movapd %xmm1, -0xa0(%rbp)
movsd 0x42a49(%rip), %xmm0    # 0x115ca0
mulsd %xmm2, %xmm0
addsd 0x42a45(%rip), %xmm0    # 0x115ca8
mulsd 0x2271d(%rip), %xmm0    # 0xf5988
callq 0xd311c
movsd %xmm0, -0x10(%rbp)
movsd 0x42a33(%rip), %xmm0    # 0x115cb0
mulsd -0x50(%rbp), %xmm0
addsd 0x42a2e(%rip), %xmm0    # 0x115cb8
mulsd 0x226f6(%rip), %xmm0    # 0xf5988
callq 0xd311c
movsd %xmm0, -0x28(%rbp)
movsd 0x42a1c(%rip), %xmm0    # 0x115cc0
mulsd -0x50(%rbp), %xmm0
addsd 0x42a17(%rip), %xmm0    # 0x115cc8
mulsd 0x226cf(%rip), %xmm0    # 0xf5988
callq 0xd311c
movsd %xmm0, -0x18(%rbp)
movsd 0x42a05(%rip), %xmm0    # 0x115cd0
mulsd -0x50(%rbp), %xmm0
addsd 0x42a00(%rip), %xmm0    # 0x115cd8
mulsd 0x226a8(%rip), %xmm0    # 0xf5988
callq 0xd311c
movsd %xmm0, -0x70(%rbp)
movsd 0x429ee(%rip), %xmm0    # 0x115ce0
mulsd -0x50(%rbp), %xmm0
addsd 0x429e9(%rip), %xmm0    # 0x115ce8
mulsd 0x22681(%rip), %xmm0    # 0xf5988
callq 0xd311c
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9080
mulsd 0x4294d(%rip), %xmm0    # 0x115c70
movsd %xmm0, -0x40(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9710
mulsd 0x42936(%rip), %xmm0    # 0x115c70
addsd 0x1fd2e(%rip), %xmm0    # 0xf3070
mulsd -0x40(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x9710
addsd 0x42992(%rip), %xmm0    # 0x115cf0
mulsd 0x42992(%rip), %xmm0    # 0x115cf8
movsd %xmm0, -0x60(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd 0x42983(%rip), %xmm0    # 0x115d00
mulsd 0x42973(%rip), %xmm0    # 0x115cf8
movsd %xmm0, -0x48(%rbp)
movsd -0x60(%rbp), %xmm1
callq 0xd317c
movsd %xmm0, -0x40(%rbp)
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
movsd -0x60(%rbp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9710
movsd %xmm0, -0x58(%rbp)
movsd -0x40(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x9710
movsd %xmm0, -0x48(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x68(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd -0x68(%rbp), %xmm0
mulsd 0x42902(%rip), %xmm0    # 0x115d08
movsd -0x48(%rbp), %xmm1
mulsd -0x58(%rbp), %xmm1
addsd %xmm0, %xmm1
mulsd -0x60(%rbp), %xmm1
movsd %xmm1, -0x48(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x68(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9710
movsd %xmm0, -0x58(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9710
movsd %xmm0, -0x78(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd -0x78(%rbp), %xmm0
mulsd 0x428ae(%rip), %xmm0    # 0x115d10
movsd -0x58(%rbp), %xmm1
mulsd -0x68(%rbp), %xmm1
addsd %xmm0, %xmm1
mulsd -0x60(%rbp), %xmm1
movsd %xmm1, -0x58(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd 0x4288c(%rip), %xmm0    # 0x115d18
mulsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
callq 0xd317c
movsd %xmm0, -0x78(%rbp)
movsd -0x58(%rbp), %xmm1
mulsd %xmm1, %xmm1
movsd -0x48(%rbp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
callq 0xd317c
movsd %xmm0, -0x68(%rbp)
movsd -0x70(%rbp), %xmm3
addsd -0x20(%rbp), %xmm3
movsd -0x28(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd -0x10(%rbp), %xmm2
addsd %xmm2, %xmm0
movapd %xmm0, %xmm4
subsd %xmm3, %xmm4
movsd %xmm4, -0x58(%rbp)
subsd %xmm2, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x22586(%rip), %xmm0    # 0xf5a98
mulsd %xmm4, %xmm0
movsd %xmm0, -0x48(%rbp)
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
callq 0x9080
mulsd 0x427ef(%rip), %xmm0    # 0x115d20
movsd %xmm0, -0x10(%rbp)
movsd -0x58(%rbp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x9080
mulsd 0x427d7(%rip), %xmm0    # 0x115d28
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x9080
mulsd 0x427c3(%rip), %xmm0    # 0x115d30
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x18(%rbp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
subsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd 0x427a1(%rip), %xmm0    # 0x115d38
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x20(%rbp), %xmm0
addsd -0x70(%rbp), %xmm0
callq 0x9080
mulsd 0x42788(%rip), %xmm0    # 0x115d40
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x40(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
callq 0x9080
mulsd 0x4276f(%rip), %xmm0    # 0x115d48
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x40(%rbp), %xmm0
subsd -0x20(%rbp), %xmm0
callq 0x9080
mulsd 0x42756(%rip), %xmm0    # 0x115d50
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x18(%rbp), %xmm0
subsd -0x20(%rbp), %xmm0
callq 0x9080
mulsd 0x4273d(%rip), %xmm0    # 0x115d58
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0x9080
mulsd 0x42729(%rip), %xmm0    # 0x115d60
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x20(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
callq 0x9080
mulsd 0x42710(%rip), %xmm0    # 0x115d68
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x28(%rbp), %xmm0
addsd %xmm0, %xmm0
subsd -0x40(%rbp), %xmm0
callq 0x9080
mulsd 0x426f3(%rip), %xmm0    # 0x115d70
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x58(%rbp), %xmm0
mulsd 0x426e4(%rip), %xmm0    # 0x115d78
addsd -0x18(%rbp), %xmm0
callq 0x9080
mulsd 0x426da(%rip), %xmm0    # 0x115d80
addsd -0x20(%rbp), %xmm0
mulsd 0x222d5(%rip), %xmm0    # 0xf5988
addsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x48(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
callq 0x9080
mulsd 0x426b4(%rip), %xmm0    # 0x115d88
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
subsd -0x28(%rbp), %xmm0
addsd -0x48(%rbp), %xmm0
callq 0x9080
mulsd 0x4269b(%rip), %xmm0    # 0x115d90
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
addsd -0x48(%rbp), %xmm0
callq 0x9080
mulsd 0x4267d(%rip), %xmm0    # 0x115d98
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x40(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
callq 0x9080
mulsd 0x42664(%rip), %xmm0    # 0x115da0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x80(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
callq 0x9080
mulsd 0x4264b(%rip), %xmm0    # 0x115da8
addsd -0x18(%rbp), %xmm0
movsd 0x2221e(%rip), %xmm1    # 0xf5988
mulsd %xmm1, %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
mulsd 0x22123(%rip), %xmm0    # 0xf58a8
divsd 0x22113(%rip), %xmm0    # 0xf58a0
movsd %xmm0, -0x28(%rbp)
subsd 0x2905ce(%rip), %xmm0   # 0x363d68
mulsd %xmm1, %xmm0
callq 0x9710
movsd 0x1f8c5(%rip), %xmm1    # 0xf3070
movsd %xmm1, -0x48(%rbp)
movsd 0x1f8b8(%rip), %xmm1    # 0xf3070
subsd %xmm0, %xmm1
mulsd 0x1f8a4(%rip), %xmm1    # 0xf3068
movsd %xmm1, 0x290594(%rip)   # 0x363d60
movsd -0x70(%rbp), %xmm0
callq 0x9710
mulsd 0x425d2(%rip), %xmm0    # 0x115db0
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x9710
mulsd 0x425be(%rip), %xmm0    # 0x115db8
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x2209c(%rip), %xmm0    # 0xf58a8
mulsd -0x18(%rbp), %xmm0
divsd 0x22087(%rip), %xmm0    # 0xf58a0
movsd 0x3498f(%rip), %xmm1    # 0x1081b0
callq 0x94d0
movapd %xmm0, %xmm3
movsd 0x3497e(%rip), %xmm1    # 0x1081b0
addsd %xmm1, %xmm3
xorpd %xmm4, %xmm4
movapd %xmm0, %xmm2
cmpltsd %xmm4, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm0, %xmm2
orpd %xmm3, %xmm2
movlpd %xmm2, 0x291c01(%rip)   # 0x365458
movsd -0x28(%rbp), %xmm0
callq 0x94d0
movsd 0x34947(%rip), %xmm2    # 0x1081b0
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x1f89e(%rip), %xmm1    # 0xf3118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movlpd %xmm1, 0x291bd2(%rip)   # 0x365460
leaq 0x22373b(%rip), %rbx    # 0x2f6fd0
movsd (%rbx), %xmm0
leaq 0x223740(%rip), %rax    # 0x2f6fe0
movsd (%rax), %xmm1
callq 0xd3c65
mulsd -0x20(%rbp), %xmm0
mulsd 0x1f782(%rip), %xmm0    # 0xf3038
movsd %xmm0, 0x291baa(%rip)   # 0x365468
movsd -0x10(%rbp), %xmm0
callq 0x9710
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9710
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x9080
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9710
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9080
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
pushq $0x1
popq %rdi
movsd -0x88(%rbp), %xmm0
callq 0xce0e1
movsd %xmm0, -0x20(%rbp)
callq 0x9710
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x9080
mulsd -0x60(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
mulsd -0x10(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x40(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x9710
mulsd -0x60(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd -0x10(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x40(%rbp)
movsd -0x18(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
callq 0xd317c
xorpd %xmm1, %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0xd39c1
jp 0xd39c1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0xd39c1
jnp 0xd39e9
movsd -0x18(%rbp), %xmm0
mulsd %xmm0, %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm1
movsd -0x40(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x92c0
movsd -0x50(%rbp), %xmm0
addsd 0x423ca(%rip), %xmm0    # 0x115dc0
mulsd 0x423ca(%rip), %xmm0    # 0x115dc8
addsd 0x423ca(%rip), %xmm0    # 0x115dd0
movapd -0xa0(%rbp), %xmm1
mulsd 0x34b12(%rip), %xmm1    # 0x108528
addsd %xmm0, %xmm1
leaq 0x2235b7(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm0
mulsd 0x1f733(%rip), %xmm0    # 0xf3160
addsd %xmm1, %xmm0
movsd 0x21f4f(%rip), %xmm1    # 0xf5988
mulsd %xmm1, %xmm0
callq 0xd311c
mulsd 0x1f716(%rip), %xmm0    # 0xf3160
movsd %xmm0, -0x20(%rbp)
movsd (%rbx), %xmm0
callq 0x9710
movsd %xmm0, -0x10(%rbp)
movsd 0x21f23(%rip), %xmm0    # 0xf5988
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0x9710
mulsd -0x10(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x28(%rbp)
movsd (%rbx), %xmm0
callq 0x9710
movsd %xmm0, -0x10(%rbp)
movsd -0x50(%rbp), %xmm0
callq 0x9080
mulsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbp)
movsd (%rbx), %xmm0
callq 0x9080
movsd %xmm0, -0x50(%rbp)
movsd -0x18(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
callq 0xd317c
movapd %xmm0, %xmm3
xorpd %xmm0, %xmm0
movsd -0x28(%rbp), %xmm2
movapd %xmm2, %xmm1
ucomisd %xmm0, %xmm2
jne 0xd3af5
jp 0xd3af5
movsd -0x18(%rbp), %xmm2
ucomisd %xmm0, %xmm2
jne 0xd3af5
jnp 0xd3b2c
movsd -0x18(%rbp), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
sqrtsd %xmm1, %xmm1
divsd %xmm1, %xmm0
movsd %xmm3, -0x18(%rbp)
callq 0x92c0
movsd -0x18(%rbp), %xmm3
movsd %xmm0, -0x48(%rbp)
movsd 0x1f62c(%rip), %xmm0    # 0xf3160
mulsd %xmm0, %xmm3
movsd -0x20(%rbp), %xmm0
subsd %xmm3, %xmm0
mulsd 0x21e3f(%rip), %xmm0    # 0xf5988
movsd %xmm0, -0x20(%rbp)
callq 0x9710
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x10(%rbp)
movsd -0x48(%rbp), %xmm0
callq 0x9710
movaps %xmm0, -0x40(%rbp)
movsd -0x48(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x28(%rbp)
movsd (%rbx), %xmm0
callq 0x9710
movsd %xmm0, -0x20(%rbp)
movsd (%rbx), %xmm0
callq 0x9080
movapd %xmm0, %xmm3
movsd %xmm0, -0x50(%rbp)
movapd 0x1f604(%rip), %xmm0    # 0xf31b0
movapd -0x40(%rbp), %xmm2
xorpd %xmm2, %xmm0
mulsd -0x10(%rbp), %xmm0
mulsd %xmm3, %xmm2
mulsd -0x18(%rbp), %xmm2
movsd -0x20(%rbp), %xmm1
mulsd -0x28(%rbp), %xmm1
subsd %xmm2, %xmm1
callq 0x9050
mulsd 0x1f582(%rip), %xmm0    # 0xf3160
movsd 0x345ca(%rip), %xmm1    # 0x1081b0
addsd %xmm0, %xmm1
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
cmpltsd %xmm2, %xmm3
andpd %xmm3, %xmm1
andnpd %xmm0, %xmm3
orpd %xmm1, %xmm3
leaq 0x223bde(%rip), %rbx    # 0x2f77e8
movlpd %xmm3, (%rbx)
movapd -0x40(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
mulsd -0x18(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
mulsd -0x28(%rbp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x9660
cvtsd2ss (%rbx), %xmm2
mulsd 0x1f520(%rip), %xmm0    # 0xf3160
leaq 0x223ba9(%rip), %rax    # 0x2f77f0
cvtsd2ss %xmm0, %xmm1
movsd %xmm0, (%rax)
movl $0x3e9, %edi            # imm = 0x3E9
movaps %xmm2, %xmm0
addq $0x98, %rsp
popq %rbx
popq %rbp
jmp 0x53b74