#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 asin(double);
double atan(double);
double cos(double);
int fabs(double);
int /*<<< orphan*/ obliquity(double, double *);
int /*<<< orphan*/ range(double *, int);
double sin(double);
void ecleq_aux(int sw, double mj, double x, double y, double *p, double *q) {
  static double lastmj = -10000;
  static double seps, ceps;
  double sx, cx, sy, cy, ty, sq;
  if (mj != lastmj) {
    double eps;
    obliquity(mj, &eps);
    seps = sin(eps);
    ceps = cos(eps);
    lastmj = mj;
  }
  sy = sin(y);
  cy = cos(y);
  if (fabs(cy) < 1e-20)
    cy = 1e-20;
  ty = sy / cy;
  cx = cos(x);
  sx = sin(x);
  sq = (sy * ceps) - (cy * seps * sx * sw);
  if (sq < -1)
    sq = -1;
  if (sq > 1)
    sq = 1;
  *q = asin(sq);
  *p = atan(((sx * ceps) + (ty * seps * sw)) / cx);
  if (cx < 0)
    *p += 3.141592653589793;
  range(p, 2 * 3.141592653589793);
}


x86 assembly (clang, -O0):
<ecleq_aux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd 0x2eb9(%rip),%xmm0
jne    11b0 <ecleq_aux+0x40>
jp     11b0 <ecleq_aux+0x40>
jmp    11ef <ecleq_aux+0x7f>
movsd  -0x10(%rbp),%xmm0
lea    -0x68(%rbp),%rdi
call   1070 <obliquity@plt>
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x2e98(%rip)
movsd  -0x68(%rbp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,0x2e8e(%rip)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2e69(%rip)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xddd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    123a <ecleq_aux+0xca>
movsd  0xdcb(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0x2dfc(%rip),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  0x2de7(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xd4d(%rip),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    12d3 <ecleq_aux+0x163>
movsd  0xd3a(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd30(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12f7 <ecleq_aux+0x187>
movsd  0xd1e(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1060 <asin@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  0x2d5a(%rip),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  0x2d45(%rip),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
call   1050 <atan@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1368 <ecleq_aux+0x1f8>
mov    -0x28(%rbp),%rax
movsd  0xcb8(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0x6,%esi
call   1080 <range@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecleq_aux>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
mov    %edi,%ebp
movsd  0x2ec5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jne    119b <ecleq_aux+0x2b>
jnp    11df <ecleq_aux+0x6f>
lea    0x18(%rsp),%rdi
movsd  %xmm0,0x20(%rsp)
call   1070 <obliquity@plt>
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x2eaa(%rip)
movsd  0x18(%rsp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,0x2e9f(%rip)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x2e79(%rip)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    120e <ecleq_aux+0x9e>
movsd  (%rsp),%xmm0
jmp    1216 <ecleq_aux+0xa6>
movsd  0xdea(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm2
mulsd  0x2e02(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm0
mulsd  0x2df4(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  0xd80(%rip),%xmm1
maxsd  %xmm0,%xmm1
movsd  0xd7c(%rip),%xmm0
minsd  %xmm1,%xmm0
call   1060 <asin@plt>
movsd  %xmm0,(%r14)
movsd  0x38(%rsp),%xmm0
mulsd  0x2db8(%rip),%xmm0
mulsd  0x30(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x2dac(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm0
call   1050 <atan@plt>
movsd  0xd39(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd 0x20(%rsp),%xmm3
cmpltsd %xmm2,%xmm3
movapd %xmm3,%xmm2
andnpd %xmm0,%xmm2
andpd  %xmm1,%xmm3
orpd   %xmm2,%xmm3
movlpd %xmm3,(%rbx)
mov    %rbx,%rdi
mov    $0x6,%esi
call   1080 <range@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@ecleq_aux.lastmj = internal global double -1.000000e+04
@ecleq_aux.seps = internal global double 0.000000e+00
@ecleq_aux.ceps = internal global double 0.000000e+00
define void @ecleq_aux(i32 %0, double %1, double %2, double %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i32 %0, i32* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%20 = load double, double* %8
%21 = load double, double* @ecleq_aux.lastmj
%22 = fcmp une double %20, %21
br i1 %22, label %23, label %31
23: ; preds = %6
%24 = load double, double* %8
%25 = call i32 @obliquity(double %24, double* %19)
%26 = load double, double* %19
%27 = call double @sin(double %26)
store double %27, double* @ecleq_aux.seps
%28 = load double, double* %19
%29 = call double @cos(double %28)
store double %29, double* @ecleq_aux.ceps
%30 = load double, double* %8
store double %30, double* @ecleq_aux.lastmj
br label %31
31: ; preds = %23, %6
%32 = load double, double* %10
%33 = call double @sin(double %32)
store double %33, double* %15
%34 = load double, double* %10
%35 = call double @cos(double %34)
store double %35, double* %16
%36 = load double, double* %16
%37 = call i32 @fabs(double %36)
%38 = sitofp i32 %37 to double
%39 = fcmp olt double %38, 0x3BC79CA10C924223
br i1 %39, label %40, label %41
40: ; preds = %31
store double 0x3BC79CA10C924223, double* %16
br label %41
41: ; preds = %40, %31
%42 = load double, double* %15
%43 = load double, double* %16
%44 = fdiv double %42, %43
store double %44, double* %17
%45 = load double, double* %9
%46 = call double @cos(double %45)
store double %46, double* %14
%47 = load double, double* %9
%48 = call double @sin(double %47)
store double %48, double* %13
%49 = load double, double* %15
%50 = load double, double* @ecleq_aux.ceps
%51 = load double, double* %16
%52 = load double, double* @ecleq_aux.seps
%53 = fmul double %51, %52
%54 = load double, double* %13
%55 = fmul double %53, %54
%56 = load i32, i32* %7
%57 = sitofp i32 %56 to double
%58 = fmul double %55, %57
%59 = fneg double %58
%60 = call double @llvm.fmuladd.f64(double %49, double %50, double %59)
store double %60, double* %18
%61 = load double, double* %18
%62 = fcmp olt double %61, -1.000000e+00
br i1 %62, label %63, label %64
63: ; preds = %41
store double -1.000000e+00, double* %18
br label %64
64: ; preds = %63, %41
%65 = load double, double* %18
%66 = fcmp ogt double %65, 1.000000e+00
br i1 %66, label %67, label %68
67: ; preds = %64
store double 1.000000e+00, double* %18
br label %68
68: ; preds = %67, %64
%69 = load double, double* %18
%70 = call double @asin(double %69)
%71 = load double*, double** %12
store double %70, double* %71
%72 = load double, double* %13
%73 = load double, double* @ecleq_aux.ceps
%74 = load double, double* %17
%75 = load double, double* @ecleq_aux.seps
%76 = fmul double %74, %75
%77 = load i32, i32* %7
%78 = sitofp i32 %77 to double
%79 = fmul double %76, %78
%80 = call double @llvm.fmuladd.f64(double %72, double %73, double %79)
%81 = load double, double* %14
%82 = fdiv double %80, %81
%83 = call double @atan(double %82)
%84 = load double*, double** %11
store double %83, double* %84
%85 = load double, double* %14
%86 = fcmp olt double %85, 0.000000e+00
br i1 %86, label %87, label %91
87: ; preds = %68
%88 = load double*, double** %11
%89 = load double, double* %88
%90 = fadd double %89, 0x400921FB54442D18
store double %90, double* %88
br label %91
91: ; preds = %87, %68
%92 = load double*, double** %11
%93 = call i32 @range(double* %92, i32 6)
ret void
}

LLVM IR (-O2):
@ecleq_aux.lastmj = internal unnamed_addr global double -1.000000e+04
@ecleq_aux.seps = internal unnamed_addr global double 0.000000e+00
@ecleq_aux.ceps = internal unnamed_addr global double 0.000000e+00
define void @ecleq_aux(i32 %0, double %1, double %2, double %3, double* %4, double* nocapture writeonly %5) {
%7 = alloca double
%8 = load double, double* @ecleq_aux.lastmj
%9 = fcmp une double %8, %1
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = bitcast double* %7 to i8*
%12 = call i32 @obliquity(double %1, double* %7)
%13 = load double, double* %7
%14 = call double @sin(double %13)
store double %14, double* @ecleq_aux.seps
%15 = load double, double* %7
%16 = call double @cos(double %15)
store double %16, double* @ecleq_aux.ceps
store double %1, double* @ecleq_aux.lastmj
br label %17
17: ; preds = %10, %6
%18 = call double @sin(double %3)
%19 = call double @cos(double %3)
%20 = call i32 @fabs(double %19)
%21 = icmp slt i32 %20, 1
%22 = select i1 %21, double 0x3BC79CA10C924223, double %19
%23 = fdiv double %18, %22
%24 = call double @cos(double %2)
%25 = call double @sin(double %2)
%26 = load double, double* @ecleq_aux.ceps
%27 = load double, double* @ecleq_aux.seps
%28 = sitofp i32 %0 to double
%29 = fneg double %22
%30 = fmul double %27, %29
%31 = fmul double %25, %30
%32 = fmul double %31, %28
%33 = call double @llvm.fmuladd.f64(double %18, double %26, double %32)
%34 = fcmp olt double %33, -1.000000e+00
%35 = select i1 %34, double -1.000000e+00, double %33
%36 = fcmp ogt double %35, 1.000000e+00
%37 = select i1 %36, double 1.000000e+00, double %35
%38 = call double @asin(double %37)
store double %38, double* %5
%39 = load double, double* @ecleq_aux.ceps
%40 = load double, double* @ecleq_aux.seps
%41 = fmul double %23, %40
%42 = fmul double %41, %28
%43 = call double @llvm.fmuladd.f64(double %25, double %39, double %42)
%44 = fdiv double %43, %24
%45 = call double @atan(double %44)
%46 = fcmp olt double %24, 0.000000e+00
%47 = fadd double %45, 0x400921FB54442D18
%48 = select i1 %46, double %47, double %45
store double %48, double* %4
%49 = call i32 @range(double* %4, i32 6)
ret void
}