#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(int);
double reb_tools_mod2pi(int);
int sqrt(int);
int tan(double);
int tanh(double);
double reb_tools_E_to_f(double e, double E) {
  if (e > 1.) {
    return reb_tools_mod2pi(2. *
                            atan(sqrt((1. + e) / (e - 1.)) * tanh(0.5 * E)));
  } else {
    return reb_tools_mod2pi(2. *
                            atan(sqrt((1. + e) / (1. - e)) * tan(0.5 * E)));
  }
}


x86 assembly (clang, -O0):
<reb_tools_E_to_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e7 <reb_tools_E_to_f+0x97>
movsd  0xe7f(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe6d(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
mov    %eax,-0x1c(%rbp)
movsd  0xe61(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <tanh@plt>
mov    -0x1c(%rbp),%edi
imul   %eax,%edi
call   1040 <atan@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe38(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <reb_tools_mod2pi@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    124c <reb_tools_E_to_f+0xfc>
movsd  0xe11(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe04(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
mov    %eax,-0x20(%rbp)
movsd  0xdf7(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <tan@plt>
mov    -0x20(%rbp),%edi
imul   %eax,%edi
call   1040 <atan@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdce(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <reb_tools_mod2pi@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reb_tools_E_to_f>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  0xe9d(%rip),%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm0,%xmm1
addsd  %xmm2,%xmm1
jbe    119d <reb_tools_E_to_f+0x4d>
addsd  0xe97(%rip),%xmm0
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1060 <sqrt@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xe72(%rip),%xmm0
call   1030 <tanh@plt>
jmp    11c3 <reb_tools_E_to_f+0x73>
subsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1060 <sqrt@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xe4a(%rip),%xmm0
call   1050 <tan@plt>
imul   %ebx,%eax
mov    %eax,%edi
call   1040 <atan@plt>
lea    (%rax,%rax,1),%edi
add    $0x10,%rsp
pop    %rbx
jmp    1070 <reb_tools_mod2pi@plt>

LLVM IR (-O0):
define double @reb_tools_E_to_f(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* %4
%7 = fcmp ogt double %6, 1.000000e+00
br i1 %7, label %8, label %25
8: ; preds = %2
%9 = load double, double* %4
%10 = fadd double 1.000000e+00, %9
%11 = load double, double* %4
%12 = fsub double %11, 1.000000e+00
%13 = fdiv double %10, %12
%14 = fptosi double %13 to i32
%15 = call i32 @sqrt(i32 %14)
%16 = load double, double* %5
%17 = fmul double 5.000000e-01, %16
%18 = call i32 @tanh(double %17)
%19 = mul nsw i32 %15, %18
%20 = call i32 @atan(i32 %19)
%21 = sitofp i32 %20 to double
%22 = fmul double 2.000000e+00, %21
%23 = fptosi double %22 to i32
%24 = call double @reb_tools_mod2pi(i32 %23)
store double %24, double* %3
br label %42
25: ; preds = %2
%26 = load double, double* %4
%27 = fadd double 1.000000e+00, %26
%28 = load double, double* %4
%29 = fsub double 1.000000e+00, %28
%30 = fdiv double %27, %29
%31 = fptosi double %30 to i32
%32 = call i32 @sqrt(i32 %31)
%33 = load double, double* %5
%34 = fmul double 5.000000e-01, %33
%35 = call i32 @tan(double %34)
%36 = mul nsw i32 %32, %35
%37 = call i32 @atan(i32 %36)
%38 = sitofp i32 %37 to double
%39 = fmul double 2.000000e+00, %38
%40 = fptosi double %39 to i32
%41 = call double @reb_tools_mod2pi(i32 %40)
store double %41, double* %3
br label %42
42: ; preds = %25, %8
%43 = load double, double* %3
ret double %43
}

LLVM IR (-O2):
define double @reb_tools_E_to_f(double %0, double %1) {
%3 = fcmp ogt double %0, 1.000000e+00
%4 = fadd double %0, 1.000000e+00
br i1 %3, label %5, label %13
5: ; preds = %2
%6 = fadd double %0, -1.000000e+00
%7 = fdiv double %4, %6
%8 = fptosi double %7 to i32
%9 = tail call i32 @sqrt(i32 %8)
%10 = fmul double %1, 5.000000e-01
%11 = tail call i32 @tanh(double %10)
%12 = mul nsw i32 %11, %9
br label %21
13: ; preds = %2
%14 = fsub double 1.000000e+00, %0
%15 = fdiv double %4, %14
%16 = fptosi double %15 to i32
%17 = tail call i32 @sqrt(i32 %16)
%18 = fmul double %1, 5.000000e-01
%19 = tail call i32 @tan(double %18)
%20 = mul nsw i32 %19, %17
br label %21
21: ; preds = %13, %5
%22 = phi i32 [ %20, %13 ], [ %12, %5 ]
%23 = tail call i32 @atan(i32 %22)
%24 = shl i32 %23, 1
%25 = tail call double @reb_tools_mod2pi(i32 %24)
ret double %25
}