#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 */
int /*<<< orphan*/ CelestialToEcliptical(double, double, double *, double *);
int /*<<< orphan*/ EclipticalToCelestial(double, double, double *, double *);
double MeanObliquity();
double NLongitude();
double NObliquity();
double cos(double);
double fabs(double);
double sin(double);
double tan(double);
void Nutation(double *ra, double *dec, int dirflag) {
  double ra_in, dec_in, ra_out, dec_out;
  double lambda, beta;
  double elong, elat, dlong;
  double dpsi, deps, eps0;
  double dra, ddec;
  double dir;
  dir = 1.0;
  if (dirflag < 0) {
    dir = -1.0;
  }
  ra_in = *ra;
  dec_in = *dec;
  if (fabs(dec_in) > (double)85.) {
    CelestialToEcliptical(ra_in, dec_in, &lambda, &beta);
    elong = lambda;
    elat = beta;
    dlong = dir * NLongitude();
    elong = elong + dlong;
    EclipticalToCelestial(elong, elat, &ra_out, &dec_out);
  } else {
    dpsi = dir * NLongitude();
    eps0 = MeanObliquity();
    deps = dir * NObliquity();
    dra = (cos(eps0 * 3.14159265358 / 180.) +
           sin(eps0 * 3.14159265358 / 180.) * sin(ra_in * 3.14159265358 / 12.) *
               tan(dec_in * 3.14159265358 / 180.)) *
              dpsi -
          cos(ra_in * 3.14159265358 / 12.) *
              tan(dec_in * 3.14159265358 / 180.) * deps;
    dra = dra / 15.;
    ddec = sin(eps0 * 3.14159265358 / 180.) * cos(ra_in * 3.14159265358 / 12.) *
               dpsi +
           sin(ra_in * 3.14159265358 / 12.) * deps;
    ra_out = ra_in + dra;
    dec_out = dec_in + ddec;
  }
  *ra = ra_out;
  *dec = dec_out;
}


