double determinant3x3(double m[9]) {
  return m[0] * m[4] * m[8] - m[0] * m[5] * m[7] + m[1] * m[5] * m[6] -
         m[1] * m[3] * m[8] + m[2] * m[3] * m[7] - m[2] * m[4] * m[6];
}


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

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

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

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