double det_3(const double A[9]) {
  const double a = A[4] * A[8] - A[5] * A[7], b = A[5] * A[6] - A[3] * A[8],
               c = A[3] * A[7] - A[4] * A[6];
  return A[0] * a + A[1] * b + A[2] * c;
}


x86 assembly (clang, -O0):
<det_3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x38(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x40(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x30(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<det_3>:
movsd  0x18(%rdi),%xmm0
movsd  0x20(%rdi),%xmm1
movsd  0x40(%rdi),%xmm2
movsd  0x28(%rdi),%xmm3
movsd  0x38(%rdi),%xmm4
movapd %xmm1,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm0,%xmm2
mulsd  %xmm4,%xmm0
mulsd  %xmm3,%xmm4
subsd  %xmm4,%xmm5
movsd  0x30(%rdi),%xmm4
mulsd  %xmm4,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm4
subsd  %xmm4,%xmm0
mulsd  0x8(%rdi),%xmm3
mulsd  (%rdi),%xmm5
addsd  %xmm3,%xmm5
mulsd  0x10(%rdi),%xmm0
addsd  %xmm5,%xmm0
ret

LLVM IR (-O0):
define double @det_3(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double* %0, double** %2
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 4
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 8
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 5
%14 = load double, double* %13
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 7
%17 = load double, double* %16
%18 = fmul double %14, %17
%19 = fneg double %18
%20 = call double @llvm.fmuladd.f64(double %8, double %11, double %19)
store double %20, double* %3
%21 = load double*, double** %2
%22 = getelementptr inbounds double, double* %21, i64 5
%23 = load double, double* %22
%24 = load double*, double** %2
%25 = getelementptr inbounds double, double* %24, i64 6
%26 = load double, double* %25
%27 = load double*, double** %2
%28 = getelementptr inbounds double, double* %27, i64 3
%29 = load double, double* %28
%30 = load double*, double** %2
%31 = getelementptr inbounds double, double* %30, i64 8
%32 = load double, double* %31
%33 = fmul double %29, %32
%34 = fneg double %33
%35 = call double @llvm.fmuladd.f64(double %23, double %26, double %34)
store double %35, double* %4
%36 = load double*, double** %2
%37 = getelementptr inbounds double, double* %36, i64 3
%38 = load double, double* %37
%39 = load double*, double** %2
%40 = getelementptr inbounds double, double* %39, i64 7
%41 = load double, double* %40
%42 = load double*, double** %2
%43 = getelementptr inbounds double, double* %42, i64 4
%44 = load double, double* %43
%45 = load double*, double** %2
%46 = getelementptr inbounds double, double* %45, i64 6
%47 = load double, double* %46
%48 = fmul double %44, %47
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double %38, double %41, double %49)
store double %50, double* %5
%51 = load double*, double** %2
%52 = getelementptr inbounds double, double* %51, i64 0
%53 = load double, double* %52
%54 = load double, double* %3
%55 = load double*, double** %2
%56 = getelementptr inbounds double, double* %55, i64 1
%57 = load double, double* %56
%58 = load double, double* %4
%59 = fmul double %57, %58
%60 = call double @llvm.fmuladd.f64(double %53, double %54, double %59)
%61 = load double*, double** %2
%62 = getelementptr inbounds double, double* %61, i64 2
%63 = load double, double* %62
%64 = load double, double* %5
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double %60)
ret double %65
}

LLVM IR (-O2):
define double @det_3(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 4
%3 = load double, double* %2
%4 = getelementptr inbounds double, double* %0, i64 8
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 5
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 7
%9 = load double, double* %8
%10 = fneg double %7
%11 = fmul double %9, %10
%12 = tail call double @llvm.fmuladd.f64(double %3, double %5, double %11)
%13 = getelementptr inbounds double, double* %0, i64 6
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %0, i64 3
%16 = load double, double* %15
%17 = fneg double %16
%18 = fmul double %5, %17
%19 = tail call double @llvm.fmuladd.f64(double %7, double %14, double %18)
%20 = fneg double %3
%21 = fmul double %14, %20
%22 = tail call double @llvm.fmuladd.f64(double %16, double %9, double %21)
%23 = load double, double* %0
%24 = getelementptr inbounds double, double* %0, i64 1
%25 = load double, double* %24
%26 = fmul double %25, %19
%27 = tail call double @llvm.fmuladd.f64(double %23, double %12, double %26)
%28 = getelementptr inbounds double, double* %0, i64 2
%29 = load double, double* %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double %22, double %27)
ret double %30
}