void fit_parabola_3p(int *pcode, double *pa, double *px0, double *pb, double x1,
                     double y1, double x2, double y2, double x3, double y3) {
  double x12, x23, dy12, dy23, ddy, diff;
  if (!(x1 < x3)) {
    {
      double _tmp;
      _tmp = (x1);
      (x1) = (x3);
      (x3) = _tmp;
    };
    {
      double _tmp;
      _tmp = (y1);
      (y1) = (y3);
      (y3) = _tmp;
    };
  }
  if (x2 < x1) {
    {
      double _tmp;
      _tmp = (x1);
      (x1) = (x2);
      (x2) = _tmp;
    };
    {
      double _tmp;
      _tmp = (y1);
      (y1) = (y2);
      (y2) = _tmp;
    };
  } else if (x3 < x2) {
    {
      double _tmp;
      _tmp = (x2);
      (x2) = (x3);
      (x3) = _tmp;
    };
    {
      double _tmp;
      _tmp = (y2);
      (y2) = (y3);
      (y3) = _tmp;
    };
  }
  if ((x1 == x2) || (x2 == x3) || (x1 == x3)) {
    *pcode = (-1);
    return;
  }
  x12 = 0.5 * (x1 + x2);
  x23 = 0.5 * (x2 + x3);
  dy12 = (y2 - y1) / (x2 - x1);
  dy23 = (y3 - y2) / (x3 - x2);
  ddy = dy23 - dy12;
  *pa = 0.5 * ddy / (x23 - x12);
  if (ddy == 0.0) {
    *px0 = 0.0;
    *pb = y2;
  } else {
    *px0 = (dy23 * x12 - dy12 * x23) / ddy;
    diff = x2 - (*px0);
    *pb = y2 - (*pa) * diff * diff;
  }
  *pcode = 0;
}


