#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);
int fabs(double);
double sin(double);
double solveKepler(double M, double e) {
  double E, Eprime = 3.141592653589793;
  do {
    double cosE = cos(Eprime);
    E = Eprime;
    Eprime = (M - e * (E * cosE - sin(E))) / (1.0 - e * cosE);
  } while (fabs(E - Eprime) > 1e-7);
  return (Eprime);
}


x86 assembly (clang, -O0):
<solveKepler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x30(%rbp),%xmm0
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdec(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xdcc(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     114f <solveKepler+0x1f>
movsd  -0x20(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveKepler>:
sub    $0x38,%rsp
movsd  %xmm0,0x10(%rsp)
xorpd  0xebe(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  (%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
movapd 0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm2
addsd  0xe68(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     1160 <solveKepler+0x30>
movsd  (%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @solveKepler(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
store double 0x400921FB54442D18, double* %6
br label %8
8: ; preds = %27, %2
%9 = load double, double* %6
%10 = call double @cos(double %9)
store double %10, double* %7
%11 = load double, double* %6
store double %11, double* %5
%12 = load double, double* %3
%13 = load double, double* %4
%14 = load double, double* %5
%15 = load double, double* %7
%16 = load double, double* %5
%17 = call double @sin(double %16)
%18 = fneg double %17
%19 = call double @llvm.fmuladd.f64(double %14, double %15, double %18)
%20 = fneg double %13
%21 = call double @llvm.fmuladd.f64(double %20, double %19, double %12)
%22 = load double, double* %4
%23 = load double, double* %7
%24 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double 1.000000e+00)
%26 = fdiv double %21, %25
store double %26, double* %6
br label %27
27: ; preds = %8
%28 = load double, double* %5
%29 = load double, double* %6
%30 = fsub double %28, %29
%31 = call i32 @fabs(double %30)
%32 = sitofp i32 %31 to double
%33 = fcmp ogt double %32, 0x3E7AD7F29ABCAF48
br i1 %33, label %8, label %34
34: ; preds = %27
%35 = load double, double* %6
ret double %35
}

LLVM IR (-O2):
define double @solveKepler(double %0, double %1) {
%3 = fneg double %1
br label %4
4: ; preds = %4, %2
%5 = phi double [ 0x400921FB54442D18, %2 ], [ %12, %4 ]
%6 = tail call double @cos(double %5)
%7 = tail call double @sin(double %5)
%8 = fneg double %7
%9 = tail call double @llvm.fmuladd.f64(double %5, double %6, double %8)
%10 = tail call double @llvm.fmuladd.f64(double %3, double %9, double %0)
%11 = tail call double @llvm.fmuladd.f64(double %3, double %6, double 1.000000e+00)
%12 = fdiv double %10, %11
%13 = fsub double %5, %12
%14 = tail call i32 @fabs(double %13)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %4, label %16
16: ; preds = %4
ret double %12
}