#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double AstAlg_geometric_solar_longitude(double);
double AstAlg_lunar_ascending_node(double);
double M_PI;
double sin(double);
double AstAlg_apparent_solar_longitude(double jd) {
  static double last_jd, last_asl;
  if (jd == last_jd)
    return last_asl;
  last_jd = jd;
  last_asl = AstAlg_geometric_solar_longitude(jd) - 0.00569 -
             0.00478 * sin((M_PI / 180.0) * AstAlg_lunar_ascending_node(jd));
  return last_asl;
}


x86 assembly (clang, -O0):
<AstAlg_apparent_solar_longitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd 0x2ef6(%rip),%xmm0
jne    1168 <AstAlg_apparent_solar_longitude+0x38>
jp     1168 <AstAlg_apparent_solar_longitude+0x38>
movsd  0x2eea(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f1 <AstAlg_apparent_solar_longitude+0xc1>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2ecb(%rip)
movsd  -0x10(%rbp),%xmm0
call   1030 <AstAlg_geometric_solar_longitude@plt>
movsd  0xe89(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e51(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe65(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <AstAlg_lunar_ascending_node@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe2c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e64(%rip)
movsd  0x2e5c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AstAlg_apparent_solar_longitude>:
sub    $0x18,%rsp
movsd  0x2f04(%rip),%xmm1
ucomisd %xmm0,%xmm1
jne    1151 <AstAlg_apparent_solar_longitude+0x21>
jp     1151 <AstAlg_apparent_solar_longitude+0x21>
movsd  0x2efc(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  %xmm0,0x2ee7(%rip)
movsd  %xmm0,0x8(%rsp)
call   1030 <AstAlg_geometric_solar_longitude@plt>
addsd  0xe94(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x2e6f(%rip),%rax
movsd  (%rax),%xmm0
divsd  0xe83(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <AstAlg_lunar_ascending_node@plt>
mulsd  (%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0xe69(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x2e93(%rip)
add    $0x18,%rsp
ret

LLVM IR (-O0):
@AstAlg_apparent_solar_longitude.last_jd = internal global double 0.000000e+00
@AstAlg_apparent_solar_longitude.last_asl = internal global double 0.000000e+00
@M_PI = global double 0.000000e+00
define double @AstAlg_apparent_solar_longitude(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = load double, double* @AstAlg_apparent_solar_longitude.last_jd
%6 = fcmp oeq double %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load double, double* @AstAlg_apparent_solar_longitude.last_asl
store double %8, double* %2
br label %22
9: ; preds = %1
%10 = load double, double* %3
store double %10, double* @AstAlg_apparent_solar_longitude.last_jd
%11 = load double, double* %3
%12 = call double @AstAlg_geometric_solar_longitude(double %11)
%13 = fsub double %12, 5.690000e-03
%14 = load double, double* @M_PI
%15 = fdiv double %14, 1.800000e+02
%16 = load double, double* %3
%17 = call double @AstAlg_lunar_ascending_node(double %16)
%18 = fmul double %15, %17
%19 = call double @sin(double %18)
%20 = call double @llvm.fmuladd.f64(double -4.780000e-03, double %19, double %13)
store double %20, double* @AstAlg_apparent_solar_longitude.last_asl
%21 = load double, double* @AstAlg_apparent_solar_longitude.last_asl
store double %21, double* %2
br label %22
22: ; preds = %9, %7
%23 = load double, double* %2
ret double %23
}

LLVM IR (-O2):
@AstAlg_apparent_solar_longitude.last_jd = internal unnamed_addr global double 0.000000e+00
@AstAlg_apparent_solar_longitude.last_asl = internal unnamed_addr global double 0.000000e+00
@M_PI = global double 0.000000e+00
define double @AstAlg_apparent_solar_longitude(double %0) {
%2 = load double, double* @AstAlg_apparent_solar_longitude.last_jd
%3 = fcmp oeq double %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load double, double* @AstAlg_apparent_solar_longitude.last_asl
br label %15
6: ; preds = %1
store double %0, double* @AstAlg_apparent_solar_longitude.last_jd
%7 = tail call double @AstAlg_geometric_solar_longitude(double %0)
%8 = fadd double %7, -5.690000e-03
%9 = load double, double* @M_PI
%10 = fdiv double %9, 1.800000e+02
%11 = tail call double @AstAlg_lunar_ascending_node(double %0)
%12 = fmul double %10, %11
%13 = tail call double @sin(double %12)
%14 = tail call double @llvm.fmuladd.f64(double %13, double -4.780000e-03, double %8)
store double %14, double* @AstAlg_apparent_solar_longitude.last_asl
br label %15
15: ; preds = %6, %4
%16 = phi double [ %5, %4 ], [ %14, %6 ]
ret double %16
}