#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 /*<<< orphan*/ assert(int);
int linsol(int, double *, double *);
double sqrt(double);
double bilinear_root(const double r0[3], const double r1[3], const double r2[3],
                     const double r3[3]) {
  assert(r0[2] * r3[2] <= 0.0);
  double x_scale = 1.0;
  double y_scale = 1.0;
  double z_scale = 1.0;
  double x1 = (r1[0] - r0[0]) / x_scale;
  double x2 = (r2[0] - r0[0]) / x_scale;
  double x3 = (r3[0] - r0[0]) / x_scale;
  double y1 = (r1[1] - r0[1]) / y_scale;
  double y2 = (r2[1] - r0[1]) / y_scale;
  double y3 = (r3[1] - r0[1]) / y_scale;
  double z0 = r0[2] / z_scale;
  double z1 = r1[2] / z_scale;
  double z2 = r2[2] / z_scale;
  double z3 = r3[2] / z_scale;
  double a[9], b[3];
  a[0] = x1;
  a[1] = y1;
  a[2] = x1 * y1;
  a[3] = x2;
  a[4] = y2;
  a[5] = x2 * y2;
  a[6] = x3;
  a[7] = y3;
  a[8] = x3 * y3;
  b[0] = z1 - z0;
  b[1] = z2 - z0;
  b[2] = z3 - z0;
  int status;
  status = linsol(3, a, b);
  double A = z0;
  double B = b[0];
  double C = b[1];
  double D = b[2];
  double alpha = D * x3 * y3;
  double beta = B * x3 + C * y3;
  double gamma = A;
  double disc = beta * beta - 4.0 * alpha * gamma;
  if (disc < 0.0)
    return 0.5;
  double s = beta < 0.0 ? -1 : 1;
  double Q = beta + s * sqrt(disc);
  double p0 = -Q / (2.0 * alpha);
  double p1 = -2.0 * gamma / Q;
  if (0.0 < p0 && p0 < 1.0)
    return p0;
  if (0.0 < p1 && p1 < 1.0)
    return p1;
  return 0.5;
}


