#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 fabs(double);
double sin(double);
double EccentricAnomaly(double M, double e, double tol, int maxiter) {
  double E = M, eps = tol;
  if (e == 0.)
    return M;
  while (fabs(E - e * sin(E) - M) > eps)
    E = E - (E - e * sin(E) - M) / (1.0 - e * cos(E));
  return E;
}


x86 assembly (clang, -O0):
<EccentricAnomaly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1175 <EccentricAnomaly+0x55>
jp     1175 <EccentricAnomaly+0x55>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a6 <EccentricAnomaly+0x186>
jmp    117a <EccentricAnomaly+0x5a>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xe30(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    129c <EccentricAnomaly+0x17c>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xd8a(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    117a <EccentricAnomaly+0x5a>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EccentricAnomaly>:
sub    $0x38,%rsp
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm1,0x10(%rsp)
ucomisd %xmm0,%xmm1
jne    113f <EccentricAnomaly+0x1f>
jnp    122f <EccentricAnomaly+0x10f>
movsd  (%rsp),%xmm0
movsd  %xmm2,0x28(%rsp)
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
andpd  0xea2(%rip),%xmm1
ucomisd 0x28(%rsp),%xmm1
jbe    122f <EccentricAnomaly+0x10f>
movapd 0x10(%rsp),%xmm0
xorpd  0xe78(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0xe41(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
subsd  (%rsp),%xmm0
andpd  0xdef(%rip),%xmm0
ucomisd 0x28(%rsp),%xmm0
ja     11a0 <EccentricAnomaly+0x80>
jmp    1234 <EccentricAnomaly+0x114>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @EccentricAnomaly(double %0, double %1, double %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
%12 = load double, double* %6
store double %12, double* %10
%13 = load double, double* %8
store double %13, double* %11
%14 = load double, double* %7
%15 = fcmp oeq double %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %4
%17 = load double, double* %6
store double %17, double* %5
br label %50
18: ; preds = %4
br label %19
19: ; preds = %31, %18
%20 = load double, double* %10
%21 = load double, double* %7
%22 = load double, double* %10
%23 = call double @sin(double %22)
%24 = fneg double %21
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %20)
%26 = load double, double* %6
%27 = fsub double %25, %26
%28 = call double @llvm.fabs.f64(double %27)
%29 = load double, double* %11
%30 = fcmp ogt double %28, %29
br i1 %30, label %31, label %48
31: ; preds = %19
%32 = load double, double* %10
%33 = load double, double* %10
%34 = load double, double* %7
%35 = load double, double* %10
%36 = call double @sin(double %35)
%37 = fneg double %34
%38 = call double @llvm.fmuladd.f64(double %37, double %36, double %33)
%39 = load double, double* %6
%40 = fsub double %38, %39
%41 = load double, double* %7
%42 = load double, double* %10
%43 = call double @cos(double %42)
%44 = fneg double %41
%45 = call double @llvm.fmuladd.f64(double %44, double %43, double 1.000000e+00)
%46 = fdiv double %40, %45
%47 = fsub double %32, %46
store double %47, double* %10
br label %19
48: ; preds = %19
%49 = load double, double* %10
store double %49, double* %5
br label %50
50: ; preds = %48, %16
%51 = load double, double* %5
ret double %51
}

LLVM IR (-O2):
define double @EccentricAnomaly(double %0, double %1, double %2, i32 %3) {
%5 = fcmp oeq double %1, 0.000000e+00
br i1 %5, label %27, label %6
6: ; preds = %4
%7 = fneg double %1
%8 = tail call double @sin(double %0)
%9 = tail call double @llvm.fmuladd.f64(double %7, double %8, double %0)
%10 = fsub double %9, %0
%11 = tail call double @llvm.fabs.f64(double %10)
%12 = fcmp ogt double %11, %2
br i1 %12, label %13, label %27
13: ; preds = %6, %13
%14 = phi double [ %21, %13 ], [ %0, %6 ]
%15 = tail call double @sin(double %14)
%16 = tail call double @llvm.fmuladd.f64(double %7, double %15, double %14)
%17 = fsub double %16, %0
%18 = tail call double @cos(double %14)
%19 = tail call double @llvm.fmuladd.f64(double %7, double %18, double 1.000000e+00)
%20 = fdiv double %17, %19
%21 = fsub double %14, %20
%22 = tail call double @sin(double %21)
%23 = tail call double @llvm.fmuladd.f64(double %7, double %22, double %21)
%24 = fsub double %23, %0
%25 = tail call double @llvm.fabs.f64(double %24)
%26 = fcmp ogt double %25, %2
br i1 %26, label %13, label %27
27: ; preds = %13, %6, %4
%28 = phi double [ %0, %4 ], [ %0, %6 ], [ %21, %13 ]
ret double %28
}