#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 fabs(double);
double NewMoon(double ax, double bx, double cx) {
  double f1, f2, x0, x1, x2, x3, Moon();
  double L, B, Rad, AGE, tol = 1e-7;
  x0 = ax;
  x3 = cx;
  if (fabs(cx - bx) > fabs(bx - ax)) {
    x1 = bx;
    x2 = bx + 0.38196601 * (cx - bx);
  } else {
    x2 = bx;
    x1 = bx - 0.38196601 * (bx - ax);
  }
  f1 = Moon(x1, &L, &B, &Rad, &AGE);
  f2 = Moon(x2, &L, &B, &Rad, &AGE);
  while (fabs(x3 - x0) > tol * (fabs(x1) + fabs(x2))) {
    if (f2 < f1) {
      x0 = x1;
      x1 = x2;
      x2 = 0.61803399 * x1 + 0.38196601 * x3;
      f1 = f2;
      f2 = Moon(x2, &L, &B, &Rad, &AGE);
    } else {
      x3 = x2;
      x2 = x1;
      x1 = 0.61803399 * x2 + 0.38196601 * x0;
      f2 = f1;
      f1 = Moon(x1, &L, &B, &Rad, &AGE);
    }
  }
  if (f1 < f2) {
    return (x1);
  } else {
    return (x2);
  }
}


