double mdet(double M[3][3]) {
  double d0 = M[1][1] * M[2][2] - M[2][1] * M[1][2];
  double d1 = M[1][0] * M[2][2] - M[1][2] * M[2][0];
  double d2 = M[1][0] * M[2][1] - M[1][1] * M[2][0];
  return (M[0][0] * d0 - M[0][1] * d1 + M[0][2] * d2);
}


x86 assembly (clang, -O0):
<mdet>:
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  0x38(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x28(%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  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x28(%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,-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
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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):
<mdet>:
movsd  0x18(%rdi),%xmm0
movsd  0x20(%rdi),%xmm1
movsd  0x40(%rdi),%xmm2
movsd  0x38(%rdi),%xmm3
movsd  0x28(%rdi),%xmm4
movapd %xmm4,%xmm5
mulsd  %xmm3,%xmm5
movsd  0x30(%rdi),%xmm6
mulsd  %xmm6,%xmm4
mulsd  %xmm1,%xmm6
mulsd  %xmm2,%xmm1
subsd  %xmm5,%xmm1
mulsd  %xmm0,%xmm2
subsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm0
subsd  %xmm6,%xmm0
mulsd  0x8(%rdi),%xmm2
mulsd  (%rdi),%xmm1
subsd  %xmm2,%xmm1
mulsd  0x10(%rdi),%xmm0
addsd  %xmm1,%xmm0
ret

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

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