#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 */
int cdrift_kepu_p3solve(double const, double const, double const, double const,
                        double const, double *);
int /*<<< orphan*/ cmco_sine(double *, double *, double *);
double fabs(double);
double const sqrt(double const);
double cdrift_kepu_guess(const double dt, const double r0, const double mu,
                         const double alpha, const double u, double s) {
  if (alpha > 0.0) {
    if (dt / r0 <= 0.4) {
      s = dt / r0 - (dt * dt * u) / (2.0 * r0 * r0 * r0);
      return s;
    } else {
      const double a = mu / alpha;
      const double en = sqrt(mu / (a * a * a));
      const double ec = 1.0 - r0 / a;
      const double es = u / (en * a * a);
      const double e = sqrt(ec * ec + es * es);
      double y = en * dt - es;
      double sy = 0.0, cy = 0.0;
      cmco_sine(&y, &sy, &cy);
      const double sigma = (es * cy + ec * sy) >= 0 ? fabs(1.0) : -fabs(1.0);
      const double x = y + sigma * 0.85 * e;
      s = x / sqrt(alpha);
    }
  } else {
    const int iflg = cdrift_kepu_p3solve(dt, r0, mu, alpha, u, &s);
    if (iflg) {
      s = dt / r0;
    }
  }
  return s;
}


