double det3x3(double in[3][3]) {
  double a1, a2, a3, b1, b2, b3, c1, c2, c3;
  double ans;
  a1 = in[0][0];
  b1 = in[0][1];
  c1 = in[0][2];
  a2 = in[1][0];
  b2 = in[1][1];
  c2 = in[1][2];
  a3 = in[2][0];
  b3 = in[2][1];
  c3 = in[2][2];
  ans = a1 * (b2 * c3 - b3 * c2) - b1 * (a2 * c3 - a3 * c2) +
        c1 * (a2 * b3 - a3 * b2);
  return ans;
}


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

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

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

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