// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/SunriseCalc.cpp
// Function: SunriseCalc::updateCalc()
void SunriseCalc::updateCalc()
{
  float julian = toJulian(year, month, day);

  float julianCentury = (julian - 2451545.0) / 36525;

  float geomMeanLongSun = fmod(280.46646 + julianCentury * (36000.76983 + julianCentury * 0.0003032), 360.0);
  float geomMeanAnomSun = 357.52911 + julianCentury * (35999.05029 - 0.0001537 * julianCentury);
  float eccentEarthOrbit = 0.016708634-julianCentury*(0.000042037+0.0000001267*julianCentury);
  float meanObliqCorr = 23+(26+((21.448-julianCentury*(46.815+julianCentury*(0.00059-julianCentury*0.001813))))/60)/60;
  float obliqCorr = meanObliqCorr+0.00256*cos(deg2rad(125.04-1934.136*julianCentury));
  float varY = tan(deg2rad(obliqCorr/2))*tan(deg2rad(obliqCorr/2));
  float eqOfTime = 4*rad2deg(varY*sin(2*deg2rad(geomMeanLongSun))-2*eccentEarthOrbit*sin(deg2rad(geomMeanAnomSun))+4*eccentEarthOrbit*varY*sin(deg2rad(geomMeanAnomSun))*cos(2*deg2rad(geomMeanLongSun))-0.5*varY*varY*sin(4*deg2rad(geomMeanLongSun))-1.25*eccentEarthOrbit*eccentEarthOrbit*sin(2*deg2rad(geomMeanAnomSun)));

  solarNoonLST = ((720-4*lon-eqOfTime+(tz)*60)/1440);

  float sunEqOfCtr = sin(deg2rad(geomMeanAnomSun))*(1.914602-julianCentury*(0.004817+0.000014*julianCentury))+sin(deg2rad(2*geomMeanAnomSun))*(0.019993-0.000101*julianCentury)+sin(deg2rad(3*geomMeanAnomSun))*0.000289;
  float sunTrueLon = geomMeanLongSun + sunEqOfCtr;
  float sunAppLon = sunTrueLon-0.00569-0.00478*sin(deg2rad(125.04-1934.136*julianCentury));
  float sunDecl = rad2deg(asin(sin(deg2rad(obliqCorr))*sin(deg2rad(sunAppLon))));
  float haSunrise = rad2deg(acos(cos(deg2rad(90.833))/(cos(deg2rad(lat))*cos(deg2rad(sunDecl)))-tan(deg2rad(lat))*tan(deg2rad(sunDecl))));

  sunriseLST = (solarNoonLST * 1440 - haSunrise*4)/1440;
  sunsetLST = (solarNoonLST * 1440 + haSunrise*4) / 1440;

  calculated = true;
}

