void interpolate(const double t1, const double t2, const double x[3],
                 const double f[3], double *w1, double *w2) {
  double a0 = f[0];
  double a1 = (f[1] - a0) / (x[1] - x[0]);
  double a2 = ((f[2] - f[0]) / (x[2] - x[0]) - a1) / (x[2] - x[1]);
  *w1 = a0 + (t1 - x[0]) * (a1 + a2 * (t1 - x[1]));
  *w2 = a0 + (t2 - x[0]) * (a1 + a2 * (t2 - x[1]));
}


x86 assembly (clang, -O0):
<interpolate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm4
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm4
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolate>:
movsd  (%rsi),%xmm8
movsd  0x8(%rsi),%xmm3
subsd  %xmm8,%xmm3
movsd  (%rdi),%xmm4
movsd  0x8(%rdi),%xmm5
movsd  0x10(%rdi),%xmm6
movapd %xmm6,%xmm7
subsd  %xmm5,%xmm6
movapd %xmm0,%xmm2
subsd  %xmm5,%xmm0
subsd  %xmm4,%xmm5
divsd  %xmm5,%xmm3
movsd  0x10(%rsi),%xmm5
subsd  %xmm8,%xmm5
subsd  %xmm4,%xmm7
divsd  %xmm7,%xmm5
subsd  %xmm3,%xmm5
divsd  %xmm6,%xmm5
subsd  %xmm4,%xmm2
mulsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm8,%xmm0
movsd  %xmm0,(%rdx)
movapd %xmm1,%xmm0
subsd  (%rdi),%xmm0
subsd  0x8(%rdi),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm8,%xmm1
movsd  %xmm1,(%rcx)
ret

LLVM IR (-O0):
define void @interpolate(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
store double %0, double* %7
store double %1, double* %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%16 = load double*, double** %10
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
store double %18, double* %13
%19 = load double*, double** %10
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double, double* %13
%23 = fsub double %21, %22
%24 = load double*, double** %9
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %9
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = fsub double %26, %29
%31 = fdiv double %23, %30
store double %31, double* %14
%32 = load double*, double** %10
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = load double*, double** %10
%36 = getelementptr inbounds double, double* %35, i64 0
%37 = load double, double* %36
%38 = fsub double %34, %37
%39 = load double*, double** %9
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = load double*, double** %9
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = fsub double %41, %44
%46 = fdiv double %38, %45
%47 = load double, double* %14
%48 = fsub double %46, %47
%49 = load double*, double** %9
%50 = getelementptr inbounds double, double* %49, i64 2
%51 = load double, double* %50
%52 = load double*, double** %9
%53 = getelementptr inbounds double, double* %52, i64 1
%54 = load double, double* %53
%55 = fsub double %51, %54
%56 = fdiv double %48, %55
store double %56, double* %15
%57 = load double, double* %13
%58 = load double, double* %7
%59 = load double*, double** %9
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fsub double %58, %61
%63 = load double, double* %14
%64 = load double, double* %15
%65 = load double, double* %7
%66 = load double*, double** %9
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = fsub double %65, %68
%70 = call double @llvm.fmuladd.f64(double %64, double %69, double %63)
%71 = call double @llvm.fmuladd.f64(double %62, double %70, double %57)
%72 = load double*, double** %11
store double %71, double* %72
%73 = load double, double* %13
%74 = load double, double* %8
%75 = load double*, double** %9
%76 = getelementptr inbounds double, double* %75, i64 0
%77 = load double, double* %76
%78 = fsub double %74, %77
%79 = load double, double* %14
%80 = load double, double* %15
%81 = load double, double* %8
%82 = load double*, double** %9
%83 = getelementptr inbounds double, double* %82, i64 1
%84 = load double, double* %83
%85 = fsub double %81, %84
%86 = call double @llvm.fmuladd.f64(double %80, double %85, double %79)
%87 = call double @llvm.fmuladd.f64(double %78, double %86, double %73)
%88 = load double*, double** %12
store double %87, double* %88
ret void
}

LLVM IR (-O2):
define void @interpolate(double %0, double %1, double* nocapture %2, double* nocapture %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = load double, double* %3
%8 = getelementptr inbounds double, double* %3, i64 1
%9 = load double, double* %8
%10 = fsub double %9, %7
%11 = getelementptr inbounds double, double* %2, i64 1
%12 = load double, double* %11
%13 = load double, double* %2
%14 = fsub double %12, %13
%15 = fdiv double %10, %14
%16 = getelementptr inbounds double, double* %3, i64 2
%17 = load double, double* %16
%18 = fsub double %17, %7
%19 = getelementptr inbounds double, double* %2, i64 2
%20 = load double, double* %19
%21 = fsub double %20, %13
%22 = fdiv double %18, %21
%23 = fsub double %22, %15
%24 = fsub double %20, %12
%25 = fdiv double %23, %24
%26 = fsub double %0, %13
%27 = fsub double %0, %12
%28 = tail call double @llvm.fmuladd.f64(double %25, double %27, double %15)
%29 = tail call double @llvm.fmuladd.f64(double %26, double %28, double %7)
store double %29, double* %4
%30 = load double, double* %2
%31 = fsub double %1, %30
%32 = load double, double* %11
%33 = fsub double %1, %32
%34 = tail call double @llvm.fmuladd.f64(double %25, double %33, double %15)
%35 = tail call double @llvm.fmuladd.f64(double %31, double %34, double %7)
store double %35, double* %5
ret void
}