double det_3d(double *cp0, double *cp1, double *cp2, double *cp3) {
  double det, x01, x02, x03, y01, y02, y03, z01, z02, z03;
  x01 = cp1[0] - cp0[0];
  y01 = cp1[1] - cp0[1];
  z01 = cp1[2] - cp0[2];
  x02 = cp2[0] - cp0[0];
  y02 = cp2[1] - cp0[1];
  z02 = cp2[2] - cp0[2];
  x03 = cp3[0] - cp0[0];
  y03 = cp3[1] - cp0[1];
  z03 = cp3[2] - cp0[2];
  det = x01 * (y02 * z03 - y03 * z02) + y01 * (z02 * x03 - z03 * x02) +
        z01 * (x02 * y03 - x03 * y02);
  return (det);
}


x86 assembly (clang, -O0):
<det_3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm5
movsd  -0x70(%rbp),%xmm4
mulsd  -0x38(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm3
mulsd  -0x50(%rbp),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @det_3d(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = load double, double* %1
%6 = load double, double* %0
%7 = fsub double %5, %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %0, i64 1
%11 = load double, double* %10
%12 = fsub double %9, %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %0, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = load double, double* %2
%19 = fsub double %18, %6
%20 = getelementptr inbounds double, double* %2, i64 1
%21 = load double, double* %20
%22 = fsub double %21, %11
%23 = getelementptr inbounds double, double* %2, i64 2
%24 = load double, double* %23
%25 = fsub double %24, %16
%26 = load double, double* %3
%27 = fsub double %26, %6
%28 = getelementptr inbounds double, double* %3, i64 1
%29 = load double, double* %28
%30 = fsub double %29, %11
%31 = getelementptr inbounds double, double* %3, i64 2
%32 = load double, double* %31
%33 = fsub double %32, %16
%34 = fneg double %30
%35 = fmul double %25, %34
%36 = tail call double @llvm.fmuladd.f64(double %22, double %33, double %35)
%37 = fneg double %33
%38 = fmul double %19, %37
%39 = tail call double @llvm.fmuladd.f64(double %25, double %27, double %38)
%40 = fmul double %12, %39
%41 = tail call double @llvm.fmuladd.f64(double %7, double %36, double %40)
%42 = fneg double %27
%43 = fmul double %22, %42
%44 = tail call double @llvm.fmuladd.f64(double %19, double %30, double %43)
%45 = tail call double @llvm.fmuladd.f64(double %17, double %44, double %41)
ret double %45
}