x86 assembly (clang, -O0):
<cdrift_kepu_guess>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1382 <cdrift_kepu_guess+0x252>
movsd  -0x10(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
movsd  0xe83(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11d3 <cdrift_kepu_guess+0xa3>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  0xe70(%rip),%xmm2
mulsd  -0x18(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13d5 <cdrift_kepu_guess+0x2a5>
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm1
divsd  -0x40(%rbp),%xmm1
movsd  0xdf2(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x68(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x78(%rbp),%rdx
call   1030 <cmco_sine@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12f4 <cdrift_kepu_guess+0x1c4>
movsd  0xd21(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    131b <cdrift_kepu_guess+0x1eb>
movsd  0xd0c(%rip),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  0xcdb(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    13cb <cdrift_kepu_guess+0x29b>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
lea    -0x38(%rbp),%rdi
call   1050 <cdrift_kepu_p3solve@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
je     13c6 <cdrift_kepu_guess+0x296>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    13cb <cdrift_kepu_guess+0x29b>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdrift_kepu_guess>:
sub    $0x48,%rsp
movsd  %xmm5,0x8(%rsp)
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm3
jbe    1194 <cdrift_kepu_guess+0x64>
movapd %xmm0,%xmm5
divsd  %xmm1,%xmm5
movsd  0xeac(%rip),%xmm6
ucomisd %xmm5,%xmm6
jae    11bd <cdrift_kepu_guess+0x8d>
movapd %xmm2,%xmm6
divsd  %xmm3,%xmm6
movapd %xmm6,%xmm5
mulsd  %xmm6,%xmm5
mulsd  %xmm6,%xmm5
divsd  %xmm5,%xmm2
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm2
movsd  %xmm3,0x40(%rsp)
movsd  %xmm0,0x18(%rsp)
jb     11ed <cdrift_kepu_guess+0xbd>
xorps  %xmm3,%xmm3
sqrtsd %xmm2,%xmm3
jmp    1220 <cdrift_kepu_guess+0xf0>
lea    0x8(%rsp),%rdi
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,(%rsp)
call   1050 <cdrift_kepu_p3solve@plt>
test   %eax,%eax
je     11e2 <cdrift_kepu_guess+0xb2>
movsd  0x18(%rsp),%xmm5
divsd  (%rsp),%xmm5
jmp    1329 <cdrift_kepu_guess+0x1f9>
mulsd  %xmm0,%xmm0
mulsd  %xmm4,%xmm0
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm5
jmp    1329 <cdrift_kepu_guess+0x1f9>
movsd  0x8(%rsp),%xmm5
jmp    132f <cdrift_kepu_guess+0x1ff>
movapd %xmm2,%xmm0
movsd  %xmm4,0x10(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm6,0x20(%rsp)
call   1040 <sqrt@plt>
movsd  0x20(%rsp),%xmm6
xorpd  %xmm5,%xmm5
movsd  (%rsp),%xmm1
movsd  0x10(%rsp),%xmm4
movapd %xmm0,%xmm3
divsd  %xmm6,%xmm1
movsd  0xddc(%rip),%xmm2
subsd  %xmm1,%xmm2
movapd %xmm6,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm6,%xmm0
divsd  %xmm0,%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
movsd  %xmm2,0x20(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm5,%xmm0
movsd  %xmm4,0x10(%rsp)
jb     126c <cdrift_kepu_guess+0x13c>
sqrtsd %xmm0,%xmm0
jmp    1281 <cdrift_kepu_guess+0x151>
movsd  %xmm3,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movsd  0x18(%rsp),%xmm1
movsd  %xmm0,(%rsp)
mulsd  %xmm1,%xmm3
subsd  %xmm4,%xmm3
movsd  %xmm3,0x38(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0x0,0x28(%rsp)
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
call   1030 <cmco_sine@plt>
movsd  (%rsp),%xmm5
movsd  0x20(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
lea    0xd17(%rip),%rcx
mulsd  (%rcx,%rax,8),%xmm5
addsd  0x38(%rsp),%xmm5
movsd  0x40(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     1316 <cdrift_kepu_guess+0x1e6>
sqrtsd %xmm0,%xmm0
jmp    1325 <cdrift_kepu_guess+0x1f5>
movsd  %xmm5,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm5
divsd  %xmm0,%xmm5
movsd  %xmm5,0x8(%rsp)
movapd %xmm5,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @cdrift_kepu_guess(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
%25 = load double, double* %11
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %27, label %110
27: ; preds = %6
%28 = load double, double* %8
%29 = load double, double* %9
%30 = fdiv double %28, %29
%31 = fcmp ole double %30, 4.000000e-01
br i1 %31, label %32, label %50
32: ; preds = %27
%33 = load double, double* %8
%34 = load double, double* %9
%35 = fdiv double %33, %34
%36 = load double, double* %8
%37 = load double, double* %8
%38 = fmul double %36, %37
%39 = load double, double* %12
%40 = fmul double %38, %39
%41 = load double, double* %9
%42 = fmul double 2.000000e+00, %41
%43 = load double, double* %9
%44 = fmul double %42, %43
%45 = load double, double* %9
%46 = fmul double %44, %45
%47 = fdiv double %40, %46
%48 = fsub double %35, %47
store double %48, double* %13
%49 = load double, double* %13
store double %49, double* %7
br label %126
50: ; preds = %27
%51 = load double, double* %10
%52 = load double, double* %11
%53 = fdiv double %51, %52
store double %53, double* %14
%54 = load double, double* %10
%55 = load double, double* %14
%56 = load double, double* %14
%57 = fmul double %55, %56
%58 = load double, double* %14
%59 = fmul double %57, %58
%60 = fdiv double %54, %59
%61 = call double @sqrt(double %60)
store double %61, double* %15
%62 = load double, double* %9
%63 = load double, double* %14
%64 = fdiv double %62, %63
%65 = fsub double 1.000000e+00, %64
store double %65, double* %16
%66 = load double, double* %12
%67 = load double, double* %15
%68 = load double, double* %14
%69 = fmul double %67, %68
%70 = load double, double* %14
%71 = fmul double %69, %70
%72 = fdiv double %66, %71
store double %72, double* %17
%73 = load double, double* %16
%74 = load double, double* %16
%75 = load double, double* %17
%76 = load double, double* %17
%77 = fmul double %75, %76
%78 = call double @llvm.fmuladd.f64(double %73, double %74, double %77)
%79 = call double @sqrt(double %78)
store double %79, double* %18
%80 = load double, double* %15
%81 = load double, double* %8
%82 = load double, double* %17
%83 = fneg double %82
%84 = call double @llvm.fmuladd.f64(double %80, double %81, double %83)
store double %84, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
%85 = call i32 @cmco_sine(double* %19, double* %20, double* %21)
%86 = load double, double* %17
%87 = load double, double* %21
%88 = load double, double* %16
%89 = load double, double* %20
%90 = fmul double %88, %89
%91 = call double @llvm.fmuladd.f64(double %86, double %87, double %90)
%92 = fcmp oge double %91, 0.000000e+00
br i1 %92, label %93, label %95
93: ; preds = %50
%94 = call double @llvm.fabs.f64(double 1.000000e+00)
br label %98
95: ; preds = %50
%96 = call double @llvm.fabs.f64(double 1.000000e+00)
%97 = fneg double %96
br label %98
98: ; preds = %95, %93
%99 = phi double [ %94, %93 ], [ %97, %95 ]
store double %99, double* %22
%100 = load double, double* %19
%101 = load double, double* %22
%102 = fmul double %101, 8.500000e-01
%103 = load double, double* %18
%104 = call double @llvm.fmuladd.f64(double %102, double %103, double %100)
store double %104, double* %23
%105 = load double, double* %23
%106 = load double, double* %11
%107 = call double @sqrt(double %106)
%108 = fdiv double %105, %107
store double %108, double* %13
br label %109
109: ; preds = %98
br label %124
110: ; preds = %6
%111 = load double, double* %8
%112 = load double, double* %9
%113 = load double, double* %10
%114 = load double, double* %11
%115 = load double, double* %12
%116 = call i32 @cdrift_kepu_p3solve(double %111, double %112, double %113, double %114, double %115, double* %13)
store i32 %116, i32* %24
%117 = load i32, i32* %24
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %110
%120 = load double, double* %8
%121 = load double, double* %9
%122 = fdiv double %120, %121
store double %122, double* %13
br label %123
123: ; preds = %119, %110
br label %124
124: ; preds = %123, %109
%125 = load double, double* %13
store double %125, double* %7
br label %126
126: ; preds = %124, %32
%127 = load double, double* %7
ret double %127
}

LLVM IR (-O2):
define double @cdrift_kepu_guess(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %5, double* %7
%11 = fcmp ogt double %3, 0.000000e+00
br i1 %11, label %12, label %53
12: ; preds = %6
%13 = fdiv double %0, %1
%14 = fcmp ugt double %13, 4.000000e-01
br i1 %14, label %23, label %15
15: ; preds = %12
%16 = fmul double %0, %0
%17 = fmul double %16, %4
%18 = fmul double %1, 2.000000e+00
%19 = fmul double %18, %1
%20 = fmul double %19, %1
%21 = fdiv double %17, %20
%22 = fsub double %13, %21
store double %22, double* %7
br label %60
23: ; preds = %12
%24 = fdiv double %2, %3
%25 = fmul double %24, %24
%26 = fmul double %24, %25
%27 = fdiv double %2, %26
%28 = tail call double @sqrt(double %27)
%29 = fdiv double %1, %24
%30 = fsub double 1.000000e+00, %29
%31 = fmul double %24, %28
%32 = fmul double %24, %31
%33 = fdiv double %4, %32
%34 = fmul double %33, %33
%35 = tail call double @llvm.fmuladd.f64(double %30, double %30, double %34)
%36 = tail call double @sqrt(double %35)
%37 = bitcast double* %8 to i8*
%38 = fneg double %33
%39 = tail call double @llvm.fmuladd.f64(double %28, double %0, double %38)
store double %39, double* %8
%40 = bitcast double* %9 to i8*
store double 0.000000e+00, double* %9
%41 = bitcast double* %10 to i8*
store double 0.000000e+00, double* %10
%42 = call i32 @cmco_sine(double* %8, double* %9, double* %10)
%43 = load double, double* %10
%44 = load double, double* %9
%45 = fmul double %30, %44
%46 = call double @llvm.fmuladd.f64(double %33, double %43, double %45)
%47 = fcmp ult double %46, 0.000000e+00
%48 = select i1 %47, double -8.500000e-01, double 8.500000e-01
%49 = load double, double* %8
%50 = call double @llvm.fmuladd.f64(double %48, double %36, double %49)
%51 = call double @sqrt(double %3)
%52 = fdiv double %50, %51
store double %52, double* %7
br label %60
53: ; preds = %6
%54 = call i32 @cdrift_kepu_p3solve(double %0, double %1, double %2, double %3, double %4, double* %7)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = load double, double* %7
br label %60
58: ; preds = %53
%59 = fdiv double %0, %1
store double %59, double* %7
br label %60
60: ; preds = %23, %58, %56, %15
%61 = phi double [ %22, %15 ], [ %57, %56 ], [ %59, %58 ], [ %52, %23 ]
ret double %61
}