x86 assembly (clang, -O0):
<Nutation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  0xe62(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cmpl   $0x0,-0x14(%rbp)
jge    11c0 <Nutation+0x40>
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xe5a(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe1e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    127d <Nutation+0xfd>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1030 <CelestialToEcliptical@plt>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    $0x0,%al
call   10a0 <NLongitude@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <EclipticalToCelestial@plt>
jmp    151f <Nutation+0x39f>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
mov    $0x0,%al
call   10a0 <NLongitude@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    $0x0,%al
call   1050 <MeanObliquity@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xe8(%rbp)
ff
mov    $0x0,%al
call   1070 <NObliquity@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xd39(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xd34(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0xd13(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xd0e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xced(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xcd8(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xcb8(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xcb3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <tan@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xc6a(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xc55(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xc44(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc3f(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <tan@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  0xbe9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xbc8(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xbc3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xba2(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xb8d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xb60(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xb4b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  -0xa8(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Nutation>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
shr    $0x1f,%edx
lea    0xe69(%rip),%rax
movsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd 0xe5e(%rip),%xmm2
andpd  %xmm1,%xmm2
ucomisd 0xe62(%rip),%xmm2
jbe    121e <Nutation+0x9e>
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   1030 <CelestialToEcliptical@plt>
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   10a0 <NLongitude@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0x58(%rsp),%rdi
lea    0x50(%rsp),%rsi
movsd  (%rsp),%xmm1
call   1040 <EclipticalToCelestial@plt>
movsd  0x58(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
jmp    138d <Nutation+0x20d>
xor    %eax,%eax
movapd %xmm1,0x60(%rsp)
movsd  %xmm0,0x38(%rsp)
call   10a0 <NLongitude@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
xor    %eax,%eax
call   1050 <MeanObliquity@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <NObliquity@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xdbf(%rip),%xmm0
divsd  0xdbf(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1090 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
mulsd  0xd89(%rip),%xmm0
divsd  0xd91(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1060 <sin@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xd62(%rip),%xmm0
mulsd  0x60(%rsp),%xmm0
divsd  0xd5c(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1080 <tan@plt>
mulsd  0x18(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
call   1080 <tan@plt>
mulsd  0x18(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0xd0f(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1090 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <sin@plt>
movsd  (%rsp),%xmm1
mulsd  0x28(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
addsd  0x60(%rsp),%xmm1
movsd  %xmm0,(%rbx)
movsd  %xmm1,(%r14)
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @Nutation(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%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
%20 = alloca double
%21 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 1.000000e+00, double* %21
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %3
store double -1.000000e+00, double* %21
br label %25
25: ; preds = %24, %3
%26 = load double*, double** %4
%27 = load double, double* %26
store double %27, double* %7
%28 = load double*, double** %5
%29 = load double, double* %28
store double %29, double* %8
%30 = load double, double* %8
%31 = call double @llvm.fabs.f64(double %30)
%32 = fcmp ogt double %31, 8.500000e+01
br i1 %32, label %33, label %48
33: ; preds = %25
%34 = load double, double* %7
%35 = load double, double* %8
%36 = call i32 @CelestialToEcliptical(double %34, double %35, double* %11, double* %12)
%37 = load double, double* %11
store double %37, double* %13
%38 = load double, double* %12
store double %38, double* %14
%39 = load double, double* %21
%40 = call double (...) @NLongitude()
%41 = fmul double %39, %40
store double %41, double* %15
%42 = load double, double* %13
%43 = load double, double* %15
%44 = fadd double %42, %43
store double %44, double* %13
%45 = load double, double* %13
%46 = load double, double* %14
%47 = call i32 @EclipticalToCelestial(double %45, double %46, double* %9, double* %10)
br label %113
48: ; preds = %25
%49 = load double, double* %21
%50 = call double (...) @NLongitude()
%51 = fmul double %49, %50
store double %51, double* %16
%52 = call double (...) @MeanObliquity()
store double %52, double* %18
%53 = load double, double* %21
%54 = call double (...) @NObliquity()
%55 = fmul double %53, %54
store double %55, double* %17
%56 = load double, double* %18
%57 = fmul double %56, 0x400921FB5443D6F4
%58 = fdiv double %57, 1.800000e+02
%59 = call double @cos(double %58)
%60 = load double, double* %18
%61 = fmul double %60, 0x400921FB5443D6F4
%62 = fdiv double %61, 1.800000e+02
%63 = call double @sin(double %62)
%64 = load double, double* %7
%65 = fmul double %64, 0x400921FB5443D6F4
%66 = fdiv double %65, 1.200000e+01
%67 = call double @sin(double %66)
%68 = fmul double %63, %67
%69 = load double, double* %8
%70 = fmul double %69, 0x400921FB5443D6F4
%71 = fdiv double %70, 1.800000e+02
%72 = call double @tan(double %71)
%73 = call double @llvm.fmuladd.f64(double %68, double %72, double %59)
%74 = load double, double* %16
%75 = load double, double* %7
%76 = fmul double %75, 0x400921FB5443D6F4
%77 = fdiv double %76, 1.200000e+01
%78 = call double @cos(double %77)
%79 = load double, double* %8
%80 = fmul double %79, 0x400921FB5443D6F4
%81 = fdiv double %80, 1.800000e+02
%82 = call double @tan(double %81)
%83 = fmul double %78, %82
%84 = load double, double* %17
%85 = fmul double %83, %84
%86 = fneg double %85
%87 = call double @llvm.fmuladd.f64(double %73, double %74, double %86)
store double %87, double* %19
%88 = load double, double* %19
%89 = fdiv double %88, 1.500000e+01
store double %89, double* %19
%90 = load double, double* %18
%91 = fmul double %90, 0x400921FB5443D6F4
%92 = fdiv double %91, 1.800000e+02
%93 = call double @sin(double %92)
%94 = load double, double* %7
%95 = fmul double %94, 0x400921FB5443D6F4
%96 = fdiv double %95, 1.200000e+01
%97 = call double @cos(double %96)
%98 = fmul double %93, %97
%99 = load double, double* %16
%100 = load double, double* %7
%101 = fmul double %100, 0x400921FB5443D6F4
%102 = fdiv double %101, 1.200000e+01
%103 = call double @sin(double %102)
%104 = load double, double* %17
%105 = fmul double %103, %104
%106 = call double @llvm.fmuladd.f64(double %98, double %99, double %105)
store double %106, double* %20
%107 = load double, double* %7
%108 = load double, double* %19
%109 = fadd double %107, %108
store double %109, double* %9
%110 = load double, double* %8
%111 = load double, double* %20
%112 = fadd double %110, %111
store double %112, double* %10
br label %113
113: ; preds = %48, %33
%114 = load double, double* %9
%115 = load double*, double** %4
store double %114, double* %115
%116 = load double, double* %10
%117 = load double*, double** %5
store double %116, double* %117
ret void
}

LLVM IR (-O2):
define void @Nutation(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = bitcast double* %7 to i8*
%12 = icmp slt i32 %2, 0
%13 = select i1 %12, double -1.000000e+00, double 1.000000e+00
%14 = load double, double* %0
%15 = load double, double* %1
%16 = tail call double @llvm.fabs.f64(double %15)
%17 = fcmp ogt double %16, 8.500000e+01
br i1 %17, label %18, label %28
18: ; preds = %3
%19 = call i32 @CelestialToEcliptical(double %14, double %15, double* %6, double* %7)
%20 = load double, double* %6
%21 = load double, double* %7
%22 = call double (...) @NLongitude()
%23 = fmul double %13, %22
%24 = fadd double %20, %23
%25 = call i32 @EclipticalToCelestial(double %24, double %21, double* %4, double* %5)
%26 = load double, double* %4
%27 = load double, double* %5
br label %61
28: ; preds = %3
%29 = tail call double (...) @NLongitude()
%30 = fmul double %13, %29
%31 = tail call double (...) @MeanObliquity()
%32 = tail call double (...) @NObliquity()
%33 = fmul double %13, %32
%34 = fmul double %31, 0x400921FB5443D6F4
%35 = fdiv double %34, 1.800000e+02
%36 = tail call double @cos(double %35)
%37 = tail call double @sin(double %35)
%38 = fmul double %14, 0x400921FB5443D6F4
%39 = fdiv double %38, 1.200000e+01
%40 = tail call double @sin(double %39)
%41 = fmul double %37, %40
%42 = fmul double %15, 0x400921FB5443D6F4
%43 = fdiv double %42, 1.800000e+02
%44 = tail call double @tan(double %43)
%45 = tail call double @llvm.fmuladd.f64(double %41, double %44, double %36)
%46 = tail call double @cos(double %39)
%47 = tail call double @tan(double %43)
%48 = fneg double %46
%49 = fmul double %47, %48
%50 = fmul double %33, %49
%51 = tail call double @llvm.fmuladd.f64(double %45, double %30, double %50)
%52 = fdiv double %51, 1.500000e+01
%53 = tail call double @sin(double %35)
%54 = tail call double @cos(double %39)
%55 = fmul double %53, %54
%56 = tail call double @sin(double %39)
%57 = fmul double %33, %56
%58 = tail call double @llvm.fmuladd.f64(double %55, double %30, double %57)
%59 = fadd double %14, %52
%60 = fadd double %15, %58
br label %61
61: ; preds = %28, %18
%62 = phi double [ %60, %28 ], [ %27, %18 ]
%63 = phi double [ %59, %28 ], [ %26, %18 ]
store double %63, double* %0
store double %62, double* %1
ret void
}