// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: sun_posn(double, int)
double sun_posn(double jd, int moon_flag)
{
double RightAscension;
double Declination;
double HourAngle;
double Zenith;
double Azimuth;
double t, te, wte, s1, c1, s2, c2, s3, c3;
double sp, cp, sd, cd, sH, cH, se0, ep, De, lambda, epsi;
double sl, cl, se, ce, L, nu, Dlam;
double Temperature = 15.0;  // degrees C
double Pressure = 1.0;      // atmospheres
double tt;

   // Calculate sun position using Grena's Algorithm 5
   // Very accurate results (<0.0027 degrees) for years 2010 to 2110.
   // jd is jd_utc.

++sp_count;

   if(moon_flag) {       // royal kludge to calculate moon rise/transit/set
      moon_posn(jd);     // ... this kludge lets us use the calc_sunrise()
      sun_az = moon_az;  // ... code to do the moon, but the results are
      sun_el = moon_el;  // ... saved in the sun related variables !!!!!
      have_sun_el = 0;
      return moon_el;
   }

   
   tt = utc_delta_t();

   t = jd - jdate(2060,1,1);    // year 2060 is middle of algorithm validity range
   te = t + (tt / (24.0*60.0*60.0));  // convert to terresrial time

   wte = 0.0172019715*te;

   s1 = sin(wte);
   c1 = cos(wte);
   s2 = 2.0*s1*c1;
   c2 = (c1+s1)*(c1-s1);
   s3 = s2*c1 + c2*s1;
   c3 = c2*c1 - s2*s1;

   // Heliocentric longitude
   L = 1.7527901 + 1.7202792159e-2*te + 3.33024e-2*s1 - 2.0582e-3*c1 
     + 3.512e-4*s2 - 4.07e-5*c2 + 5.2e-6*s3 - 9e-7*c3 
     - 8.23e-5*s1*sin(2.92e-5*te) + 1.27e-5*sin(1.49e-3*te - 2.337)
     + 1.21e-5*sin(4.31e-3*te + 3.065) + 2.33e-5*sin(1.076e-2*te - 1.533)
     + 3.49e-5*sin(1.575e-2*te - 2.358) + 2.67e-5*sin(2.152e-2*te + 0.074)
     + 1.28e-5*sin(3.152e-2*te + 1.547) + 3.14e-5*sin(2.1277e-1*te - 0.488);

   sun_hlon = (L*180.0/PI);                     // used as possible alternate input to gravity tide sun position code
   sun_hlon = fmod(sun_hlon, 360.0) + 180.0;
   sun_hlon = fmod(sun_hlon, 360.0);
//sprintf(debug_text2, "hlon: %.9f  r:%.9f", sun_hlon, (earth_sun_dist(jd)+EQU_RADIUS*0.0)*1000.0);

   nu = 9.282e-4*te - 0.8;  // nutation
   Dlam = 8.34e-5*sin(nu);
   lambda = L + PI + Dlam;

   epsi = 4.089567e-1 - 6.19e-9*te + 4.46e-5*cos(nu);

   sl = sin(lambda);
   cl = cos(lambda);
   se = sin(epsi);
   ce = sqrt(1.0-se*se);

   RightAscension = atan2(sl*ce, cl);
   if(RightAscension < 0.0) RightAscension += (PI*2.0);
   sun_ra = RightAscension * (180.0 / PI);

   Declination = asin(sl*se);
   sun_decl = Declination * (180.0 / PI);

   HourAngle = 1.7528311 + 6.300388099*t + lon - RightAscension + 0.92*Dlam;
   HourAngle = fmod(HourAngle + PI, (PI*2.0)) - PI;
   if(HourAngle < (-PI)) HourAngle += (PI*2.0);

   sp = sin(lat);
   cp = sqrt((1.0-sp*sp));
   sd = sin(Declination);
   cd = sqrt(1.0-sd*sd);
   sH = sin(HourAngle);
   cH = cos(HourAngle);
   se0 = sp*sd + cp*cd*cH;
   ep = asin(se0) - 4.26e-5*sqrt(1.0-se0*se0);
   if(cd) Azimuth = atan2(sH, cH*sp - sd*cp/cd);
   else   Azimuth = atan2(sH, cH*sp);

   De = 0.0;
   if(apply_refraction && (ep > 0.0)) {  // apply refraction correction
      De = (0.08422*Pressure) / ((273.0+Temperature)*tan(ep + 0.003138/(ep + 0.08919)));
   }

   // convert results to our desired orientation in degrees
   sun_az = (Azimuth * (180.0/PI)) + 180.0;
   if(sun_az < 0.0) sun_az += 360.0;
   sun_az = fmod(sun_az, 360.0);

   Zenith = (PI/2.0) - ep - De;
   sun_el = 90.0 - ((Zenith * (180.0/PI)));

   return sun_el;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movsd %xmm0, -0x10(%rbp)
movl %edi, -0x14(%rbp)
movsd 0x4620d(%rip), %xmm0    # 0x182f48
movsd %xmm0, -0x120(%rbp)
movsd 0x3231d(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x128(%rbp)
movl 0x29ca9b(%rip), %eax    # 0x3d97f4
addl $0x1, %eax
movl %eax, 0x29ca92(%rip)    # 0x3d97f4
cmpl $0x0, -0x14(%rbp)
je 0x13cdc0
movsd -0x10(%rbp), %xmm0
callq 0x13b5b0
leaq 0x22fc4f(%rip), %rax    # 0x36c9c8
movsd (%rax), %xmm0
leaq 0x22fc2c(%rip), %rax    # 0x36c9b0
movsd %xmm0, (%rax)
leaq 0x22fc41(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm0
leaq 0x22fbfe(%rip), %rax    # 0x36c998
movsd %xmm0, (%rax)
leaq 0x22fc03(%rip), %rax    # 0x36c9a8
movl $0x0, (%rax)
leaq 0x22fc1e(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x13d822
callq 0x119920
movsd %xmm0, -0x130(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
movl $0x80c, %edi            # imm = 0x80C
movl $0x1, %edx
movl %edx, %esi
callq 0x122140
movaps %xmm0, %xmm1
movsd -0x188(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x130(%rbp), %xmm1
movsd 0x321f4(%rip), %xmm2    # 0x16f008
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x51c9f(%rip), %xmm0    # 0x18eac8
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0x68(%rbp)
movsd 0x322f7(%rip), %xmm0    # 0x16f150
mulsd -0x60(%rbp), %xmm0
mulsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x68(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
subsd -0x60(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
movsd -0x78(%rbp), %xmm1
mulsd -0x60(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x78(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
movsd -0x70(%rbp), %xmm1
mulsd -0x60(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51bca(%rip), %xmm1    # 0x18eab8
mulsd %xmm1, %xmm0
movsd 0x51bc6(%rip), %xmm1    # 0x18eac0
addsd %xmm1, %xmm0
movsd -0x60(%rbp), %xmm1
movsd 0x51ba5(%rip), %xmm2    # 0x18eab0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
movsd 0x51b88(%rip), %xmm2    # 0x18eaa8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x70(%rbp), %xmm1
movsd 0x51b6b(%rip), %xmm2    # 0x18eaa0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
movsd 0x51b4e(%rip), %xmm2    # 0x18ea98
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x80(%rbp), %xmm1
movsd 0x51b31(%rip), %xmm2    # 0x18ea90
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
movsd 0x51b11(%rip), %xmm2    # 0x18ea88
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x180(%rbp)
movsd 0x51af1(%rip), %xmm0    # 0x18ea80
mulsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
movsd 0x51ad4(%rip), %xmm0    # 0x18ea78
mulsd -0x50(%rbp), %xmm0
callq 0x9080
movsd -0x180(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x178(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x170(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51a73(%rip), %xmm1    # 0x18ea68
mulsd %xmm1, %xmm0
movsd 0x51a6f(%rip), %xmm1    # 0x18ea70
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x170(%rbp), %xmm1
movsd 0x51a46(%rip), %xmm2    # 0x18ea60
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51a19(%rip), %xmm1    # 0x18ea50
mulsd %xmm1, %xmm0
movsd 0x51a15(%rip), %xmm1    # 0x18ea58
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x168(%rbp), %xmm1
movsd 0x519ec(%rip), %xmm2    # 0x18ea48
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x519bf(%rip), %xmm1    # 0x18ea38
mulsd %xmm1, %xmm0
movsd 0x519bb(%rip), %xmm1    # 0x18ea40
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x160(%rbp), %xmm1
movsd 0x51992(%rip), %xmm2    # 0x18ea30
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51965(%rip), %xmm1    # 0x18ea20
mulsd %xmm1, %xmm0
movsd 0x51961(%rip), %xmm1    # 0x18ea28
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x158(%rbp), %xmm1
movsd 0x51938(%rip), %xmm2    # 0x18ea18
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x5190b(%rip), %xmm1    # 0x18ea08
mulsd %xmm1, %xmm0
movsd 0x51907(%rip), %xmm1    # 0x18ea10
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x150(%rbp), %xmm1
movsd 0x518de(%rip), %xmm2    # 0x18ea00
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x148(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x518b1(%rip), %xmm1    # 0x18e9f0
mulsd %xmm1, %xmm0
movsd 0x518ad(%rip), %xmm1    # 0x18e9f8
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x148(%rbp), %xmm1
movsd 0x51884(%rip), %xmm2    # 0x18e9e8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51857(%rip), %xmm1    # 0x18e9d8
mulsd %xmm1, %xmm0
movsd 0x51853(%rip), %xmm1    # 0x18e9e0
addsd %xmm1, %xmm0
callq 0x9080
movsd -0x140(%rbp), %xmm1
movsd 0x5182a(%rip), %xmm2    # 0x18e9d0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
movsd 0x31eba(%rip), %xmm0    # 0x16f078
mulsd -0x108(%rbp), %xmm0
movsd 0x343fa(%rip), %xmm1    # 0x1715c8
divsd %xmm1, %xmm0
movsd %xmm0, 0x29bdce(%rip)   # 0x3d8fa8
movsd 0x29bdc6(%rip), %xmm0   # 0x3d8fa8
movsd 0x45946(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x31e81(%rip), %xmm1    # 0x16f078
addsd %xmm1, %xmm0
movsd %xmm0, 0x29bda5(%rip)   # 0x3d8fa8
movsd 0x29bd9d(%rip), %xmm0   # 0x3d8fa8
movsd 0x4591d(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd %xmm0, 0x29bd88(%rip)   # 0x3d8fa8
movsd -0x50(%rbp), %xmm0
movsd 0x51793(%rip), %xmm1    # 0x18e9c0
mulsd %xmm1, %xmm0
movsd 0x5178f(%rip), %xmm1    # 0x18e9c8
addsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x110(%rbp), %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd 0x5175b(%rip), %xmm0    # 0x18e9b8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movsd 0x34357(%rip), %xmm0    # 0x1715c8
addsd -0x108(%rbp), %xmm0
addsd -0x118(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x51712(%rip), %xmm1    # 0x18e9a8
mulsd %xmm1, %xmm0
movsd 0x5170e(%rip), %xmm1    # 0x18e9b0
addsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movsd -0x110(%rbp), %xmm0
callq 0x96f0
movsd -0x138(%rbp), %xmm1
movsd 0x516d5(%rip), %xmm2    # 0x18e9a0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xd8(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0xe8(%rbp)
movsd -0xd8(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0xf0(%rbp)
movsd -0xe0(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0xf8(%rbp)
movsd -0xf8(%rbp), %xmm0
movsd -0xf8(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x31d1b(%rip), %xmm1    # 0x16f068
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0x100(%rbp)
movsd -0xe8(%rbp), %xmm0
mulsd -0x100(%rbp), %xmm0
movsd -0xf0(%rbp), %xmm1
callq 0x9050
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x13d39c
movsd 0x457c6(%rip), %xmm0    # 0x182b58
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x31ddc(%rip), %xmm0    # 0x16f180
mulsd -0x20(%rbp), %xmm0
leaq 0x22f610(%rip), %rax    # 0x36c9c0
movsd %xmm0, (%rax)
movsd -0xe8(%rbp), %xmm0
mulsd -0xf8(%rbp), %xmm0
callq 0x9640
movsd %xmm0, -0x28(%rbp)
movsd 0x31daa(%rip), %xmm0    # 0x16f180
mulsd -0x28(%rbp), %xmm0
leaq 0x22f5d6(%rip), %rax    # 0x36c9b8
movsd %xmm0, (%rax)
movsd -0x48(%rbp), %xmm1
movsd 0x516e5(%rip), %xmm0    # 0x18ead8
mulsd %xmm0, %xmm1
movsd 0x516e1(%rip), %xmm0    # 0x18eae0
addsd %xmm0, %xmm1
leaq 0x22edae(%rip), %rax    # 0x36c1b8
addsd (%rax), %xmm1
subsd -0x20(%rbp), %xmm1
movsd -0x118(%rbp), %xmm0
movsd 0x516ad(%rip), %xmm2    # 0x18ead0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x34190(%rip), %xmm0    # 0x1715c8
addsd -0x30(%rbp), %xmm0
movsd 0x45713(%rip), %xmm1    # 0x182b58
callq 0x94d0
movsd 0x34176(%rip), %xmm1    # 0x1715c8
subsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x45e45(%rip), %xmm0    # 0x1832a8
ucomisd -0x30(%rbp), %xmm0
jbe 0x13d47c
movsd 0x456e6(%rip), %xmm0    # 0x182b58
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x22ed2d(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
callq 0x9080
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x31ba1(%rip), %xmm1    # 0x16f068
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0x98(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x31b4b(%rip), %xmm1    # 0x16f068
addsd %xmm1, %xmm0
callq 0x9280
movsd %xmm0, -0xa8(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x9080
movsd %xmm0, -0xb0(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x96f0
movsd %xmm0, -0xb8(%rbp)
movsd -0x90(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm2
movsd -0x98(%rbp), %xmm1
mulsd -0xa8(%rbp), %xmm1
mulsd -0xb8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xc0(%rbp), %xmm0
callq 0x9640
movsd %xmm0, -0x190(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x31a96(%rip), %xmm1    # 0x16f068
addsd %xmm1, %xmm0
callq 0x9280
movsd -0x190(%rbp), %xmm1
movsd 0x514fd(%rip), %xmm2    # 0x18eae8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xa8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13d610
jp 0x13d610
jmp 0x13d66b
movsd -0xb0(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm1
movsd -0x90(%rbp), %xmm3
movsd -0xa0(%rbp), %xmm2
mulsd -0x98(%rbp), %xmm2
divsd -0xa8(%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 %xmm0, -0x40(%rbp)
jmp 0x13d68d
movsd -0xb0(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm1
mulsd -0x90(%rbp), %xmm1
callq 0x9050
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
leaq 0x22f121(%rip), %rax    # 0x36c7c0
cmpl $0x0, (%rax)
je 0x13d73d
movsd -0xc8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13d73d
movsd 0x51443(%rip), %xmm0    # 0x18eb08
mulsd -0x128(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
movsd 0x51423(%rip), %xmm0    # 0x18eb00
addsd -0x120(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd 0x513fb(%rip), %xmm2    # 0x18eaf8
addsd -0xc8(%rbp), %xmm2
movsd 0x513e3(%rip), %xmm1    # 0x18eaf0
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
callq 0x91b0
movsd -0x1a0(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x198(%rbp), %xmm0
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0x40(%rbp), %xmm0
movsd 0x31a36(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd 0x31922(%rip), %xmm1    # 0x16f078
addsd %xmm1, %xmm0
leaq 0x22f24f(%rip), %rax    # 0x36c9b0
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
leaq 0x22f241(%rip), %rax    # 0x36c9b0
ucomisd (%rax), %xmm0
jbe 0x13d793
movsd 0x453b3(%rip), %xmm0    # 0x182b30
leaq 0x22f22c(%rip), %rax    # 0x36c9b0
addsd (%rax), %xmm0
leaq 0x22f221(%rip), %rax    # 0x36c9b0
movsd %xmm0, (%rax)
leaq 0x22f216(%rip), %rax    # 0x36c9b0
movsd (%rax), %xmm0
movsd 0x4538a(%rip), %xmm1    # 0x182b30
callq 0x94d0
leaq 0x22f1fe(%rip), %rax    # 0x36c9b0
movsd %xmm0, (%rax)
movsd 0x50af2(%rip), %xmm0    # 0x18e2b0
subsd -0xc8(%rbp), %xmm0
subsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x31989(%rip), %xmm1    # 0x16f180
mulsd %xmm1, %xmm0
movsd 0x31885(%rip), %xmm1    # 0x16f088
addsd %xmm1, %xmm0
leaq 0x22f18a(%rip), %rax    # 0x36c998
movsd %xmm0, (%rax)
leaq 0x22f17f(%rip), %rax    # 0x36c998
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq