#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 fast_fabs(double);
double sqrtf(double);
void CalcStopDist(double V0, double A0, double Amax, double Jmax,
                  double *TotalDist) {
  double Alim, Apeak, V0p, V1p;
  double dVa = fast_fabs(A0) * A0 / (2 * Jmax);
  double dV = -V0;
  double J, t0, t1, t2;
  if (dVa > dV) {
    J = -Jmax;
    Alim = -Amax;
  } else {
    J = Jmax;
    Alim = Amax;
  }
  t0 = (-A0 / J + sqrtf(0.5 * A0 * A0 / (J * J) + (-V0) / J));
  Apeak = A0 + J * t0;
  if (fast_fabs(Apeak) < Amax) {
    *TotalDist = ((J * t0 * (1.0 / 6.0) + A0 * (1.0 / 2.0)) * t0 + V0) * t0;
    V0p = (J * t0 * (1.0 / 2.0) + A0) * t0 + V0;
    t1 = fast_fabs(Apeak / J);
    *TotalDist +=
        ((-J * t1 * (1.0 / 6.0) + Apeak * (1.0 / 2.0)) * t1 + V0p) * t1;
    return;
  }
  t0 = (Alim - A0) / J;
  t2 = fast_fabs((A0 + t0 * J) / J);
  t1 = (dV - J * t0 * t0 - 2.0 * A0 * t0 - A0 * A0 / (2 * J)) / Alim;
  *TotalDist = ((J * t0 * (1.0 / 6.0) + A0 * (1.0 / 2.0)) * t0 + V0) * t0;
  V0p = (J * t0 * (1.0 / 2.0) + A0) * t0 + V0;
  *TotalDist += (Alim * (1.0 / 2.0) * t1 + V0p) * t1;
  V1p = Alim * t1 + V0p;
  *TotalDist += ((-J * t2 * (1.0 / 6.0) + Alim * (1.0 / 2.0)) * t2 + V1p) * t2;
}


x86 assembly (clang, -O0):
<CalcStopDist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fast_fabs@plt>
mulsd  -0x10(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    11e0 <CalcStopDist+0xc0>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11f4 <CalcStopDist+0xd4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xde6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  -0x60(%rbp),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrtf@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <fast_fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13ab <CalcStopDist+0x28b>
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xd49(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xd44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xcfe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
call   1030 <fast_fabs@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  0xca2(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xc9d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    15ab <CalcStopDist+0x48b>
movsd  -0x30(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x60(%rbp),%xmm0
call   1030 <fast_fabs@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xbe0(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xba5(%rip),%xmm2
mulsd  -0x60(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xb84(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xb7f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xb39(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xb12(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xa9d(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  0xa98(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcStopDist>:
push   %rbx
sub    $0xa0,%rsp
mov    %rdi,%rbx
movaps %xmm3,0x10(%rsp)
movaps %xmm2,0x30(%rsp)
movsd  %xmm1,0x8(%rsp)
movaps %xmm0,0x50(%rsp)
movapd %xmm1,%xmm0
call   1030 <fast_fabs@plt>
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movapd 0x10(%rsp),%xmm5
movapd %xmm5,%xmm1
addsd  %xmm5,%xmm1
divsd  %xmm1,%xmm0
movapd 0xe93(%rip),%xmm4
movapd 0x50(%rsp),%xmm2
xorpd  %xmm4,%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm5,%xmm1
xorpd  %xmm4,%xmm1
movapd %xmm2,0x90(%rsp)
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm5,%xmm2
orpd   %xmm1,%xmm2
ja     11a7 <CalcStopDist+0x87>
movapd 0x30(%rsp),%xmm4
jmp    11b1 <CalcStopDist+0x91>
movapd 0x30(%rsp),%xmm0
xorpd  %xmm0,%xmm4
movapd %xmm4,0x80(%rsp)
movsd  0xe4e(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x48(%rsp)
mulsd  %xmm3,%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
unpcklpd 0x50(%rsp),%xmm0
unpcklpd %xmm2,%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movapd %xmm2,0x10(%rsp)
jb     1208 <CalcStopDist+0xe8>
sqrtsd %xmm0,%xmm0
jmp    1219 <CalcStopDist+0xf9>
call   1040 <sqrtf@plt>
movsd  0x8(%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
movapd %xmm3,%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x68(%rsp)
mulsd  %xmm0,%xmm2
movapd %xmm2,0x20(%rsp)
movapd %xmm2,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm0,0x70(%rsp)
call   1030 <fast_fabs@plt>
movapd 0x30(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    12f4 <CalcStopDist+0x1d4>
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm0
mulsd  0xdb6(%rip),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  0x68(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movapd 0x50(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rbx)
mulsd  0xd7c(%rip),%xmm3
addsd  0x8(%rsp),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,0x20(%rsp)
movapd 0x70(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
call   1030 <fast_fabs@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movapd 0x70(%rsp),%xmm5
mulsd  0xd3f(%rip),%xmm5
mulsd  0xd47(%rip),%xmm1
subsd  %xmm1,%xmm5
mulsd  %xmm0,%xmm5
addsd  0x20(%rsp),%xmm5
mulsd  %xmm0,%xmm5
addsd  (%rbx),%xmm5
jmp    1429 <CalcStopDist+0x309>
movapd 0x80(%rsp),%xmm2
movsd  0x8(%rsp),%xmm4
subsd  %xmm4,%xmm2
movapd 0x10(%rsp),%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x30(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
addsd  %xmm4,%xmm0
divsd  %xmm1,%xmm0
call   1030 <fast_fabs@plt>
movsd  0x20(%rsp),%xmm7
movapd %xmm7,%xmm1
movsd  0x30(%rsp),%xmm4
mulsd  %xmm4,%xmm1
movapd 0x90(%rsp),%xmm2
subsd  %xmm1,%xmm2
movsd  0xcbd(%rip),%xmm1
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm4,%xmm10
addsd  %xmm2,%xmm1
movapd %xmm3,%xmm2
movapd %xmm3,%xmm9
mulsd  %xmm3,%xmm2
movapd 0x10(%rsp),%xmm8
movapd %xmm8,%xmm3
addsd  %xmm8,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
movapd 0x80(%rsp),%xmm6
divsd  %xmm6,%xmm1
movsd  0xc73(%rip),%xmm2
movapd %xmm7,%xmm3
mulsd  %xmm2,%xmm3
addsd  0x48(%rsp),%xmm3
mulsd  %xmm4,%xmm3
movapd 0x50(%rsp),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm10,%xmm3
movsd  0xc3a(%rip),%xmm5
mulsd  %xmm5,%xmm7
addsd  %xmm9,%xmm7
mulsd  %xmm10,%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm6,%xmm5
movapd %xmm5,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm7,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm6,%xmm1
addsd  %xmm7,%xmm1
movapd %xmm0,%xmm3
mulsd  %xmm8,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm3,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm1,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,(%rbx)
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @CalcStopDist(double %0, double %1, double %2, double %3, double* %4) {
%6 = alloca double
%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
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double* %4, double** %10
%21 = load double, double* %7
%22 = call double @fast_fabs(double %21)
%23 = load double, double* %7
%24 = fmul double %22, %23
%25 = load double, double* %9
%26 = fmul double 2.000000e+00, %25
%27 = fdiv double %24, %26
store double %27, double* %15
%28 = load double, double* %6
%29 = fneg double %28
store double %29, double* %16
%30 = load double, double* %15
%31 = load double, double* %16
%32 = fcmp ogt double %30, %31
br i1 %32, label %33, label %38
33: ; preds = %5
%34 = load double, double* %9
%35 = fneg double %34
store double %35, double* %17
%36 = load double, double* %8
%37 = fneg double %36
store double %37, double* %11
br label %41
38: ; preds = %5
%39 = load double, double* %9
store double %39, double* %17
%40 = load double, double* %8
store double %40, double* %11
br label %41
41: ; preds = %38, %33
%42 = load double, double* %7
%43 = fneg double %42
%44 = load double, double* %17
%45 = fdiv double %43, %44
%46 = load double, double* %7
%47 = fmul double 5.000000e-01, %46
%48 = load double, double* %7
%49 = fmul double %47, %48
%50 = load double, double* %17
%51 = load double, double* %17
%52 = fmul double %50, %51
%53 = fdiv double %49, %52
%54 = load double, double* %6
%55 = fneg double %54
%56 = load double, double* %17
%57 = fdiv double %55, %56
%58 = fadd double %53, %57
%59 = call double @sqrtf(double %58)
%60 = fadd double %45, %59
store double %60, double* %18
%61 = load double, double* %7
%62 = load double, double* %17
%63 = load double, double* %18
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double %61)
store double %64, double* %12
%65 = load double, double* %12
%66 = call double @fast_fabs(double %65)
%67 = load double, double* %8
%68 = fcmp olt double %66, %67
br i1 %68, label %69, label %108
69: ; preds = %41
%70 = load double, double* %17
%71 = load double, double* %18
%72 = fmul double %70, %71
%73 = load double, double* %7
%74 = fmul double %73, 5.000000e-01
%75 = call double @llvm.fmuladd.f64(double %72, double 0x3FC5555555555555, double %74)
%76 = load double, double* %18
%77 = load double, double* %6
%78 = call double @llvm.fmuladd.f64(double %75, double %76, double %77)
%79 = load double, double* %18
%80 = fmul double %78, %79
%81 = load double*, double** %10
store double %80, double* %81
%82 = load double, double* %17
%83 = load double, double* %18
%84 = fmul double %82, %83
%85 = load double, double* %7
%86 = call double @llvm.fmuladd.f64(double %84, double 5.000000e-01, double %85)
%87 = load double, double* %18
%88 = load double, double* %6
%89 = call double @llvm.fmuladd.f64(double %86, double %87, double %88)
store double %89, double* %13
%90 = load double, double* %12
%91 = load double, double* %17
%92 = fdiv double %90, %91
%93 = call double @fast_fabs(double %92)
store double %93, double* %19
%94 = load double, double* %17
%95 = fneg double %94
%96 = load double, double* %19
%97 = fmul double %95, %96
%98 = load double, double* %12
%99 = fmul double %98, 5.000000e-01
%100 = call double @llvm.fmuladd.f64(double %97, double 0x3FC5555555555555, double %99)
%101 = load double, double* %19
%102 = load double, double* %13
%103 = call double @llvm.fmuladd.f64(double %100, double %101, double %102)
%104 = load double, double* %19
%105 = load double*, double** %10
%106 = load double, double* %105
%107 = call double @llvm.fmuladd.f64(double %103, double %104, double %106)
store double %107, double* %105
br label %189
108: ; preds = %41
%109 = load double, double* %11
%110 = load double, double* %7
%111 = fsub double %109, %110
%112 = load double, double* %17
%113 = fdiv double %111, %112
store double %113, double* %18
%114 = load double, double* %7
%115 = load double, double* %18
%116 = load double, double* %17
%117 = call double @llvm.fmuladd.f64(double %115, double %116, double %114)
%118 = load double, double* %17
%119 = fdiv double %117, %118
%120 = call double @fast_fabs(double %119)
store double %120, double* %20
%121 = load double, double* %16
%122 = load double, double* %17
%123 = load double, double* %18
%124 = fmul double %122, %123
%125 = load double, double* %18
%126 = fneg double %124
%127 = call double @llvm.fmuladd.f64(double %126, double %125, double %121)
%128 = load double, double* %7
%129 = fmul double 2.000000e+00, %128
%130 = load double, double* %18
%131 = fneg double %129
%132 = call double @llvm.fmuladd.f64(double %131, double %130, double %127)
%133 = load double, double* %7
%134 = load double, double* %7
%135 = fmul double %133, %134
%136 = load double, double* %17
%137 = fmul double 2.000000e+00, %136
%138 = fdiv double %135, %137
%139 = fsub double %132, %138
%140 = load double, double* %11
%141 = fdiv double %139, %140
store double %141, double* %19
%142 = load double, double* %17
%143 = load double, double* %18
%144 = fmul double %142, %143
%145 = load double, double* %7
%146 = fmul double %145, 5.000000e-01
%147 = call double @llvm.fmuladd.f64(double %144, double 0x3FC5555555555555, double %146)
%148 = load double, double* %18
%149 = load double, double* %6
%150 = call double @llvm.fmuladd.f64(double %147, double %148, double %149)
%151 = load double, double* %18
%152 = fmul double %150, %151
%153 = load double*, double** %10
store double %152, double* %153
%154 = load double, double* %17
%155 = load double, double* %18
%156 = fmul double %154, %155
%157 = load double, double* %7
%158 = call double @llvm.fmuladd.f64(double %156, double 5.000000e-01, double %157)
%159 = load double, double* %18
%160 = load double, double* %6
%161 = call double @llvm.fmuladd.f64(double %158, double %159, double %160)
store double %161, double* %13
%162 = load double, double* %11
%163 = fmul double %162, 5.000000e-01
%164 = load double, double* %19
%165 = load double, double* %13
%166 = call double @llvm.fmuladd.f64(double %163, double %164, double %165)
%167 = load double, double* %19
%168 = load double*, double** %10
%169 = load double, double* %168
%170 = call double @llvm.fmuladd.f64(double %166, double %167, double %169)
store double %170, double* %168
%171 = load double, double* %11
%172 = load double, double* %19
%173 = load double, double* %13
%174 = call double @llvm.fmuladd.f64(double %171, double %172, double %173)
store double %174, double* %14
%175 = load double, double* %17
%176 = fneg double %175
%177 = load double, double* %20
%178 = fmul double %176, %177
%179 = load double, double* %11
%180 = fmul double %179, 5.000000e-01
%181 = call double @llvm.fmuladd.f64(double %178, double 0x3FC5555555555555, double %180)
%182 = load double, double* %20
%183 = load double, double* %14
%184 = call double @llvm.fmuladd.f64(double %181, double %182, double %183)
%185 = load double, double* %20
%186 = load double*, double** %10
%187 = load double, double* %186
%188 = call double @llvm.fmuladd.f64(double %184, double %185, double %187)
store double %188, double* %186
br label %189
189: ; preds = %108, %69
ret void
}

LLVM IR (-O2):
define void @CalcStopDist(double %0, double %1, double %2, double %3, double* nocapture %4) {
%6 = tail call double @fast_fabs(double %1)
%7 = fmul double %6, %1
%8 = fmul double %3, 2.000000e+00
%9 = fdiv double %7, %8
%10 = fneg double %0
%11 = fcmp ogt double %9, %10
%12 = fneg double %3
%13 = fneg double %2
%14 = select i1 %11, double %12, double %3
%15 = select i1 %11, double %13, double %2
%16 = fmul double %1, 5.000000e-01
%17 = fmul double %16, %1
%18 = fmul double %14, %14
%19 = insertelement <2 x double> poison, double %0, i64 1
%20 = insertelement <2 x double> %19, double %17, i64 0
%21 = insertelement <2 x double> poison, double %18, i64 0
%22 = insertelement <2 x double> %21, double %14, i64 1
%23 = fdiv <2 x double> %20, %22
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%25 = fsub <2 x double> %23, %24
%26 = extractelement <2 x double> %25, i64 0
%27 = tail call double @sqrtf(double %26)
%28 = fdiv double %1, %14
%29 = fsub double %27, %28
%30 = tail call double @llvm.fmuladd.f64(double %14, double %29, double %1)
%31 = tail call double @fast_fabs(double %30)
%32 = fcmp olt double %31, %2
br i1 %32, label %33, label %49
33: ; preds = %5
%34 = fmul double %14, %29
%35 = tail call double @llvm.fmuladd.f64(double %34, double 0x3FC5555555555555, double %16)
%36 = tail call double @llvm.fmuladd.f64(double %35, double %29, double %0)
%37 = fmul double %29, %36
store double %37, double* %4
%38 = tail call double @llvm.fmuladd.f64(double %34, double 5.000000e-01, double %1)
%39 = tail call double @llvm.fmuladd.f64(double %38, double %29, double %0)
%40 = fdiv double %30, %14
%41 = tail call double @fast_fabs(double %40)
%42 = fneg double %14
%43 = fmul double %41, %42
%44 = fmul double %30, 5.000000e-01
%45 = tail call double @llvm.fmuladd.f64(double %43, double 0x3FC5555555555555, double %44)
%46 = tail call double @llvm.fmuladd.f64(double %45, double %41, double %39)
%47 = load double, double* %4
%48 = tail call double @llvm.fmuladd.f64(double %46, double %41, double %47)
br label %79
49: ; preds = %5
%50 = fsub double %15, %1
%51 = fdiv double %50, %14
%52 = tail call double @llvm.fmuladd.f64(double %51, double %14, double %1)
%53 = fdiv double %52, %14
%54 = tail call double @fast_fabs(double %53)
%55 = fmul double %14, %51
%56 = fneg double %55
%57 = tail call double @llvm.fmuladd.f64(double %56, double %51, double %10)
%58 = fmul double %1, -2.000000e+00
%59 = tail call double @llvm.fmuladd.f64(double %58, double %51, double %57)
%60 = fmul double %1, %1
%61 = fmul double %14, 2.000000e+00
%62 = fdiv double %60, %61
%63 = fsub double %59, %62
%64 = fdiv double %63, %15
%65 = tail call double @llvm.fmuladd.f64(double %55, double 0x3FC5555555555555, double %16)
%66 = tail call double @llvm.fmuladd.f64(double %65, double %51, double %0)
%67 = fmul double %51, %66
%68 = tail call double @llvm.fmuladd.f64(double %55, double 5.000000e-01, double %1)
%69 = tail call double @llvm.fmuladd.f64(double %68, double %51, double %0)
%70 = fmul double %15, 5.000000e-01
%71 = tail call double @llvm.fmuladd.f64(double %70, double %64, double %69)
%72 = tail call double @llvm.fmuladd.f64(double %71, double %64, double %67)
%73 = tail call double @llvm.fmuladd.f64(double %15, double %64, double %69)
%74 = fneg double %14
%75 = fmul double %54, %74
%76 = tail call double @llvm.fmuladd.f64(double %75, double 0x3FC5555555555555, double %70)
%77 = tail call double @llvm.fmuladd.f64(double %76, double %54, double %73)
%78 = tail call double @llvm.fmuladd.f64(double %77, double %54, double %72)
br label %79
79: ; preds = %49, %33
%80 = phi double [ %78, %49 ], [ %48, %33 ]
store double %80, double* %4
ret void
}