#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 fabs(double);
double ln_deg_to_rad(double);
double ln_rad_to_deg(double);
double sgn(double);
double sin(double);
double ln_solve_kepler(double e, double M) {
  double Eo = 1.5707963267948966192313216916398;
  double F, M1;
  double D = 0.78539816339744830961566084581988;
  int i;
  M = ln_deg_to_rad(M);
  F = sgn(M);
  M = fabs(M) / (2.0 * 3.1415926535897932384626433832795);
  M = (M - (int)M) * 2.0 * 3.1415926535897932384626433832795 * F;
  if (M < 0)
    M = M + 2.0 * 3.1415926535897932384626433832795;
  F = 1.0;
  if (M > 3.1415926535897932384626433832795)
    F = -1.0;
  if (M > 3.1415926535897932384626433832795)
    M = 2.0 * 3.1415926535897932384626433832795 - M;
  for (i = 0; i < 53; i++) {
    M1 = Eo - e * sin(Eo);
    Eo = Eo + D * sgn(M - M1);
    D /= 2.0;
  }
  Eo *= F;
  Eo = ln_rad_to_deg(Eo);
  return Eo;
}


x86 assembly (clang, -O0):
<ln_solve_kepler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <ln_deg_to_rad@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sgn@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xeaa(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2f(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ff <ln_solve_kepler+0xbf>
movsd  0xe1b(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe21(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xde7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1230 <ln_solve_kepler+0xf0>
movsd  0xe05(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdc3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1259 <ln_solve_kepler+0x119>
movsd  0xdc1(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x35,-0x34(%rbp)
jge    131a <ln_solve_kepler+0x1da>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <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
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1050 <sgn@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xd05(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1260 <ln_solve_kepler+0x120>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <ln_rad_to_deg@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_solve_kepler>:
push   %rbx
sub    $0x50,%rsp
movaps %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
call   1060 <ln_deg_to_rad@plt>
movapd %xmm0,(%rsp)
call   1050 <sgn@plt>
movapd (%rsp),%xmm5
andpd  0xe96(%rip),%xmm5
movsd  0xeae(%rip),%xmm1
divsd  %xmm1,%xmm5
cvttpd2dq %xmm5,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm5
addsd  %xmm5,%xmm5
movsd  0xe9a(%rip),%xmm3
mulsd  %xmm3,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm5,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm2,%xmm2
movapd %xmm5,%xmm4
cmpltsd %xmm2,%xmm4
andpd  %xmm4,%xmm0
andnpd %xmm5,%xmm4
orpd   %xmm0,%xmm4
subsd  %xmm4,%xmm1
cmpltsd %xmm4,%xmm3
andpd  %xmm3,%xmm1
movapd %xmm4,0x30(%rsp)
andnpd %xmm4,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
xorps  0xe2c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0xe3f(%rip),%xmm0
movsd  0xe3f(%rip),%xmm1
mov    $0x35,%ebx
xchg   %ax,%ax
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
addsd  (%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <sgn@plt>
movsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
mulsd  0xdfb(%rip),%xmm1
add    $0xffffffff,%ebx
jne    1200 <ln_solve_kepler+0xc0>
movapd 0xdbe(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0xdca(%rip),%xmm2
cmpltsd 0x30(%rsp),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
jmp    1040 <ln_rad_to_deg@plt>

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

LLVM IR (-O2):
define double @ln_solve_kepler(double %0, double %1) {
%3 = tail call double @ln_deg_to_rad(double %1)
%4 = tail call double @sgn(double %3)
%5 = tail call double @llvm.fabs.f64(double %3)
%6 = fdiv double %5, 0x401921FB54442D18
%7 = fptosi double %6 to i32
%8 = sitofp i32 %7 to double
%9 = fsub double %6, %8
%10 = fmul double %9, 2.000000e+00
%11 = fmul double %10, 0x400921FB54442D18
%12 = fmul double %4, %11
%13 = fcmp olt double %12, 0.000000e+00
%14 = fadd double %12, 0x401921FB54442D18
%15 = select i1 %13, double %14, double %12
%16 = fcmp ogt double %15, 0x400921FB54442D18
%17 = fsub double 0x401921FB54442D18, %15
%18 = select i1 %16, double %17, double %15
%19 = fneg double %0
br label %20
20: ; preds = %2, %20
%21 = phi i32 [ 0, %2 ], [ %30, %20 ]
%22 = phi double [ 0x3FE921FB54442D18, %2 ], [ %29, %20 ]
%23 = phi double [ 0x3FF921FB54442D18, %2 ], [ %28, %20 ]
%24 = tail call double @sin(double %23)
%25 = tail call double @llvm.fmuladd.f64(double %19, double %24, double %23)
%26 = fsub double %18, %25
%27 = tail call double @sgn(double %26)
%28 = tail call double @llvm.fmuladd.f64(double %22, double %27, double %23)
%29 = fmul double %22, 5.000000e-01
%30 = add nuw nsw i32 %21, 1
%31 = icmp eq i32 %30, 53
br i1 %31, label %32, label %20
32: ; preds = %20
%33 = fneg double %28
%34 = select i1 %16, double %33, double %28
%35 = tail call double @ln_rad_to_deg(double %34)
ret double %35
}