x86 assembly (clang, -O0):
<NewMoon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xea4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movaps 0xe8f(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b2 <NewMoon+0xa2>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe80(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11e0 <NewMoon+0xd0>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe45(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x1,%al
call   1030 <Moon@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x1,%al
call   1030 <Moon@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movaps 0xdcd(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps 0xdb8(%rip),%xmm3
pand   %xmm3,%xmm2
movsd  -0x48(%rbp),%xmm3
movaps 0xda8(%rip),%xmm4
pand   %xmm4,%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1358 <NewMoon+0x248>
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12ed <NewMoon+0x1dd>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xd7d(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xd78(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x1,%al
call   1030 <Moon@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    1353 <NewMoon+0x243>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xd12(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xd0d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x1,%al
call   1030 <Moon@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    1222 <NewMoon+0x112>
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    137b <NewMoon+0x26b>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1385 <NewMoon+0x275>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NewMoon>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
movapd %xmm2,%xmm5
subsd  %xmm1,%xmm5
movapd 0xed5(%rip),%xmm4
movapd %xmm5,%xmm3
andpd  %xmm4,%xmm3
movapd %xmm1,%xmm6
subsd  %xmm0,%xmm6
movapd %xmm6,%xmm7
andpd  %xmm4,%xmm7
ucomisd %xmm7,%xmm3
mulsd  0xec9(%rip),%xmm6
addsd  %xmm1,%xmm6
cmpltsd %xmm3,%xmm7
movapd %xmm7,%xmm3
andpd  %xmm1,%xmm3
andnpd %xmm6,%xmm7
orpd   %xmm3,%xmm7
movsd  %xmm0,0x8(%rsp)
movsd  %xmm2,0x30(%rsp)
jbe    1182 <NewMoon+0x72>
mulsd  0xe92(%rip),%xmm5
addsd  %xmm5,%xmm1
movapd %xmm1,0x20(%rsp)
lea    0x70(%rsp),%rbx
lea    0x68(%rsp),%r14
lea    0x60(%rsp),%r15
lea    0x58(%rsp),%r12
movapd %xmm7,%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    $0x1,%al
movapd %xmm7,0x40(%rsp)
call   1030 <Moon@plt>
movapd %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    $0x1,%al
call   1030 <Moon@plt>
movapd 0x40(%rsp),%xmm5
movapd %xmm0,%xmm3
movsd  0x30(%rsp),%xmm9
movapd %xmm9,%xmm0
movsd  0x8(%rsp),%xmm8
subsd  %xmm8,%xmm0
movapd 0xdfe(%rip),%xmm4
andpd  %xmm4,%xmm0
movapd %xmm5,%xmm1
andpd  %xmm4,%xmm1
movapd 0x20(%rsp),%xmm6
movapd %xmm6,%xmm2
andpd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xdf8(%rip),%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm6,%xmm4
jbe    1391 <NewMoon+0x281>
lea    0x70(%rsp),%r14
lea    0x68(%rsp),%r15
lea    0x60(%rsp),%r12
lea    0x58(%rsp),%rbx
movapd 0x10(%rsp),%xmm6
jmp    130f <NewMoon+0x1ff>
cs nopw 0x0(%rax,%rax,1)
nop
movapd %xmm8,%xmm1
mulsd  0xda3(%rip),%xmm1
movapd %xmm5,%xmm0
mulsd  0xdaf(%rip),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    $0x1,%al
movsd  %xmm8,0x8(%rsp)
movapd %xmm6,0x10(%rsp)
call   1030 <Moon@plt>
movapd 0x30(%rsp),%xmm7
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm4
movsd  0x8(%rsp),%xmm8
movapd %xmm0,%xmm6
movapd 0x20(%rsp),%xmm9
movapd %xmm1,%xmm0
movapd %xmm9,%xmm1
subsd  %xmm8,%xmm1
movapd 0xd23(%rip),%xmm5
andpd  %xmm5,%xmm1
movapd %xmm7,%xmm2
andpd  %xmm5,%xmm2
movapd %xmm4,%xmm3
andpd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
mulsd  0xd23(%rip),%xmm3
ucomisd %xmm3,%xmm1
movapd %xmm7,%xmm5
movapd %xmm0,%xmm3
jbe    139f <NewMoon+0x28f>
ucomisd %xmm3,%xmm6
movapd %xmm5,0x40(%rsp)
movapd %xmm4,0x20(%rsp)
jbe    1260 <NewMoon+0x150>
movapd %xmm9,%xmm1
mulsd  0xcde(%rip),%xmm1
movapd %xmm4,%xmm0
mulsd  0xcea(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    $0x1,%al
movsd  %xmm9,0x30(%rsp)
movsd  %xmm3,0x8(%rsp)
call   1030 <Moon@plt>
movsd  0x8(%rsp),%xmm6
movsd  0x30(%rsp),%xmm9
movapd %xmm0,%xmm1
movapd 0x40(%rsp),%xmm8
movapd 0x20(%rsp),%xmm7
movsd  0x10(%rsp),%xmm4
jmp    12c7 <NewMoon+0x1b7>
movapd %xmm3,%xmm0
movapd %xmm5,%xmm7
movapd 0x10(%rsp),%xmm6
cmpltsd %xmm0,%xmm6
andpd  %xmm6,%xmm7
andnpd %xmm4,%xmm6
orpd   %xmm7,%xmm6
movapd %xmm6,%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @NewMoon(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%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
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double 0x3E7AD7F29ABCAF48, double* %18
%19 = load double, double* %5
store double %19, double* %10
%20 = load double, double* %7
store double %20, double* %13
%21 = load double, double* %7
%22 = load double, double* %6
%23 = fsub double %21, %22
%24 = call double @llvm.fabs.f64(double %23)
%25 = load double, double* %6
%26 = load double, double* %5
%27 = fsub double %25, %26
%28 = call double @llvm.fabs.f64(double %27)
%29 = fcmp ogt double %24, %28
br i1 %29, label %30, label %37
30: ; preds = %3
%31 = load double, double* %6
store double %31, double* %11
%32 = load double, double* %6
%33 = load double, double* %7
%34 = load double, double* %6
%35 = fsub double %33, %34
%36 = call double @llvm.fmuladd.f64(double 0x3FD8722190488D0D, double %35, double %32)
store double %36, double* %12
br label %44
37: ; preds = %3
%38 = load double, double* %6
store double %38, double* %12
%39 = load double, double* %6
%40 = load double, double* %6
%41 = load double, double* %5
%42 = fsub double %40, %41
%43 = call double @llvm.fmuladd.f64(double 0xBFD8722190488D0D, double %42, double %39)
store double %43, double* %11
br label %44
44: ; preds = %37, %30
%45 = load double, double* %11
%46 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %45, double* %14, double* %15, double* %16, double* %17)
store double %46, double* %8
%47 = load double, double* %12
%48 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %47, double* %14, double* %15, double* %16, double* %17)
store double %48, double* %9
br label %49
49: ; preds = %86, %44
%50 = load double, double* %13
%51 = load double, double* %10
%52 = fsub double %50, %51
%53 = call double @llvm.fabs.f64(double %52)
%54 = load double, double* %18
%55 = load double, double* %11
%56 = call double @llvm.fabs.f64(double %55)
%57 = load double, double* %12
%58 = call double @llvm.fabs.f64(double %57)
%59 = fadd double %56, %58
%60 = fmul double %54, %59
%61 = fcmp ogt double %53, %60
br i1 %61, label %62, label %87
62: ; preds = %49
%63 = load double, double* %9
%64 = load double, double* %8
%65 = fcmp olt double %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load double, double* %11
store double %67, double* %10
%68 = load double, double* %12
store double %68, double* %11
%69 = load double, double* %11
%70 = load double, double* %13
%71 = fmul double 0x3FD8722190488D0D, %70
%72 = call double @llvm.fmuladd.f64(double 0x3FE3C6EF37DBB97A, double %69, double %71)
store double %72, double* %12
%73 = load double, double* %9
store double %73, double* %8
%74 = load double, double* %12
%75 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %74, double* %14, double* %15, double* %16, double* %17)
store double %75, double* %9
br label %86
76: ; preds = %62
%77 = load double, double* %12
store double %77, double* %13
%78 = load double, double* %11
store double %78, double* %12
%79 = load double, double* %12
%80 = load double, double* %10
%81 = fmul double 0x3FD8722190488D0D, %80
%82 = call double @llvm.fmuladd.f64(double 0x3FE3C6EF37DBB97A, double %79, double %81)
store double %82, double* %11
%83 = load double, double* %8
store double %83, double* %9
%84 = load double, double* %11
%85 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %84, double* %14, double* %15, double* %16, double* %17)
store double %85, double* %8
br label %86
86: ; preds = %76, %66
br label %49
87: ; preds = %49
%88 = load double, double* %8
%89 = load double, double* %9
%90 = fcmp olt double %88, %89
br i1 %90, label %91, label %93
91: ; preds = %87
%92 = load double, double* %11
store double %92, double* %4
br label %95
93: ; preds = %87
%94 = load double, double* %12
store double %94, double* %4
br label %95
95: ; preds = %93, %91
%96 = load double, double* %4
ret double %96
}

LLVM IR (-O2):
define double @NewMoon(double %0, double %1, double %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 = fsub double %2, %1
%13 = tail call double @llvm.fabs.f64(double %12)
%14 = fsub double %1, %0
%15 = tail call double @llvm.fabs.f64(double %14)
%16 = fcmp ogt double %13, %15
%17 = tail call double @llvm.fmuladd.f64(double %12, double 0x3FD8722190488D0D, double %1)
%18 = tail call double @llvm.fmuladd.f64(double %14, double 0xBFD8722190488D0D, double %1)
%19 = select i1 %16, double %1, double %18
%20 = select i1 %16, double %17, double %1
%21 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %19, double* %4, double* %5, double* %6, double* %7)
%22 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %20, double* %4, double* %5, double* %6, double* %7)
%23 = fsub double %2, %0
%24 = call double @llvm.fabs.f64(double %23)
%25 = call double @llvm.fabs.f64(double %19)
%26 = call double @llvm.fabs.f64(double %20)
%27 = fadd double %25, %26
%28 = fmul double %27, 0x3E7AD7F29ABCAF48
%29 = fcmp ogt double %24, %28
br i1 %29, label %30, label %60
30: ; preds = %3, %46
%31 = phi double [ %52, %46 ], [ %2, %3 ]
%32 = phi double [ %51, %46 ], [ %20, %3 ]
%33 = phi double [ %50, %46 ], [ %19, %3 ]
%34 = phi double [ %49, %46 ], [ %0, %3 ]
%35 = phi double [ %48, %46 ], [ %22, %3 ]
%36 = phi double [ %47, %46 ], [ %21, %3 ]
%37 = fcmp olt double %35, %36
br i1 %37, label %38, label %42
38: ; preds = %30
%39 = fmul double %31, 0x3FD8722190488D0D
%40 = call double @llvm.fmuladd.f64(double %32, double 0x3FE3C6EF37DBB97A, double %39)
%41 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %40, double* %4, double* %5, double* %6, double* %7)
br label %46
42: ; preds = %30
%43 = fmul double %34, 0x3FD8722190488D0D
%44 = call double @llvm.fmuladd.f64(double %33, double 0x3FE3C6EF37DBB97A, double %43)
%45 = call double (double, double*, double*, double*, double*, ...) bitcast (double (...)* @Moon to double (double, double*, double*, double*, double*, ...)*)(double %44, double* %4, double* %5, double* %6, double* %7)
br label %46
46: ; preds = %42, %38
%47 = phi double [ %35, %38 ], [ %45, %42 ]
%48 = phi double [ %41, %38 ], [ %36, %42 ]
%49 = phi double [ %33, %38 ], [ %34, %42 ]
%50 = phi double [ %32, %38 ], [ %44, %42 ]
%51 = phi double [ %40, %38 ], [ %33, %42 ]
%52 = phi double [ %31, %38 ], [ %32, %42 ]
%53 = fsub double %52, %49
%54 = call double @llvm.fabs.f64(double %53)
%55 = call double @llvm.fabs.f64(double %50)
%56 = call double @llvm.fabs.f64(double %51)
%57 = fadd double %55, %56
%58 = fmul double %57, 0x3E7AD7F29ABCAF48
%59 = fcmp ogt double %54, %58
br i1 %59, label %30, label %60
60: ; preds = %46, %3
%61 = phi double [ %21, %3 ], [ %47, %46 ]
%62 = phi double [ %22, %3 ], [ %48, %46 ]
%63 = phi double [ %19, %3 ], [ %50, %46 ]
%64 = phi double [ %20, %3 ], [ %51, %46 ]
%65 = fcmp olt double %61, %62
%66 = select i1 %65, double %63, double %64
ret double %66
}