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


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

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

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

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