#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 anomaly_MeanToEccentric(double M, double e, double maxErr) {
  double E = M;
  for (int i = 0; i < 10; i++) {
    double se = sin(E);
    double ce = cos(E);
    double A = e * se;
    double B = E - A - M;
    double C = 1 - e * ce;
    double err = E - B / (C - 0.5 * A * (B / C));
    if (fabs(err) > maxErr) {
      E = E - err;
    } else {
      break;
    }
  }
  return E;
}


x86 assembly (clang, -O0):
<anomaly_MeanToEccentric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jge    1262 <anomaly_MeanToEccentric+0x142>
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe58(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm3
movsd  0xe30(%rip),%xmm2
mulsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm4
divsd  -0x50(%rbp),%xmm4
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movaps 0xdd9(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    124a <anomaly_MeanToEccentric+0x12a>
movsd  -0x20(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    124f <anomaly_MeanToEccentric+0x12f>
jmp    1262 <anomaly_MeanToEccentric+0x142>
jmp    1254 <anomaly_MeanToEccentric+0x134>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <anomaly_MeanToEccentric+0x28>
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anomaly_MeanToEccentric>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm2,0x10(%rsp)
movapd 0xecd(%rip),%xmm2
movapd %xmm1,0x30(%rsp)
xorpd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
mov    $0xa,%ebx
movsd  %xmm0,0x8(%rsp)
movapd %xmm0,%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x18(%rsp),%xmm3
mulsd  0x30(%rsp),%xmm3
movsd  (%rsp),%xmm1
subsd  %xmm3,%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
addsd  0xe79(%rip),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
mulsd  0xe71(%rip),%xmm3
mulsd  %xmm2,%xmm3
movsd  (%rsp),%xmm2
addsd  %xmm0,%xmm3
divsd  %xmm3,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
andpd  0xe34(%rip),%xmm1
ucomisd 0x10(%rsp),%xmm1
jbe    11f1 <anomaly_MeanToEccentric+0xd1>
subsd  %xmm0,%xmm2
add    $0xffffffff,%ebx
jne    1160 <anomaly_MeanToEccentric+0x40>
movapd %xmm2,%xmm0
add    $0x40,%rsp
pop    %rbx
ret

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

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