#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 atan2(int, int);
int cos(double);
int pow(int, double);
int sin(double);
double TrueAnomaly(double E, double ecc) {
  if (ecc == 0.)
    return E;
  else
    return 2. * atan2(pow(1. + ecc, 0.5) * sin(E / 2.),
                      pow(1. - ecc, 0.5) * cos(E / 2.));
}


x86 assembly (clang, -O0):
<TrueAnomaly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1179 <TrueAnomaly+0x39>
jp     1179 <TrueAnomaly+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1215 <TrueAnomaly+0xd5>
movsd  0xe8f(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe76(%rip),%xmm0
call   1060 <pow@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
movsd  0xe4d(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe34(%rip),%xmm0
call   1060 <pow@plt>
mov    %eax,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe17(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edi
imul   %eax,%esi
call   1030 <atan2@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdf4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TrueAnomaly>:
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1155 <TrueAnomaly+0x15>
jp     1155 <TrueAnomaly+0x15>
movapd %xmm2,%xmm0
ret
push   %rbp
push   %rbx
sub    $0x18,%rsp
movapd %xmm1,%xmm0
addsd  0xe99(%rip),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe95(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1060 <pow@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xe74(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <sin@plt>
imul   %eax,%ebx
movsd  0xe56(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe4c(%rip),%xmm0
call   1060 <pow@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <atan2@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
addsd  %xmm2,%xmm2
add    $0x18,%rsp
pop    %rbx
pop    %rbp
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @TrueAnomaly(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %4
store double %9, double* %3
br label %30
10: ; preds = %2
%11 = load double, double* %5
%12 = fadd double 1.000000e+00, %11
%13 = fptosi double %12 to i32
%14 = call i32 @pow(i32 %13, double 5.000000e-01)
%15 = load double, double* %4
%16 = fdiv double %15, 2.000000e+00
%17 = call i32 @sin(double %16)
%18 = mul nsw i32 %14, %17
%19 = load double, double* %5
%20 = fsub double 1.000000e+00, %19
%21 = fptosi double %20 to i32
%22 = call i32 @pow(i32 %21, double 5.000000e-01)
%23 = load double, double* %4
%24 = fdiv double %23, 2.000000e+00
%25 = call i32 @cos(double %24)
%26 = mul nsw i32 %22, %25
%27 = call i32 @atan2(i32 %18, i32 %26)
%28 = sitofp i32 %27 to double
%29 = fmul double 2.000000e+00, %28
store double %29, double* %3
br label %30
30: ; preds = %10, %8
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @TrueAnomaly(double %0, double %1) {
%3 = fcmp oeq double %1, 0.000000e+00
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = fadd double %1, 1.000000e+00
%6 = fptosi double %5 to i32
%7 = tail call i32 @pow(i32 %6, double 5.000000e-01)
%8 = fmul double %0, 5.000000e-01
%9 = tail call i32 @sin(double %8)
%10 = mul nsw i32 %9, %7
%11 = fsub double 1.000000e+00, %1
%12 = fptosi double %11 to i32
%13 = tail call i32 @pow(i32 %12, double 5.000000e-01)
%14 = tail call i32 @cos(double %8)
%15 = mul nsw i32 %14, %13
%16 = tail call i32 @atan2(i32 %10, i32 %15)
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 2.000000e+00
br label %19
19: ; preds = %2, %4
%20 = phi double [ %18, %4 ], [ %0, %2 ]
ret double %20
}