double InterpSquareLagrange(double xdiff, double zdiff, double vval00,
                            double vval01, double vval10, double vval11) {
  double value;
  value = vval00 * (1.0 - xdiff) * (1.0 - zdiff) +
          vval01 * (1.0 - xdiff) * zdiff + vval10 * xdiff * (1.0 - zdiff) +
          vval11 * xdiff * zdiff;
  return (value);
}


x86 assembly (clang, -O0):
<InterpSquareLagrange>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec0(%rip),%xmm2
subsd  -0x10(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  0xeae(%rip),%xmm3
subsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xe86(%rip),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<InterpSquareLagrange>:
movsd  0xef8(%rip),%xmm6
movapd %xmm6,%xmm7
subsd  %xmm0,%xmm7
mulsd  %xmm7,%xmm2
subsd  %xmm1,%xmm6
mulsd  %xmm3,%xmm7
mulsd  %xmm1,%xmm7
mulsd  %xmm6,%xmm2
addsd  %xmm2,%xmm7
mulsd  %xmm0,%xmm4
mulsd  %xmm4,%xmm6
addsd  %xmm7,%xmm6
mulsd  %xmm5,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm6,%xmm0
ret

LLVM IR (-O0):
define double @InterpSquareLagrange(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
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
%14 = load double, double* %9
%15 = load double, double* %7
%16 = fsub double 1.000000e+00, %15
%17 = fmul double %14, %16
%18 = load double, double* %8
%19 = fsub double 1.000000e+00, %18
%20 = load double, double* %10
%21 = load double, double* %7
%22 = fsub double 1.000000e+00, %21
%23 = fmul double %20, %22
%24 = load double, double* %8
%25 = fmul double %23, %24
%26 = call double @llvm.fmuladd.f64(double %17, double %19, double %25)
%27 = load double, double* %11
%28 = load double, double* %7
%29 = fmul double %27, %28
%30 = load double, double* %8
%31 = fsub double 1.000000e+00, %30
%32 = call double @llvm.fmuladd.f64(double %29, double %31, double %26)
%33 = load double, double* %12
%34 = load double, double* %7
%35 = fmul double %33, %34
%36 = load double, double* %8
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double %32)
store double %37, double* %13
%38 = load double, double* %13
ret double %38
}

LLVM IR (-O2):
define double @InterpSquareLagrange(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double 1.000000e+00, %0
%8 = fmul double %7, %2
%9 = fsub double 1.000000e+00, %1
%10 = fmul double %7, %3
%11 = fmul double %10, %1
%12 = tail call double @llvm.fmuladd.f64(double %8, double %9, double %11)
%13 = fmul double %0, %4
%14 = tail call double @llvm.fmuladd.f64(double %13, double %9, double %12)
%15 = fmul double %0, %5
%16 = tail call double @llvm.fmuladd.f64(double %15, double %1, double %14)
ret double %16
}