#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 cos(double);
double cosh(double);
double fabs(double);
double log(int);
double mod2pi(double);
double sin(double);
double sinh(double);
double reb_tools_M_to_E(double e, double M) {
  double E;
  if (e < 1.) {
    E = e < 0.8 ? M : 3.14159265358979323846;
    double F = E - e * sin(E) - M;
    for (int i = 0; i < 100; i++) {
      E = E - F / (1. - e * cos(E));
      F = E - e * sin(E) - M;
      if (fabs(F) < 1.e-16) {
        break;
      }
    }
    E = mod2pi(E);
    return E;
  } else {
    E = M / fabs(M) * log(2. * fabs(M) / e + 1.8);
    double F = E - e * sinh(E) + M;
    for (int i = 0; i < 100; i++) {
      E = E - F / (1.0 - e * cosh(E));
      F = E - e * sinh(E) + M;
      if (fabs(F) < 1.e-16) {
        break;
      }
    }
    return E;
  }
}


x86 assembly (clang, -O0):
<reb_tools_M_to_E>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xe83(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1345 <reb_tools_M_to_E+0x1e5>
movsd  0xe90(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11aa <reb_tools_M_to_E+0x4a>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11bc <reb_tools_M_to_E+0x5c>
movsd  0xe76(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11bc <reb_tools_M_to_E+0x5c>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x64,-0x2c(%rbp)
jge    1327 <reb_tools_M_to_E+0x1c7>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0x80(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x70(%rbp),%xmm0
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xd78(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <sin@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movaps 0xd37(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd13(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1314 <reb_tools_M_to_E+0x1b4>
jmp    1327 <reb_tools_M_to_E+0x1c7>
jmp    1319 <reb_tools_M_to_E+0x1b9>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1221 <reb_tools_M_to_E+0xc1>
movsd  -0x20(%rbp),%xmm0
call   1040 <mod2pi@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1545 <reb_tools_M_to_E+0x3e5>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movaps 0xcda(%rip),%xmm2
pand   %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm1
movaps 0xcbe(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc92(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xc79(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x64,-0x3c(%rbp)
jge    153b <reb_tools_M_to_E+0x3db>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1050 <cosh@plt>
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xb8(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%rbp),%xmm0
ff
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xb70(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xb23(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xaff(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1528 <reb_tools_M_to_E+0x3c8>
jmp    153b <reb_tools_M_to_E+0x3db>
jmp    152d <reb_tools_M_to_E+0x3cd>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1417 <reb_tools_M_to_E+0x2b7>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reb_tools_M_to_E>:
push   %rbx
sub    $0x40,%rsp
movapd %xmm0,%xmm2
movsd  0xe8f(%rip),%xmm0
ucomisd %xmm2,%xmm0
movapd %xmm1,0x30(%rsp)
movapd %xmm2,0x10(%rsp)
jbe    1283 <reb_tools_M_to_E+0x123>
movapd %xmm2,%xmm0
cmpltsd 0xe84(%rip),%xmm0
movapd %xmm0,%xmm3
andpd  %xmm1,%xmm3
movsd  0xe7c(%rip),%xmm1
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
movapd %xmm0,(%rsp)
call   1060 <sin@plt>
movapd (%rsp),%xmm1
movapd 0xe7d(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
xorpd  %xmm3,%xmm2
movapd %xmm2,0x20(%rsp)
mulsd  %xmm3,%xmm0
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
subsd  0x30(%rsp),%xmm2
mov    $0x63,%ebx
nopw   0x0(%rax,%rax,1)
movapd %xmm2,0x10(%rsp)
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1070 <cos@plt>
mulsd  0x20(%rsp),%xmm0
addsd  0xdee(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd (%rsp),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
movapd (%rsp),%xmm0
call   1060 <sin@plt>
movapd (%rsp),%xmm1
movapd %xmm0,%xmm2
mulsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
subsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm0
andpd  0xdd7(%rip),%xmm0
sub    $0x1,%ebx
setb   %al
movsd  0xda9(%rip),%xmm3
ucomisd %xmm0,%xmm3
ja     1275 <reb_tools_M_to_E+0x115>
test   %al,%al
je     11f0 <reb_tools_M_to_E+0x90>
movapd %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbx
jmp    1040 <mod2pi@plt>
movapd 0xda5(%rip),%xmm0
andpd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
addsd  %xmm0,%xmm0
divsd  %xmm2,%xmm0
addsd  0xd60(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <log@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sinh@plt>
movsd  (%rsp),%xmm1
movapd 0xd73(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
xorpd  %xmm3,%xmm2
movapd %xmm2,0x20(%rsp)
mulsd  %xmm3,%xmm0
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  0x30(%rsp),%xmm2
mov    $0x63,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm2,0x10(%rsp)
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1050 <cosh@plt>
mulsd  0x20(%rsp),%xmm0
addsd  0xcde(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sinh@plt>
movsd  (%rsp),%xmm1
movapd %xmm0,%xmm2
mulsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
addsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm0
andpd  0xcc7(%rip),%xmm0
sub    $0x1,%ebx
setb   %al
movsd  0xc99(%rip),%xmm3
ucomisd %xmm0,%xmm3
ja     1385 <reb_tools_M_to_E+0x225>
test   %al,%al
je     1300 <reb_tools_M_to_E+0x1a0>
movapd %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @reb_tools_M_to_E(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
store double %0, double* %4
store double %1, double* %5
%11 = load double, double* %4
%12 = fcmp olt double %11, 1.000000e+00
br i1 %12, label %13, label %62
13: ; preds = %2
%14 = load double, double* %4
%15 = fcmp olt double %14, 8.000000e-01
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load double, double* %5
br label %19
18: ; preds = %13
br label %19
19: ; preds = %18, %16
%20 = phi double [ %17, %16 ], [ 0x400921FB54442D18, %18 ]
store double %20, double* %6
%21 = load double, double* %6
%22 = load double, double* %4
%23 = load double, double* %6
%24 = call double @sin(double %23)
%25 = fneg double %22
%26 = call double @llvm.fmuladd.f64(double %25, double %24, double %21)
%27 = load double, double* %5
%28 = fsub double %26, %27
store double %28, double* %7
store i32 0, i32* %8
br label %29
29: ; preds = %55, %19
%30 = load i32, i32* %8
%31 = icmp slt i32 %30, 100
br i1 %31, label %32, label %58
32: ; preds = %29
%33 = load double, double* %6
%34 = load double, double* %7
%35 = load double, double* %4
%36 = load double, double* %6
%37 = call double @cos(double %36)
%38 = fneg double %35
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double 1.000000e+00)
%40 = fdiv double %34, %39
%41 = fsub double %33, %40
store double %41, double* %6
%42 = load double, double* %6
%43 = load double, double* %4
%44 = load double, double* %6
%45 = call double @sin(double %44)
%46 = fneg double %43
%47 = call double @llvm.fmuladd.f64(double %46, double %45, double %42)
%48 = load double, double* %5
%49 = fsub double %47, %48
store double %49, double* %7
%50 = load double, double* %7
%51 = call double @llvm.fabs.f64(double %50)
%52 = fcmp olt double %51, 0x3C9CD2B297D889BC
br i1 %52, label %53, label %54
53: ; preds = %32
br label %58
54: ; preds = %32
br label %55
55: ; preds = %54
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %29
58: ; preds = %53, %29
%59 = load double, double* %6
%60 = call double @mod2pi(double %59)
store double %60, double* %6
%61 = load double, double* %6
store double %61, double* %3
br label %115
62: ; preds = %2
%63 = load double, double* %5
%64 = load double, double* %5
%65 = call double @llvm.fabs.f64(double %64)
%66 = fdiv double %63, %65
%67 = load double, double* %5
%68 = call double @llvm.fabs.f64(double %67)
%69 = fmul double 2.000000e+00, %68
%70 = load double, double* %4
%71 = fdiv double %69, %70
%72 = fadd double %71, 1.800000e+00
%73 = fptosi double %72 to i32
%74 = call double @log(i32 %73)
%75 = fmul double %66, %74
store double %75, double* %6
%76 = load double, double* %6
%77 = load double, double* %4
%78 = load double, double* %6
%79 = call double @sinh(double %78)
%80 = fneg double %77
%81 = call double @llvm.fmuladd.f64(double %80, double %79, double %76)
%82 = load double, double* %5
%83 = fadd double %81, %82
store double %83, double* %9
store i32 0, i32* %10
br label %84
84: ; preds = %110, %62
%85 = load i32, i32* %10
%86 = icmp slt i32 %85, 100
br i1 %86, label %87, label %113
87: ; preds = %84
%88 = load double, double* %6
%89 = load double, double* %9
%90 = load double, double* %4
%91 = load double, double* %6
%92 = call double @cosh(double %91)
%93 = fneg double %90
%94 = call double @llvm.fmuladd.f64(double %93, double %92, double 1.000000e+00)
%95 = fdiv double %89, %94
%96 = fsub double %88, %95
store double %96, double* %6
%97 = load double, double* %6
%98 = load double, double* %4
%99 = load double, double* %6
%100 = call double @sinh(double %99)
%101 = fneg double %98
%102 = call double @llvm.fmuladd.f64(double %101, double %100, double %97)
%103 = load double, double* %5
%104 = fadd double %102, %103
store double %104, double* %9
%105 = load double, double* %9
%106 = call double @llvm.fabs.f64(double %105)
%107 = fcmp olt double %106, 0x3C9CD2B297D889BC
br i1 %107, label %108, label %109
108: ; preds = %87
br label %113
109: ; preds = %87
br label %110
110: ; preds = %109
%111 = load i32, i32* %10
%112 = add nsw i32 %111, 1
store i32 %112, i32* %10
br label %84
113: ; preds = %108, %84
%114 = load double, double* %6
store double %114, double* %3
br label %115
115: ; preds = %113, %58
%116 = load double, double* %3
ret double %116
}

LLVM IR (-O2):
define double @reb_tools_M_to_E(double %0, double %1) {
%3 = fcmp olt double %0, 1.000000e+00
br i1 %3, label %4, label %29
4: ; preds = %2
%5 = fcmp olt double %0, 8.000000e-01
%6 = select i1 %5, double %1, double 0x400921FB54442D18
%7 = tail call double @sin(double %6)
%8 = fneg double %0
%9 = tail call double @llvm.fmuladd.f64(double %8, double %7, double %6)
%10 = fsub double %9, %1
br label %11
11: ; preds = %11, %4
%12 = phi i32 [ 0, %4 ], [ %24, %11 ]
%13 = phi double [ %10, %4 ], [ %21, %11 ]
%14 = phi double [ %6, %4 ], [ %18, %11 ]
%15 = tail call double @cos(double %14)
%16 = tail call double @llvm.fmuladd.f64(double %8, double %15, double 1.000000e+00)
%17 = fdiv double %13, %16
%18 = fsub double %14, %17
%19 = tail call double @sin(double %18)
%20 = tail call double @llvm.fmuladd.f64(double %8, double %19, double %18)
%21 = fsub double %20, %1
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp olt double %22, 0x3C9CD2B297D889BC
%24 = add nuw nsw i32 %12, 1
%25 = icmp eq i32 %24, 100
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %27, label %11
27: ; preds = %11
%28 = tail call double @mod2pi(double %18)
br label %58
29: ; preds = %2
%30 = tail call double @llvm.fabs.f64(double %1)
%31 = fdiv double %1, %30
%32 = fmul double %30, 2.000000e+00
%33 = fdiv double %32, %0
%34 = fadd double %33, 1.800000e+00
%35 = fptosi double %34 to i32
%36 = tail call double @log(i32 %35)
%37 = fmul double %31, %36
%38 = tail call double @sinh(double %37)
%39 = fneg double %0
%40 = tail call double @llvm.fmuladd.f64(double %39, double %38, double %37)
%41 = fadd double %40, %1
br label %42
42: ; preds = %42, %29
%43 = phi i32 [ 0, %29 ], [ %55, %42 ]
%44 = phi double [ %41, %29 ], [ %52, %42 ]
%45 = phi double [ %37, %29 ], [ %49, %42 ]
%46 = tail call double @cosh(double %45)
%47 = tail call double @llvm.fmuladd.f64(double %39, double %46, double 1.000000e+00)
%48 = fdiv double %44, %47
%49 = fsub double %45, %48
%50 = tail call double @sinh(double %49)
%51 = tail call double @llvm.fmuladd.f64(double %39, double %50, double %49)
%52 = fadd double %51, %1
%53 = tail call double @llvm.fabs.f64(double %52)
%54 = fcmp olt double %53, 0x3C9CD2B297D889BC
%55 = add nuw nsw i32 %43, 1
%56 = icmp eq i32 %55, 100
%57 = select i1 %54, i1 true, i1 %56
br i1 %57, label %58, label %42
58: ; preds = %42, %27
%59 = phi double [ %28, %27 ], [ %49, %42 ]
ret double %59
}