#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 swi_mod2PI(double);
double swi_kepler(double E, double M, double ecce) {
  double dE = 1, E0;
  double x;
  if (ecce < 0.4) {
    while (dE > 1e-12) {
      E0 = E;
      E = M + ecce * sin(E0);
      dE = fabs(E - E0);
    }
  } else {
    while (dE > 1e-12) {
      E0 = E;
      x = (M + ecce * sin(E0) - E0) / (1 - ecce * cos(E0));
      dE = fabs(x);
      if (dE < 1e-2) {
        E = E0 + x;
      } else {
        E = swi_mod2PI(E0 + x);
        dE = fabs(E - E0);
      }
    }
  }
  return E;
}


x86 assembly (clang, -O0):
<swi_kepler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea4(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11e9 <swi_kepler+0xb9>
jmp    116c <swi_kepler+0x3c>
movsd  -0x20(%rbp),%xmm0
movsd  0xe97(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e4 <swi_kepler+0xb4>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xe4a(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    116c <swi_kepler+0x3c>
jmp    1311 <swi_kepler+0x1e1>
jmp    11ee <swi_kepler+0xbe>
movsd  -0x20(%rbp),%xmm0
movsd  0xe15(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    130c <swi_kepler+0x1dc>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd78(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movaps 0xd77(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xd5e(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    12d9 <swi_kepler+0x1a9>
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1307 <swi_kepler+0x1d7>
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
call   1050 <swi_mod2PI@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xd22(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11ee <swi_kepler+0xbe>
jmp    1311 <swi_kepler+0x1e1>
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swi_kepler>:
sub    $0x58,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  0xebe(%rip),%xmm1
ucomisd %xmm2,%xmm1
movapd %xmm2,0x20(%rsp)
jbe    1194 <swi_kepler+0x64>
xchg   %ax,%ax
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xeb3(%rip),%xmm0
ucomisd 0xe93(%rip),%xmm0
movapd %xmm1,%xmm0
ja     1150 <swi_kepler+0x20>
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret
movapd 0xe84(%rip),%xmm1
xorpd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
movapd %xmm0,%xmm1
jmp    11dd <swi_kepler+0xad>
nopl   0x0(%rax)
movapd %xmm1,%xmm0
call   1050 <swi_mod2PI@plt>
movapd %xmm0,%xmm1
movapd %xmm0,%xmm2
subsd  0x8(%rsp),%xmm2
andpd  0xe61(%rip),%xmm2
ucomisd 0xe41(%rip),%xmm2
movapd %xmm1,%xmm0
jbe    118b <swi_kepler+0x5b>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1030 <sin@plt>
mulsd  0x20(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
movapd %xmm0,0x40(%rsp)
movapd %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm0
addsd  0xde1(%rip),%xmm0
movapd 0x40(%rsp),%xmm3
divsd  %xmm0,%xmm3
addsd  %xmm3,%xmm1
movapd 0xdf3(%rip),%xmm0
andpd  %xmm0,%xmm3
movsd  0xdc7(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    11b0 <swi_kepler+0x80>
movapd %xmm3,%xmm2
jmp    11cf <swi_kepler+0x9f>

LLVM IR (-O0):
define double @swi_kepler(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store double 1.000000e+00, double* %7
%10 = load double, double* %6
%11 = fcmp olt double %10, 4.000000e-01
br i1 %11, label %12, label %28
12: ; preds = %3
br label %13
13: ; preds = %16, %12
%14 = load double, double* %7
%15 = fcmp ogt double %14, 0x3D719799812DEA11
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = load double, double* %4
store double %17, double* %8
%18 = load double, double* %5
%19 = load double, double* %6
%20 = load double, double* %8
%21 = call double @sin(double %20)
%22 = call double @llvm.fmuladd.f64(double %19, double %21, double %18)
store double %22, double* %4
%23 = load double, double* %4
%24 = load double, double* %8
%25 = fsub double %23, %24
%26 = call double @llvm.fabs.f64(double %25)
store double %26, double* %7
br label %13
27: ; preds = %13
br label %66
28: ; preds = %3
br label %29
29: ; preds = %64, %28
%30 = load double, double* %7
%31 = fcmp ogt double %30, 0x3D719799812DEA11
br i1 %31, label %32, label %65
32: ; preds = %29
%33 = load double, double* %4
store double %33, double* %8
%34 = load double, double* %5
%35 = load double, double* %6
%36 = load double, double* %8
%37 = call double @sin(double %36)
%38 = call double @llvm.fmuladd.f64(double %35, double %37, double %34)
%39 = load double, double* %8
%40 = fsub double %38, %39
%41 = load double, double* %6
%42 = load double, double* %8
%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
store double %46, double* %9
%47 = load double, double* %9
%48 = call double @llvm.fabs.f64(double %47)
store double %48, double* %7
%49 = load double, double* %7
%50 = fcmp olt double %49, 1.000000e-02
br i1 %50, label %51, label %55
51: ; preds = %32
%52 = load double, double* %8
%53 = load double, double* %9
%54 = fadd double %52, %53
store double %54, double* %4
br label %64
55: ; preds = %32
%56 = load double, double* %8
%57 = load double, double* %9
%58 = fadd double %56, %57
%59 = call double @swi_mod2PI(double %58)
store double %59, double* %4
%60 = load double, double* %4
%61 = load double, double* %8
%62 = fsub double %60, %61
%63 = call double @llvm.fabs.f64(double %62)
store double %63, double* %7
br label %64
64: ; preds = %55, %51
br label %29
65: ; preds = %29
br label %66
66: ; preds = %65, %27
%67 = load double, double* %4
ret double %67
}

LLVM IR (-O2):
define double @swi_kepler(double %0, double %1, double %2) {
%4 = fcmp olt double %2, 4.000000e-01
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = fneg double %2
br label %14
7: ; preds = %3, %7
%8 = phi double [ %10, %7 ], [ %0, %3 ]
%9 = tail call double @sin(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %2, double %9, double %1)
%11 = fsub double %10, %8
%12 = tail call double @llvm.fabs.f64(double %11)
%13 = fcmp ogt double %12, 0x3D719799812DEA11
br i1 %13, label %7, label %33
14: ; preds = %5, %29
%15 = phi double [ %0, %5 ], [ %31, %29 ]
%16 = tail call double @sin(double %15)
%17 = tail call double @llvm.fmuladd.f64(double %2, double %16, double %1)
%18 = fsub double %17, %15
%19 = tail call double @cos(double %15)
%20 = tail call double @llvm.fmuladd.f64(double %6, double %19, double 1.000000e+00)
%21 = fdiv double %18, %20
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp olt double %22, 1.000000e-02
%24 = fadd double %15, %21
br i1 %23, label %29, label %25
25: ; preds = %14
%26 = tail call double @swi_mod2PI(double %24)
%27 = fsub double %26, %15
%28 = tail call double @llvm.fabs.f64(double %27)
br label %29
29: ; preds = %14, %25
%30 = phi double [ %28, %25 ], [ %22, %14 ]
%31 = phi double [ %26, %25 ], [ %24, %14 ]
%32 = fcmp ogt double %30, 0x3D719799812DEA11
br i1 %32, label %14, label %33
33: ; preds = %29, %7
%34 = phi double [ %10, %7 ], [ %31, %29 ]
ret double %34
}