// Assembly:
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
movl 0xc(%rdi), %esi
movl 0x10(%rdi), %edx
movl 0x14(%rdi), %ecx
callq 0x2a9ba
cvtss2sd %xmm0, %xmm0
addsd 0x3578(%rip), %xmm0     # 0x2d968
divsd 0x3578(%rip), %xmm0     # 0x2d970
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x356a(%rip), %xmm0     # 0x2d978
mulsd %xmm1, %xmm0
addsd 0x3566(%rip), %xmm0     # 0x2d980
mulsd %xmm1, %xmm0
addsd 0x3562(%rip), %xmm0     # 0x2d988
movsd 0x3562(%rip), %xmm1     # 0x2d990
callq 0x2380
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x30(%rsp)
movsd 0x3553(%rip), %xmm0     # 0x2d998
movsd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd 0x3549(%rip), %xmm0     # 0x2d9a0
mulsd %xmm2, %xmm0
addsd 0x3545(%rip), %xmm0     # 0x2d9a8
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movsd 0x353b(%rip), %xmm0     # 0x2d9b0
mulsd %xmm2, %xmm0
addsd 0x3537(%rip), %xmm0     # 0x2d9b8
mulsd %xmm2, %xmm0
movsd 0x3533(%rip), %xmm1     # 0x2d9c0
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%rsp)
movsd 0x3526(%rip), %xmm0     # 0x2d9c8
mulsd %xmm2, %xmm0
addsd 0x3522(%rip), %xmm0     # 0x2d9d0
mulsd %xmm2, %xmm0
addsd 0x351e(%rip), %xmm0     # 0x2d9d8
mulsd %xmm2, %xmm0
movsd 0x351a(%rip), %xmm1     # 0x2d9e0
subsd %xmm0, %xmm1
movsd 0xd5e(%rip), %xmm0      # 0x2b230
divsd %xmm0, %xmm1
addsd 0x350a(%rip), %xmm1     # 0x2d9e8
divsd %xmm0, %xmm1
addsd 0x3506(%rip), %xmm1     # 0x2d9f0
cvtsd2ss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x34f8(%rip), %xmm0     # 0x2d9f8
mulsd %xmm2, %xmm0
addsd 0x34f4(%rip), %xmm0     # 0x2da00
mulsd 0x34f4(%rip), %xmm0     # 0x2da08
divsd 0x34f4(%rip), %xmm0     # 0x2da10
movsd %xmm0, 0x58(%rsp)
callq 0x2510
mulsd 0x34e9(%rip), %xmm0     # 0x2da18
addsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm1
movss %xmm1, 0x34(%rsp)
movss 0xddd(%rip), %xmm0      # 0x2b324
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x34b1(%rip), %xmm0     # 0x2da08
divsd 0x34b1(%rip), %xmm0     # 0x2da10
movsd %xmm0, 0x10(%rsp)
callq 0x2160
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2160
mulsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
cvtss2sd 0x30(%rsp), %xmm0
mulsd 0x3465(%rip), %xmm0     # 0x2da08
divsd 0x3465(%rip), %xmm0     # 0x2da10
movsd %xmm0, 0x50(%rsp)
addsd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
callq 0x2060
movsd %xmm0, 0x10(%rsp)
movss (%rsp), %xmm0
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
cvtss2sd 0x8(%rsp), %xmm0
mulsd 0x3421(%rip), %xmm0     # 0x2da08
divsd 0x3421(%rip), %xmm0     # 0x2da10
movsd %xmm0, 0x18(%rsp)
callq 0x2060
mulsd 0x40(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movss (%rsp), %xmm0
mulss 0xd39(%rip), %xmm0      # 0x2b35c
mulss 0x28(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x2060
mulsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x48(%rsp), %xmm0
callq 0x2510
mulsd 0x28(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x50(%rsp), %xmm0
mulsd 0xb7b(%rip), %xmm0      # 0x2b1f0
callq 0x2060
movsd 0xbb6(%rip), %xmm2      # 0x2b238
movsd 0x38(%rsp), %xmm1
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
addsd 0x10(%rsp), %xmm2
movsd %xmm2, 0x10(%rsp)
cvtss2sd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x18(%rsp), %xmm0
addsd %xmm0, %xmm0
callq 0x2060
movsd 0x335f(%rip), %xmm1     # 0x2da20
movsd (%rsp), %xmm2
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
mulsd 0x3330(%rip), %xmm1     # 0x2da10
divsd 0x3320(%rip), %xmm1     # 0x2da08
mulsd 0xb00(%rip), %xmm1      # 0x2b1f0
cvtsd2ss %xmm1, %xmm0
movss 0x4(%rbx), %xmm1
mulss 0xcc3(%rip), %xmm1      # 0x2b3c4
addss 0x3257(%rip), %xmm1     # 0x2d960
movss 0x8(%rbx), %xmm2
subss %xmm0, %xmm1
mulss 0xc72(%rip), %xmm2      # 0x2b38c
addss %xmm1, %xmm2
movss 0x3236(%rip), %xmm0     # 0x2d95c
divss %xmm0, %xmm2
movss %xmm2, 0x1c(%rbx)
movsd 0x18(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x18(%rsp)
movsd 0x32e0(%rip), %xmm0     # 0x2da28
movsd 0x20(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x32d6(%rip), %xmm0     # 0x2da30
mulsd %xmm1, %xmm0
movsd 0x32d2(%rip), %xmm1     # 0x2da38
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movss 0x8(%rsp), %xmm0
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x3283(%rip), %xmm0     # 0x2da08
divsd 0x3283(%rip), %xmm0     # 0x2da10
callq 0x2060
movsd 0x20(%rsp), %xmm1
mulsd 0x32a0(%rip), %xmm1     # 0x2da40
addsd 0x32a0(%rip), %xmm1     # 0x2da48
mulsd %xmm0, %xmm1
movsd (%rsp), %xmm2
mulsd 0x18(%rsp), %xmm2
movss 0x8(%rsp), %xmm0
mulss 0xb8f(%rip), %xmm0      # 0x2b354
addsd %xmm1, %xmm2
movsd %xmm2, (%rsp)
cvtss2sd %xmm0, %xmm0
mulsd 0x322e(%rip), %xmm0     # 0x2da08
divsd 0x322e(%rip), %xmm0     # 0x2da10
callq 0x2060
mulsd 0x3261(%rip), %xmm0     # 0x2da50
addsd (%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
addss 0x30(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd 0x324e(%rip), %xmm0     # 0x2da58
movsd %xmm0, 0x8(%rsp)
movsd 0x58(%rsp), %xmm0
callq 0x2060
mulsd 0x323d(%rip), %xmm0     # 0x2da60
addsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20(%rsp)
cvtss2sd 0x34(%rsp), %xmm0
mulsd 0x31c7(%rip), %xmm0     # 0x2da08
divsd 0x31c7(%rip), %xmm0     # 0x2da10
callq 0x2060
movsd %xmm0, 0x8(%rsp)
cvtss2sd 0x20(%rsp), %xmm0
mulsd 0x31a6(%rip), %xmm0     # 0x2da08
divsd 0x31a6(%rip), %xmm0     # 0x2da10
callq 0x2060
mulsd 0x8(%rsp), %xmm0
callq 0x24c0
movsd 0x318e(%rip), %xmm2     # 0x2da10
mulsd %xmm2, %xmm0
movsd 0x317a(%rip), %xmm1     # 0x2da08
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
cvtss2sd (%rbx), %xmm0
mulsd %xmm1, %xmm0
divsd %xmm2, %xmm0
callq 0x2510
movsd %xmm0, 0x20(%rsp)
cvtss2sd 0x8(%rsp), %xmm0
mulsd 0x3147(%rip), %xmm0     # 0x2da08
divsd 0x3147(%rip), %xmm0     # 0x2da10
movsd %xmm0, 0x8(%rsp)
callq 0x2510
mulsd 0x20(%rsp), %xmm0
movsd 0x3186(%rip), %xmm1     # 0x2da68
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
cvtss2sd (%rbx), %xmm0
mulsd 0x3110(%rip), %xmm0     # 0x2da08
divsd 0x3110(%rip), %xmm0     # 0x2da10
callq 0x2160
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x2160
mulsd (%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x2270
mulsd 0x30db(%rip), %xmm0     # 0x2da10
divsd 0x30cb(%rip), %xmm0     # 0x2da08
cvtsd2ss %xmm0, %xmm0
mulss 0xa13(%rip), %xmm0      # 0x2b35c
movaps 0x7d0(%rip), %xmm1      # 0x2b120
xorps %xmm0, %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movss 0x2ffe(%rip), %xmm0     # 0x2d95c
mulss 0x1c(%rbx), %xmm0
unpcklps %xmm0, %xmm0            # xmm0 = xmm0[0,0,1,1]
addps %xmm1, %xmm0
divps 0x3110(%rip), %xmm0     # 0x2da80
movlps %xmm0, 0x20(%rbx)
movb $0x1, 0x19(%rbx)
addq $0x60, %rsp
popq %rbx
retq