x86 assembly (clang, -O0):
<fit_parabola_3p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
movsd  %xmm3,-0x40(%rbp)
movsd  %xmm4,-0x48(%rbp)
movsd  %xmm5,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1192 <fit_parabola_3p+0x92>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f3 <fit_parabola_3p+0xf3>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
jmp    1254 <fit_parabola_3p+0x154>
movsd  -0x48(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    124f <fit_parabola_3p+0x14f>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
jmp    1254 <fit_parabola_3p+0x154>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jne    126f <fit_parabola_3p+0x16f>
jp     126f <fit_parabola_3p+0x16f>
jmp    12a0 <fit_parabola_3p+0x1a0>
movsd  -0x38(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jne    128a <fit_parabola_3p+0x18a>
jp     128a <fit_parabola_3p+0x18a>
jmp    12a0 <fit_parabola_3p+0x1a0>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jne    12af <fit_parabola_3p+0x1af>
jp     12af <fit_parabola_3p+0x1af>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1420 <fit_parabola_3p+0x320>
movsd  -0x28(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xd3f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  0xd24(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xcca(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1386 <fit_parabola_3p+0x286>
jp     1386 <fit_parabola_3p+0x286>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1416 <fit_parabola_3p+0x316>
movsd  -0x70(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x78(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fit_parabola_3p>:
ucomisd %xmm0,%xmm4
jbe    112e <fit_parabola_3p+0x2e>
movapd %xmm5,%xmm8
movapd %xmm4,%xmm7
movapd %xmm1,%xmm5
movapd %xmm0,%xmm4
ucomisd %xmm2,%xmm4
ja     113d <fit_parabola_3p+0x3d>
ucomisd %xmm7,%xmm2
jbe    1159 <fit_parabola_3p+0x59>
movapd %xmm3,%xmm9
movapd %xmm2,%xmm1
jmp    116b <fit_parabola_3p+0x6b>
movapd %xmm1,%xmm8
movapd %xmm0,%xmm7
ucomisd %xmm2,%xmm4
jbe    111d <fit_parabola_3p+0x1d>
movapd %xmm8,%xmm9
movapd %xmm7,%xmm1
movapd %xmm5,%xmm8
movapd %xmm4,%xmm7
movapd %xmm3,%xmm5
movapd %xmm2,%xmm4
jmp    116b <fit_parabola_3p+0x6b>
movapd %xmm8,%xmm9
movapd %xmm7,%xmm1
movapd %xmm3,%xmm8
movapd %xmm2,%xmm7
ucomisd %xmm1,%xmm4
mov    $0xffffffff,%eax
jne    117c <fit_parabola_3p+0x7c>
jnp    123e <fit_parabola_3p+0x13e>
ucomisd %xmm1,%xmm7
jne    1188 <fit_parabola_3p+0x88>
jnp    123e <fit_parabola_3p+0x13e>
ucomisd %xmm7,%xmm4
jne    1194 <fit_parabola_3p+0x94>
jnp    123e <fit_parabola_3p+0x13e>
movapd %xmm7,%xmm2
addsd  %xmm4,%xmm2
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
addsd  %xmm7,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm8,%xmm6
subsd  %xmm5,%xmm6
movapd %xmm7,%xmm5
subsd  %xmm4,%xmm5
divsd  %xmm5,%xmm6
subsd  %xmm8,%xmm9
subsd  %xmm7,%xmm1
divsd  %xmm1,%xmm9
movapd %xmm9,%xmm1
subsd  %xmm6,%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm3,%xmm4
subsd  %xmm2,%xmm4
divsd  %xmm4,%xmm0
movsd  %xmm0,(%rsi)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1209 <fit_parabola_3p+0x109>
jp     1209 <fit_parabola_3p+0x109>
movq   $0x0,(%rdx)
jmp    1237 <fit_parabola_3p+0x137>
mulsd  %xmm6,%xmm3
mulsd  %xmm2,%xmm9
subsd  %xmm3,%xmm9
divsd  %xmm1,%xmm9
movsd  %xmm9,(%rdx)
subsd  %xmm9,%xmm7
movsd  (%rsi),%xmm0
mulsd  %xmm7,%xmm0
mulsd  %xmm7,%xmm0
subsd  %xmm0,%xmm8
movsd  %xmm8,(%rcx)
xor    %eax,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @fit_parabola_3p(i32* %0, double* %1, double* %2, double* %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca i32*
%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 double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store i32* %0, i32** %11
store double* %1, double** %12
store double* %2, double** %13
store double* %3, double** %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
store double %9, double* %20
%33 = load double, double* %15
%34 = load double, double* %19
%35 = fcmp olt double %33, %34
br i1 %35, label %43, label %36
36: ; preds = %10
%37 = load double, double* %15
store double %37, double* %27
%38 = load double, double* %19
store double %38, double* %15
%39 = load double, double* %27
store double %39, double* %19
%40 = load double, double* %16
store double %40, double* %28
%41 = load double, double* %20
store double %41, double* %16
%42 = load double, double* %28
store double %42, double* %20
br label %43
43: ; preds = %36, %10
%44 = load double, double* %17
%45 = load double, double* %15
%46 = fcmp olt double %44, %45
br i1 %46, label %47, label %54
47: ; preds = %43
%48 = load double, double* %15
store double %48, double* %29
%49 = load double, double* %17
store double %49, double* %15
%50 = load double, double* %29
store double %50, double* %17
%51 = load double, double* %16
store double %51, double* %30
%52 = load double, double* %18
store double %52, double* %16
%53 = load double, double* %30
store double %53, double* %18
br label %66
54: ; preds = %43
%55 = load double, double* %19
%56 = load double, double* %17
%57 = fcmp olt double %55, %56
br i1 %57, label %58, label %65
58: ; preds = %54
%59 = load double, double* %17
store double %59, double* %31
%60 = load double, double* %19
store double %60, double* %17
%61 = load double, double* %31
store double %61, double* %19
%62 = load double, double* %18
store double %62, double* %32
%63 = load double, double* %20
store double %63, double* %18
%64 = load double, double* %32
store double %64, double* %20
br label %65
65: ; preds = %58, %54
br label %66
66: ; preds = %65, %47
%67 = load double, double* %15
%68 = load double, double* %17
%69 = fcmp oeq double %67, %68
br i1 %69, label %78, label %70
70: ; preds = %66
%71 = load double, double* %17
%72 = load double, double* %19
%73 = fcmp oeq double %71, %72
br i1 %73, label %78, label %74
74: ; preds = %70
%75 = load double, double* %15
%76 = load double, double* %19
%77 = fcmp oeq double %75, %76
br i1 %77, label %78, label %80
78: ; preds = %74, %70, %66
%79 = load i32*, i32** %11
store i32 -1, i32* %79
br label %145
80: ; preds = %74
%81 = load double, double* %15
%82 = load double, double* %17
%83 = fadd double %81, %82
%84 = fmul double 5.000000e-01, %83
store double %84, double* %21
%85 = load double, double* %17
%86 = load double, double* %19
%87 = fadd double %85, %86
%88 = fmul double 5.000000e-01, %87
store double %88, double* %22
%89 = load double, double* %18
%90 = load double, double* %16
%91 = fsub double %89, %90
%92 = load double, double* %17
%93 = load double, double* %15
%94 = fsub double %92, %93
%95 = fdiv double %91, %94
store double %95, double* %23
%96 = load double, double* %20
%97 = load double, double* %18
%98 = fsub double %96, %97
%99 = load double, double* %19
%100 = load double, double* %17
%101 = fsub double %99, %100
%102 = fdiv double %98, %101
store double %102, double* %24
%103 = load double, double* %24
%104 = load double, double* %23
%105 = fsub double %103, %104
store double %105, double* %25
%106 = load double, double* %25
%107 = fmul double 5.000000e-01, %106
%108 = load double, double* %22
%109 = load double, double* %21
%110 = fsub double %108, %109
%111 = fdiv double %107, %110
%112 = load double*, double** %12
store double %111, double* %112
%113 = load double, double* %25
%114 = fcmp oeq double %113, 0.000000e+00
br i1 %114, label %115, label %119
115: ; preds = %80
%116 = load double*, double** %13
store double 0.000000e+00, double* %116
%117 = load double, double* %18
%118 = load double*, double** %14
store double %117, double* %118
br label %143
119: ; preds = %80
%120 = load double, double* %24
%121 = load double, double* %21
%122 = load double, double* %23
%123 = load double, double* %22
%124 = fmul double %122, %123
%125 = fneg double %124
%126 = call double @llvm.fmuladd.f64(double %120, double %121, double %125)
%127 = load double, double* %25
%128 = fdiv double %126, %127
%129 = load double*, double** %13
store double %128, double* %129
%130 = load double, double* %17
%131 = load double*, double** %13
%132 = load double, double* %131
%133 = fsub double %130, %132
store double %133, double* %26
%134 = load double, double* %18
%135 = load double*, double** %12
%136 = load double, double* %135
%137 = load double, double* %26
%138 = fmul double %136, %137
%139 = load double, double* %26
%140 = fneg double %138
%141 = call double @llvm.fmuladd.f64(double %140, double %139, double %134)
%142 = load double*, double** %14
store double %141, double* %142
br label %143
143: ; preds = %119, %115
%144 = load i32*, i32** %11
store i32 0, i32* %144
br label %145
145: ; preds = %143, %78
ret void
}

LLVM IR (-O2):
define void @fit_parabola_3p(i32* nocapture writeonly %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = fcmp olt double %4, %8
br i1 %11, label %13, label %12
12: ; preds = %10
br label %13
13: ; preds = %12, %10
%14 = phi double [ %9, %10 ], [ %5, %12 ]
%15 = phi double [ %8, %10 ], [ %4, %12 ]
%16 = phi double [ %5, %10 ], [ %9, %12 ]
%17 = phi double [ %4, %10 ], [ %8, %12 ]
%18 = fcmp ogt double %17, %6
br i1 %18, label %22, label %19
19: ; preds = %13
%20 = fcmp olt double %15, %6
br i1 %20, label %21, label %22
21: ; preds = %19
br label %22
22: ; preds = %13, %19, %21
%23 = phi double [ %7, %21 ], [ %14, %19 ], [ %14, %13 ]
%24 = phi double [ %6, %21 ], [ %15, %19 ], [ %15, %13 ]
%25 = phi double [ %14, %21 ], [ %7, %19 ], [ %16, %13 ]
%26 = phi double [ %15, %21 ], [ %6, %19 ], [ %17, %13 ]
%27 = phi double [ %16, %21 ], [ %16, %19 ], [ %7, %13 ]
%28 = phi double [ %17, %21 ], [ %17, %19 ], [ %6, %13 ]
%29 = fcmp oeq double %28, %26
%30 = fcmp oeq double %26, %24
%31 = or i1 %30, %29
%32 = fcmp oeq double %28, %24
%33 = or i1 %32, %31
br i1 %33, label %63, label %34
34: ; preds = %22
%35 = fadd double %26, %28
%36 = fmul double %35, 5.000000e-01
%37 = fadd double %24, %26
%38 = fmul double %37, 5.000000e-01
%39 = fsub double %25, %27
%40 = fsub double %26, %28
%41 = fdiv double %39, %40
%42 = fsub double %23, %25
%43 = fsub double %24, %26
%44 = fdiv double %42, %43
%45 = fsub double %44, %41
%46 = fmul double %45, 5.000000e-01
%47 = fsub double %38, %36
%48 = fdiv double %46, %47
store double %48, double* %1
%49 = fcmp oeq double %45, 0.000000e+00
br i1 %49, label %50, label %51
50: ; preds = %34
store double 0.000000e+00, double* %2
br label %61
51: ; preds = %34
%52 = fneg double %41
%53 = fmul double %38, %52
%54 = tail call double @llvm.fmuladd.f64(double %44, double %36, double %53)
%55 = fdiv double %54, %45
store double %55, double* %2
%56 = fsub double %26, %55
%57 = load double, double* %1
%58 = fneg double %57
%59 = fmul double %56, %58
%60 = tail call double @llvm.fmuladd.f64(double %59, double %56, double %25)
br label %61
61: ; preds = %51, %50
%62 = phi double [ %60, %51 ], [ %25, %50 ]
store double %62, double* %3
br label %63
63: ; preds = %22, %61
%64 = phi i32 [ 0, %61 ], [ -1, %22 ]
store i32 %64, i32* %0
ret void
}