double AstAlg_mean_solar_anomaly(double jd) {
  static double last_jd, last_sma;
  double tau, sma;
  if (jd == last_jd)
    return last_sma;
  tau = (jd - (2451545.0)) / 36525.0;
  sma = 357.5291130 + 35999.05029 * tau - 0.0001537 * (tau * tau);
  sma = ((double)((((long)sma) % ((long)360)) + (sma - (long)sma)));
  if (sma < 0.0)
    sma = sma + 360.0;
  last_jd = jd;
  last_sma = sma;
  return sma;
}


x86 assembly (clang, -O0):
<AstAlg_mean_solar_anomaly>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd 0x2f12(%rip),%xmm0
jne    1134 <AstAlg_mean_solar_anomaly+0x34>
jp     1134 <AstAlg_mean_solar_anomaly+0x34>
movsd  0x2f06(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1208 <AstAlg_mean_solar_anomaly+0x108>
movsd  -0x10(%rbp),%xmm0
movsd  0xedf(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xecb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xea5(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xea1(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%rax
mov    $0x168,%ecx
cqto
idiv   %rcx
cvtsi2sd %rdx,%xmm0
movsd  -0x20(%rbp),%xmm1
cvttsd2si -0x20(%rbp),%rax
cvtsi2sd %rax,%xmm2
subsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11e4 <AstAlg_mean_solar_anomaly+0xe4>
movsd  0xe4e(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2e37(%rip)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,0x2e32(%rip)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AstAlg_mean_solar_anomaly>:
movsd  0x2f20(%rip),%xmm1
ucomisd %xmm0,%xmm1
jne    1119 <AstAlg_mean_solar_anomaly+0x19>
jp     1119 <AstAlg_mean_solar_anomaly+0x19>
movsd  0x2f18(%rip),%xmm0
ret
movsd  0xedf(%rip),%xmm2
addsd  %xmm0,%xmm2
divsd  0xedb(%rip),%xmm2
movsd  0xedb(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xed7(%rip),%xmm1
mulsd  %xmm2,%xmm2
mulsd  0xed3(%rip),%xmm2
addsd  %xmm1,%xmm2
cvttsd2si %xmm2,%rcx
movabs $0x2d82d82d82d82d83,%rdx
d8 82 2d
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x6,%rdx
add    %rax,%rdx
xorps  %xmm1,%xmm1
cvtsi2sd %rcx,%xmm1
imul   $0x168,%rdx,%rax
sub    %rax,%rcx
cvtsi2sd %rcx,%xmm3
subsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  0xe8d(%rip),%xmm3
addsd  %xmm2,%xmm3
xorpd  %xmm4,%xmm4
movapd %xmm2,%xmm1
cmpltsd %xmm4,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm3,%xmm1
movsd  %xmm0,0x2e68(%rip)
movlpd %xmm1,0x2e68(%rip)
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
@AstAlg_mean_solar_anomaly.last_jd = internal global double 0.000000e+00
@AstAlg_mean_solar_anomaly.last_sma = internal global double 0.000000e+00
define double @AstAlg_mean_solar_anomaly(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = load double, double* @AstAlg_mean_solar_anomaly.last_jd
%8 = fcmp oeq double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load double, double* @AstAlg_mean_solar_anomaly.last_sma
store double %10, double* %2
br label %40
11: ; preds = %1
%12 = load double, double* %3
%13 = fsub double %12, 0x4142B42C80000000
%14 = fdiv double %13, 3.652500e+04
store double %14, double* %4
%15 = load double, double* %4
%16 = call double @llvm.fmuladd.f64(double 0x40E193E19BF9C62A, double %15, double 0x407658773F316E37)
%17 = load double, double* %4
%18 = load double, double* %4
%19 = fmul double %17, %18
%20 = call double @llvm.fmuladd.f64(double -1.537000e-04, double %19, double %16)
store double %20, double* %5
%21 = load double, double* %5
%22 = fptosi double %21 to i64
%23 = srem i64 %22, 360
%24 = sitofp i64 %23 to double
%25 = load double, double* %5
%26 = load double, double* %5
%27 = fptosi double %26 to i64
%28 = sitofp i64 %27 to double
%29 = fsub double %25, %28
%30 = fadd double %24, %29
store double %30, double* %5
%31 = load double, double* %5
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %11
%34 = load double, double* %5
%35 = fadd double %34, 3.600000e+02
store double %35, double* %5
br label %36
36: ; preds = %33, %11
%37 = load double, double* %3
store double %37, double* @AstAlg_mean_solar_anomaly.last_jd
%38 = load double, double* %5
store double %38, double* @AstAlg_mean_solar_anomaly.last_sma
%39 = load double, double* %5
store double %39, double* %2
br label %40
40: ; preds = %36, %9
%41 = load double, double* %2
ret double %41
}

LLVM IR (-O2):
@AstAlg_mean_solar_anomaly.last_jd = internal unnamed_addr global double 0.000000e+00
@AstAlg_mean_solar_anomaly.last_sma = internal unnamed_addr global double 0.000000e+00
define double @AstAlg_mean_solar_anomaly(double %0) {
%2 = load double, double* @AstAlg_mean_solar_anomaly.last_jd
%3 = fcmp oeq double %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load double, double* @AstAlg_mean_solar_anomaly.last_sma
br label %21
6: ; preds = %1
%7 = fadd double %0, 0xC142B42C80000000
%8 = fdiv double %7, 3.652500e+04
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x40E193E19BF9C62A, double 0x407658773F316E37)
%10 = fmul double %8, %8
%11 = tail call double @llvm.fmuladd.f64(double %10, double -1.537000e-04, double %9)
%12 = fptosi double %11 to i64
%13 = srem i64 %12, 360
%14 = sitofp i64 %13 to double
%15 = sitofp i64 %12 to double
%16 = fsub double %11, %15
%17 = fadd double %16, %14
%18 = fcmp olt double %17, 0.000000e+00
%19 = fadd double %17, 3.600000e+02
%20 = select i1 %18, double %19, double %17
store double %0, double* @AstAlg_mean_solar_anomaly.last_jd
store double %20, double* @AstAlg_mean_solar_anomaly.last_sma
br label %21
21: ; preds = %6, %4
%22 = phi double [ %5, %4 ], [ %20, %6 ]
ret double %22
}