#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(double, double);
double cos(double);
double sin(double);
double sqrt(int);
double calc_TrueAnom(double EccAnom, double ecc) {
  double xcirc, ycirc;
  double sss = sqrt(1. + ecc);
  ycirc = sss * sin(EccAnom / 2.);
  xcirc = sss * cos(EccAnom / 2.);
  return 2 * atan2(ycirc, xcirc);
}


x86 assembly (clang, -O0):
<calc_TrueAnom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeae(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <atan2@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_TrueAnom>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
addsd  0xeaf(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe9b(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
call   1030 <atan2@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @calc_TrueAnom(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %4
%9 = fadd double 1.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = call double @sqrt(i32 %10)
store double %11, double* %7
%12 = load double, double* %7
%13 = load double, double* %3
%14 = fdiv double %13, 2.000000e+00
%15 = call double @sin(double %14)
%16 = fmul double %12, %15
store double %16, double* %6
%17 = load double, double* %7
%18 = load double, double* %3
%19 = fdiv double %18, 2.000000e+00
%20 = call double @cos(double %19)
%21 = fmul double %17, %20
store double %21, double* %5
%22 = load double, double* %6
%23 = load double, double* %5
%24 = call i32 @atan2(double %22, double %23)
%25 = mul nsw i32 2, %24
%26 = sitofp i32 %25 to double
ret double %26
}

LLVM IR (-O2):
define double @calc_TrueAnom(double %0, double %1) {
%3 = fadd double %1, 1.000000e+00
%4 = fptosi double %3 to i32
%5 = tail call double @sqrt(i32 %4)
%6 = fmul double %0, 5.000000e-01
%7 = tail call double @sin(double %6)
%8 = fmul double %5, %7
%9 = tail call double @cos(double %6)
%10 = fmul double %5, %9
%11 = tail call i32 @atan2(double %8, double %10)
%12 = shl nsw i32 %11, 1
%13 = sitofp i32 %12 to double
ret double %13
}