x86 assembly (clang, -O0):
<bilinear_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x28(%rbp),%rax
mulsd  0x10(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  0xe8f(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe75(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
lea    -0xe0(%rbp),%rsi
lea    -0x100(%rbp),%rdx
mov    $0x3,%edi
call   1030 <linsol@plt>
mov    %eax,-0x104(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm2
movsd  -0x120(%rbp),%xmm1
ff
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x110(%rbp),%xmm0
ff
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0x138(%rbp),%xmm0
ff
movsd  -0x138(%rbp),%xmm2
ff
movsd  0xbed(%rip),%xmm1
mulsd  -0x130(%rbp),%xmm1
ff
mulsd  -0x140(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x148(%rbp),%xmm0
ff
jbe    146d <bilinear_root+0x33d>
movsd  0xbbd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15c7 <bilinear_root+0x497>
movsd  -0x138(%rbp),%xmm1
ff
xorps  %xmm0,%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0x138(%rbp),%xmm0
ff
movsd  %xmm0,-0x178(%rbp)
ff
movsd  -0x150(%rbp),%xmm0
ff
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x148(%rbp),%xmm0
ff
call   1050 <sqrt@plt>
movsd  -0x178(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x170(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0x158(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xb0c(%rip),%xmm1
mulsd  -0x130(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  0xae8(%rip),%xmm0
mulsd  -0x140(%rbp),%xmm0
ff
divsd  -0x158(%rbp),%xmm0
ff
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0x160(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    157d <bilinear_root+0x44d>
movsd  0xaab(%rip),%xmm0
ucomisd -0x160(%rbp),%xmm0
ff
jbe    157d <bilinear_root+0x44d>
movsd  -0x160(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    15c7 <bilinear_root+0x497>
movsd  -0x168(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15ba <bilinear_root+0x48a>
movsd  0xa6e(%rip),%xmm0
ucomisd -0x168(%rbp),%xmm0
ff
jbe    15ba <bilinear_root+0x48a>
movsd  -0x168(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    15c7 <bilinear_root+0x497>
movsd  0xa5e(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bilinear_root>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rcx),%xmm0
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm0,%xmm1
setae  %dil
call   1040 <assert@plt>
movupd (%rbx),%xmm0
movupd (%r15),%xmm1
subpd  %xmm0,%xmm1
movupd (%r14),%xmm2
subpd  %xmm0,%xmm2
movupd (%r12),%xmm5
subpd  %xmm0,%xmm5
movsd  0x10(%rbx),%xmm6
movsd  0x10(%r12),%xmm0
movsd  0x10(%r15),%xmm3
movhpd 0x10(%r14),%xmm3
movapd %xmm1,0x60(%rsp)
movapd %xmm1,%xmm4
unpckhpd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
movsd  %xmm4,0x70(%rsp)
movupd %xmm2,0x78(%rsp)
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x88(%rsp)
movapd %xmm5,%xmm1
movapd %xmm5,(%rsp)
movapd %xmm5,0x90(%rsp)
movapd %xmm5,%xmm2
unpckhpd %xmm5,%xmm2
movapd %xmm2,0x10(%rsp)
mulsd  %xmm2,%xmm1
movsd  %xmm1,0xa0(%rsp)
movapd %xmm6,0x40(%rsp)
movapd %xmm6,%xmm1
unpcklpd %xmm6,%xmm1
subpd  %xmm1,%xmm3
movapd %xmm3,0x20(%rsp)
subsd  %xmm6,%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0x60(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    $0x3,%edi
call   1030 <linsol@plt>
movapd 0x40(%rsp),%xmm5
movsd  0x30(%rsp),%xmm2
movapd (%rsp),%xmm1
mulsd  %xmm1,%xmm2
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0x28(%rsp),%xmm0
mulsd  %xmm3,%xmm0
movsd  0x20(%rsp),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
movsd  0xd8c(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm5,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    129f <bilinear_root+0x16f>
movsd  0xd6e(%rip),%xmm0
jmp    137c <bilinear_root+0x24c>
xor    %eax,%eax
ucomisd %xmm3,%xmm1
seta   %al
lea    0xd71(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm4
ucomisd %xmm1,%xmm0
jb     12c0 <bilinear_root+0x190>
sqrtsd %xmm0,%xmm0
jmp    12ed <bilinear_root+0x1bd>
movapd %xmm2,0x10(%rsp)
movsd  %xmm3,(%rsp)
movapd %xmm4,0x50(%rsp)
call   1050 <sqrt@plt>
movapd 0x50(%rsp),%xmm4
movsd  (%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
movapd 0x40(%rsp),%xmm5
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movapd 0xd33(%rip),%xmm0
xorpd  %xmm4,%xmm0
addsd  %xmm2,%xmm2
mulsd  0xd03(%rip),%xmm5
unpcklpd %xmm0,%xmm5
unpcklpd %xmm2,%xmm4
divpd  %xmm4,%xmm5
movapd %xmm5,%xmm1
movapd %xmm5,%xmm0
cmpltpd 0xd16(%rip),%xmm0
unpckhpd %xmm5,%xmm1
movmskpd %xmm0,%eax
movsd  0xcce(%rip),%xmm0
movapd %xmm5,%xmm4
test   $0x1,%al
jne    1346 <bilinear_root+0x216>
movapd %xmm0,%xmm4
xorpd  %xmm2,%xmm2
xorpd  %xmm3,%xmm3
cmpltsd %xmm5,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm0,%xmm3
orpd   %xmm4,%xmm3
cmpltsd %xmm1,%xmm2
movapd %xmm2,%xmm0
andnpd %xmm3,%xmm0
test   $0x2,%al
jne    1374 <bilinear_root+0x244>
movapd %xmm3,%xmm1
andpd  %xmm1,%xmm2
orpd   %xmm2,%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @bilinear_root(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double
%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
%21 = alloca double
%22 = alloca double
%23 = alloca [9 x double]
%24 = alloca [3 x double]
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 2
%40 = load double, double* %39
%41 = load double*, double** %9
%42 = getelementptr inbounds double, double* %41, i64 2
%43 = load double, double* %42
%44 = fmul double %40, %43
%45 = fcmp ole double %44, 0.000000e+00
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
store double 1.000000e+00, double* %10
store double 1.000000e+00, double* %11
store double 1.000000e+00, double* %12
%48 = load double*, double** %7
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = load double*, double** %6
%52 = getelementptr inbounds double, double* %51, i64 0
%53 = load double, double* %52
%54 = fsub double %50, %53
%55 = load double, double* %10
%56 = fdiv double %54, %55
store double %56, double* %13
%57 = load double*, double** %8
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = load double*, double** %6
%61 = getelementptr inbounds double, double* %60, i64 0
%62 = load double, double* %61
%63 = fsub double %59, %62
%64 = load double, double* %10
%65 = fdiv double %63, %64
store double %65, double* %14
%66 = load double*, double** %9
%67 = getelementptr inbounds double, double* %66, i64 0
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 0
%71 = load double, double* %70
%72 = fsub double %68, %71
%73 = load double, double* %10
%74 = fdiv double %72, %73
store double %74, double* %15
%75 = load double*, double** %7
%76 = getelementptr inbounds double, double* %75, i64 1
%77 = load double, double* %76
%78 = load double*, double** %6
%79 = getelementptr inbounds double, double* %78, i64 1
%80 = load double, double* %79
%81 = fsub double %77, %80
%82 = load double, double* %11
%83 = fdiv double %81, %82
store double %83, double* %16
%84 = load double*, double** %8
%85 = getelementptr inbounds double, double* %84, i64 1
%86 = load double, double* %85
%87 = load double*, double** %6
%88 = getelementptr inbounds double, double* %87, i64 1
%89 = load double, double* %88
%90 = fsub double %86, %89
%91 = load double, double* %11
%92 = fdiv double %90, %91
store double %92, double* %17
%93 = load double*, double** %9
%94 = getelementptr inbounds double, double* %93, i64 1
%95 = load double, double* %94
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 1
%98 = load double, double* %97
%99 = fsub double %95, %98
%100 = load double, double* %11
%101 = fdiv double %99, %100
store double %101, double* %18
%102 = load double*, double** %6
%103 = getelementptr inbounds double, double* %102, i64 2
%104 = load double, double* %103
%105 = load double, double* %12
%106 = fdiv double %104, %105
store double %106, double* %19
%107 = load double*, double** %7
%108 = getelementptr inbounds double, double* %107, i64 2
%109 = load double, double* %108
%110 = load double, double* %12
%111 = fdiv double %109, %110
store double %111, double* %20
%112 = load double*, double** %8
%113 = getelementptr inbounds double, double* %112, i64 2
%114 = load double, double* %113
%115 = load double, double* %12
%116 = fdiv double %114, %115
store double %116, double* %21
%117 = load double*, double** %9
%118 = getelementptr inbounds double, double* %117, i64 2
%119 = load double, double* %118
%120 = load double, double* %12
%121 = fdiv double %119, %120
store double %121, double* %22
%122 = load double, double* %13
%123 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 0
store double %122, double* %123
%124 = load double, double* %16
%125 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 1
store double %124, double* %125
%126 = load double, double* %13
%127 = load double, double* %16
%128 = fmul double %126, %127
%129 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 2
store double %128, double* %129
%130 = load double, double* %14
%131 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 3
store double %130, double* %131
%132 = load double, double* %17
%133 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 4
store double %132, double* %133
%134 = load double, double* %14
%135 = load double, double* %17
%136 = fmul double %134, %135
%137 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 5
store double %136, double* %137
%138 = load double, double* %15
%139 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 6
store double %138, double* %139
%140 = load double, double* %18
%141 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 7
store double %140, double* %141
%142 = load double, double* %15
%143 = load double, double* %18
%144 = fmul double %142, %143
%145 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 8
store double %144, double* %145
%146 = load double, double* %20
%147 = load double, double* %19
%148 = fsub double %146, %147
%149 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
store double %148, double* %149
%150 = load double, double* %21
%151 = load double, double* %19
%152 = fsub double %150, %151
%153 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 1
store double %152, double* %153
%154 = load double, double* %22
%155 = load double, double* %19
%156 = fsub double %154, %155
%157 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 2
store double %156, double* %157
%158 = getelementptr inbounds [9 x double], [9 x double]* %23, i64 0, i64 0
%159 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%160 = call i32 @linsol(i32 3, double* %158, double* %159)
store i32 %160, i32* %25
%161 = load double, double* %19
store double %161, double* %26
%162 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%163 = load double, double* %162
store double %163, double* %27
%164 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 1
%165 = load double, double* %164
store double %165, double* %28
%166 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 2
%167 = load double, double* %166
store double %167, double* %29
%168 = load double, double* %29
%169 = load double, double* %15
%170 = fmul double %168, %169
%171 = load double, double* %18
%172 = fmul double %170, %171
store double %172, double* %30
%173 = load double, double* %27
%174 = load double, double* %15
%175 = load double, double* %28
%176 = load double, double* %18
%177 = fmul double %175, %176
%178 = call double @llvm.fmuladd.f64(double %173, double %174, double %177)
store double %178, double* %31
%179 = load double, double* %26
store double %179, double* %32
%180 = load double, double* %31
%181 = load double, double* %31
%182 = load double, double* %30
%183 = fmul double 4.000000e+00, %182
%184 = load double, double* %32
%185 = fmul double %183, %184
%186 = fneg double %185
%187 = call double @llvm.fmuladd.f64(double %180, double %181, double %186)
store double %187, double* %33
%188 = load double, double* %33
%189 = fcmp olt double %188, 0.000000e+00
br i1 %189, label %190, label %191
190: ; preds = %4
store double 5.000000e-01, double* %5
br label %227
191: ; preds = %4
%192 = load double, double* %31
%193 = fcmp olt double %192, 0.000000e+00
%194 = zext i1 %193 to i64
%195 = select i1 %193, i32 -1, i32 1
%196 = sitofp i32 %195 to double
store double %196, double* %34
%197 = load double, double* %31
%198 = load double, double* %34
%199 = load double, double* %33
%200 = call double @sqrt(double %199)
%201 = call double @llvm.fmuladd.f64(double %198, double %200, double %197)
store double %201, double* %35
%202 = load double, double* %35
%203 = fneg double %202
%204 = load double, double* %30
%205 = fmul double 2.000000e+00, %204
%206 = fdiv double %203, %205
store double %206, double* %36
%207 = load double, double* %32
%208 = fmul double -2.000000e+00, %207
%209 = load double, double* %35
%210 = fdiv double %208, %209
store double %210, double* %37
%211 = load double, double* %36
%212 = fcmp olt double 0.000000e+00, %211
br i1 %212, label %213, label %218
213: ; preds = %191
%214 = load double, double* %36
%215 = fcmp olt double %214, 1.000000e+00
br i1 %215, label %216, label %218
216: ; preds = %213
%217 = load double, double* %36
store double %217, double* %5
br label %227
218: ; preds = %213, %191
%219 = load double, double* %37
%220 = fcmp olt double 0.000000e+00, %219
br i1 %220, label %221, label %226
221: ; preds = %218
%222 = load double, double* %37
%223 = fcmp olt double %222, 1.000000e+00
br i1 %223, label %224, label %226
224: ; preds = %221
%225 = load double, double* %37
store double %225, double* %5
br label %227
226: ; preds = %221, %218
store double 5.000000e-01, double* %5
br label %227
227: ; preds = %226, %224, %216, %190
%228 = load double, double* %5
ret double %228
}

LLVM IR (-O2):
define double @bilinear_root(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = alloca [9 x double]
%6 = alloca [3 x double]
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %3, i64 2
%10 = load double, double* %9
%11 = fmul double %8, %10
%12 = fcmp ole double %11, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = bitcast double* %0 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = bitcast double* %1 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = fsub <2 x double> %18, %16
%20 = bitcast double* %2 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = fsub <2 x double> %21, %16
%23 = bitcast double* %3 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = fsub <2 x double> %24, %16
%26 = load double, double* %7
%27 = getelementptr inbounds double, double* %1, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %2, i64 2
%30 = load double, double* %29
%31 = load double, double* %9
%32 = bitcast [9 x double]* %5 to i8*
%33 = bitcast [3 x double]* %6 to i8*
%34 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 0
%35 = bitcast [9 x double]* %5 to <2 x double>*
store <2 x double> %19, <2 x double>* %35
%36 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%37 = fmul <2 x double> %19, %36
%38 = extractelement <2 x double> %37, i64 0
%39 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 2
store double %38, double* %39
%40 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 3
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %22, <2 x double>* %41
%42 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%43 = fmul <2 x double> %22, %42
%44 = extractelement <2 x double> %43, i64 0
%45 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 5
store double %44, double* %45
%46 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 6
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %25, <2 x double>* %47
%48 = extractelement <2 x double> %25, i64 0
%49 = extractelement <2 x double> %25, i64 1
%50 = fmul double %48, %49
%51 = getelementptr inbounds [9 x double], [9 x double]* %5, i64 0, i64 8
store double %50, double* %51
%52 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%53 = insertelement <2 x double> poison, double %28, i64 0
%54 = insertelement <2 x double> %53, double %30, i64 1
%55 = insertelement <2 x double> poison, double %26, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = fsub <2 x double> %54, %56
%58 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%59 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = fsub double %31, %26
%61 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %60, double* %61
%62 = call i32 @linsol(i32 3, double* %34, double* %52)
%63 = load double, double* %52
%64 = load double, double* %58
%65 = load double, double* %61
%66 = fmul double %48, %65
%67 = fmul double %49, %66
%68 = fmul double %49, %64
%69 = call double @llvm.fmuladd.f64(double %63, double %48, double %68)
%70 = fmul double %67, -4.000000e+00
%71 = fmul double %26, %70
%72 = call double @llvm.fmuladd.f64(double %69, double %69, double %71)
%73 = fcmp olt double %72, 0.000000e+00
br i1 %73, label %98, label %74
74: ; preds = %4
%75 = fcmp olt double %69, 0.000000e+00
%76 = select i1 %75, double -1.000000e+00, double 1.000000e+00
%77 = call double @sqrt(double %72)
%78 = call double @llvm.fmuladd.f64(double %76, double %77, double %69)
%79 = fneg double %78
%80 = fmul double %67, 2.000000e+00
%81 = fmul double %26, -2.000000e+00
%82 = insertelement <2 x double> poison, double %81, i64 0
%83 = insertelement <2 x double> %82, double %79, i64 1
%84 = insertelement <2 x double> poison, double %78, i64 0
%85 = insertelement <2 x double> %84, double %80, i64 1
%86 = fdiv <2 x double> %83, %85
%87 = extractelement <2 x double> %86, i64 1
%88 = fcmp ogt double %87, 0.000000e+00
%89 = fcmp olt <2 x double> %86, <double 1.000000e+00, double 1.000000e+00>
%90 = extractelement <2 x i1> %89, i64 1
%91 = and i1 %88, %90
%92 = extractelement <2 x double> %86, i64 0
%93 = fcmp ogt double %92, 0.000000e+00
%94 = extractelement <2 x i1> %89, i64 0
%95 = and i1 %93, %94
%96 = select i1 %95, double %92, double 5.000000e-01
%97 = select i1 %91, double %87, double %96
br label %98
98: ; preds = %4, %74
%99 = phi double [ %97, %74 ], [ 5.000000e-01, %4 ]
ret double %99
}