#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 atan(double);
int atan2(double, double);
double cos(double);
double cosh(double);
double sin(double);
double sinh(double);
double sqrt(double);
double true_anomaly_at_eccentric_anomaly(double e, double E) {
  if (e < 1.) {
    double x = sqrt(1. - e) * cos(E / 2.);
    double y = sqrt(1. + e) * sin(E / 2.);
    return 2. * atan2(y, x);
  } else if (e == 1.) {
    return 2 * atan(E);
  } else {
    double x = sqrt(e - 1.) * cosh(E / 2.);
    double y = sqrt(e + 1.) * sinh(E / 2.);
    return 2. * atan2(y, x);
  }
}


x86 assembly (clang, -O0):
<true_anomaly_at_eccentric_anomaly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xe76(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    123a <true_anomaly_at_eccentric_anomaly+0xca>
movsd  0xe63(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe25(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <atan2@plt>
cvtsi2sd %eax,%xmm1
movsd  0xddc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1316 <true_anomaly_at_eccentric_anomaly+0x1a6>
movsd  -0x10(%rbp),%xmm0
movsd  0xdb9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1272 <true_anomaly_at_eccentric_anomaly+0x102>
jp     1272 <true_anomaly_at_eccentric_anomaly+0x102>
movsd  -0x18(%rbp),%xmm0
call   1070 <atan@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1316 <true_anomaly_at_eccentric_anomaly+0x1a6>
movsd  -0x10(%rbp),%xmm0
movsd  0xd81(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xd6e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cosh@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd44(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xd30(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sinh@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1040 <atan2@plt>
cvtsi2sd %eax,%xmm1
movsd  0xcfb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<true_anomaly_at_eccentric_anomaly>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
movsd  0xe80(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11a0 <true_anomaly_at_eccentric_anomaly+0x30>
movsd  %xmm2,0x8(%rsp)
subsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     11ca <true_anomaly_at_eccentric_anomaly+0x5a>
sqrtsd %xmm0,%xmm0
jmp    11db <true_anomaly_at_eccentric_anomaly+0x6b>
ucomisd 0xe58(%rip),%xmm2
jne    123a <true_anomaly_at_eccentric_anomaly+0xca>
jp     123a <true_anomaly_at_eccentric_anomaly+0xca>
movaps %xmm1,%xmm0
call   1070 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x18,%rsp
ret
movsd  %xmm1,0x10(%rsp)
call   1090 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,(%rsp)
mulsd  0xe28(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
call   1080 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xdf1(%rip),%xmm0
ucomisd 0xe01(%rip),%xmm0
jb     121f <true_anomaly_at_eccentric_anomaly+0xaf>
sqrtsd %xmm0,%xmm0
jmp    1224 <true_anomaly_at_eccentric_anomaly+0xb4>
call   1090 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <sin@plt>
jmp    12c7 <true_anomaly_at_eccentric_anomaly+0x157>
movsd  0xdc6(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     125c <true_anomaly_at_eccentric_anomaly+0xec>
sqrtsd %xmm0,%xmm0
jmp    126d <true_anomaly_at_eccentric_anomaly+0xfd>
movsd  %xmm1,0x10(%rsp)
call   1090 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,(%rsp)
mulsd  0xd96(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
call   1050 <cosh@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xd5f(%rip),%xmm0
ucomisd 0xd6f(%rip),%xmm0
jb     12b1 <true_anomaly_at_eccentric_anomaly+0x141>
sqrtsd %xmm0,%xmm0
jmp    12b6 <true_anomaly_at_eccentric_anomaly+0x146>
call   1090 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sinh@plt>
mulsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1040 <atan2@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @true_anomaly_at_eccentric_anomaly(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
%10 = load double, double* %4
%11 = fcmp olt double %10, 1.000000e+00
br i1 %11, label %12, label %32
12: ; preds = %2
%13 = load double, double* %4
%14 = fsub double 1.000000e+00, %13
%15 = call double @sqrt(double %14)
%16 = load double, double* %5
%17 = fdiv double %16, 2.000000e+00
%18 = call double @cos(double %17)
%19 = fmul double %15, %18
store double %19, double* %6
%20 = load double, double* %4
%21 = fadd double 1.000000e+00, %20
%22 = call double @sqrt(double %21)
%23 = load double, double* %5
%24 = fdiv double %23, 2.000000e+00
%25 = call double @sin(double %24)
%26 = fmul double %22, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = load double, double* %6
%29 = call i32 @atan2(double %27, double %28)
%30 = sitofp i32 %29 to double
%31 = fmul double 2.000000e+00, %30
store double %31, double* %3
br label %60
32: ; preds = %2
%33 = load double, double* %4
%34 = fcmp oeq double %33, 1.000000e+00
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load double, double* %5
%37 = call i32 @atan(double %36)
%38 = mul nsw i32 2, %37
%39 = sitofp i32 %38 to double
store double %39, double* %3
br label %60
40: ; preds = %32
%41 = load double, double* %4
%42 = fsub double %41, 1.000000e+00
%43 = call double @sqrt(double %42)
%44 = load double, double* %5
%45 = fdiv double %44, 2.000000e+00
%46 = call double @cosh(double %45)
%47 = fmul double %43, %46
store double %47, double* %8
%48 = load double, double* %4
%49 = fadd double %48, 1.000000e+00
%50 = call double @sqrt(double %49)
%51 = load double, double* %5
%52 = fdiv double %51, 2.000000e+00
%53 = call double @sinh(double %52)
%54 = fmul double %50, %53
store double %54, double* %9
%55 = load double, double* %9
%56 = load double, double* %8
%57 = call i32 @atan2(double %55, double %56)
%58 = sitofp i32 %57 to double
%59 = fmul double 2.000000e+00, %58
store double %59, double* %3
br label %60
60: ; preds = %40, %35, %12
%61 = load double, double* %3
ret double %61
}

LLVM IR (-O2):
define double @true_anomaly_at_eccentric_anomaly(double %0, double %1) {
%3 = fcmp olt double %0, 1.000000e+00
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = fsub double 1.000000e+00, %0
%6 = tail call double @sqrt(double %5)
%7 = fmul double %1, 5.000000e-01
%8 = tail call double @cos(double %7)
%9 = fmul double %6, %8
%10 = fadd double %0, 1.000000e+00
%11 = tail call double @sqrt(double %10)
%12 = tail call double @sin(double %7)
%13 = fmul double %11, %12
%14 = tail call i32 @atan2(double %13, double %9)
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 2.000000e+00
br label %36
17: ; preds = %2
%18 = fcmp oeq double %0, 1.000000e+00
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = tail call i32 @atan(double %1)
%21 = shl nsw i32 %20, 1
%22 = sitofp i32 %21 to double
br label %36
23: ; preds = %17
%24 = fadd double %0, -1.000000e+00
%25 = tail call double @sqrt(double %24)
%26 = fmul double %1, 5.000000e-01
%27 = tail call double @cosh(double %26)
%28 = fmul double %25, %27
%29 = fadd double %0, 1.000000e+00
%30 = tail call double @sqrt(double %29)
%31 = tail call double @sinh(double %26)
%32 = fmul double %30, %31
%33 = tail call i32 @atan2(double %32, double %28)
%34 = sitofp i32 %33 to double
%35 = fmul double %34, 2.000000e+00
br label %36
36: ; preds = %23, %19, %4
%37 = phi double [ %16, %4 ], [ %22, %19 ], [ %35, %23 ]
ret double %37
}