double AstAlg_lunar_ascending_node(double jd) {
  static double last_jd, last_ascn;
  double tau, omega;
  if (jd == last_jd)
    return last_ascn;
  tau = (jd - (2451545.0)) / 36525.0;
  omega =
      (((tau / 4.50e5 + 2.0708e-3) * tau - 1.934136261e3) * tau) + 125.04452;
  omega = ((double)((((long)omega) % ((long)360.0)) + (omega - (long)omega)));
  if (omega < 0.0)
    omega = omega + 360.0;
  last_jd = jd;
  last_ascn = omega;
  return omega;
}


x86 assembly (clang, -O0):
<AstAlg_lunar_ascending_node>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd 0x2f12(%rip),%xmm0
jne    1134 <AstAlg_lunar_ascending_node+0x34>
jp     1134 <AstAlg_lunar_ascending_node+0x34>
movsd  0x2f06(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1218 <AstAlg_lunar_ascending_node+0x118>
movsd  -0x10(%rbp),%xmm0
movsd  0xee7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xea1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe84(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe67(%rip),%xmm1
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    11f4 <AstAlg_lunar_ascending_node+0xf4>
movsd  0xe46(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2e27(%rip)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,0x2e22(%rip)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AstAlg_lunar_ascending_node>:
movsd  0x2f20(%rip),%xmm1
ucomisd %xmm0,%xmm1
jne    1119 <AstAlg_lunar_ascending_node+0x19>
jp     1119 <AstAlg_lunar_ascending_node+0x19>
movsd  0x2f18(%rip),%xmm0
ret
movsd  0xedf(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  0xedb(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  0xed7(%rip),%xmm2
addsd  0xed7(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xed3(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xecf(%rip),%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,0x2e60(%rip)
movlpd %xmm1,0x2e60(%rip)
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
@AstAlg_lunar_ascending_node.last_jd = internal global double 0.000000e+00
@AstAlg_lunar_ascending_node.last_ascn = internal global double 0.000000e+00
define double @AstAlg_lunar_ascending_node(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_lunar_ascending_node.last_jd
%8 = fcmp oeq double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load double, double* @AstAlg_lunar_ascending_node.last_ascn
store double %10, double* %2
br label %41
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 = fdiv double %15, 4.500000e+05
%17 = fadd double %16, 2.070800e-03
%18 = load double, double* %4
%19 = call double @llvm.fmuladd.f64(double %17, double %18, double 0xC09E388B8800EAE2)
%20 = load double, double* %4
%21 = call double @llvm.fmuladd.f64(double %19, double %20, double 0x405F42D96A6A0126)
store double %21, double* %5
%22 = load double, double* %5
%23 = fptosi double %22 to i64
%24 = srem i64 %23, 360
%25 = sitofp i64 %24 to double
%26 = load double, double* %5
%27 = load double, double* %5
%28 = fptosi double %27 to i64
%29 = sitofp i64 %28 to double
%30 = fsub double %26, %29
%31 = fadd double %25, %30
store double %31, double* %5
%32 = load double, double* %5
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %11
%35 = load double, double* %5
%36 = fadd double %35, 3.600000e+02
store double %36, double* %5
br label %37
37: ; preds = %34, %11
%38 = load double, double* %3
store double %38, double* @AstAlg_lunar_ascending_node.last_jd
%39 = load double, double* %5
store double %39, double* @AstAlg_lunar_ascending_node.last_ascn
%40 = load double, double* %5
store double %40, double* %2
br label %41
41: ; preds = %37, %9
%42 = load double, double* %2
ret double %42
}

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