void inverse_2x2(double **inp, double **out) {
  double ad = (inp[0][0]) * (inp[1][1]);
  double bc = (inp[0][1]) * (inp[1][0]);
  double det = ad - bc;
  double invdet = 1 / (det);
  out[0][0] = (inp[1][1]) * (invdet);
  out[0][1] = -(inp[0][1]) * (invdet);
  out[1][0] = -(inp[1][0]) * (invdet);
  out[1][1] = (inp[0][0]) * (invdet);
}


x86 assembly (clang, -O0):
<inverse_2x2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea3(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse_2x2>:
mov    (%rdi),%rax
mov    0x8(%rdi),%rcx
movsd  0x8(%rcx),%xmm0
movsd  (%rax),%xmm1
movsd  0x8(%rax),%xmm2
mulsd  (%rcx),%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  0xed7(%rip),%xmm2
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
mov    (%rsi),%rdx
movsd  %xmm0,(%rdx)
movsd  0x8(%rax),%xmm0
movapd 0xecb(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  (%rcx),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mov    0x8(%rsi),%rcx
movsd  %xmm0,(%rcx)
mulsd  (%rax),%xmm2
movsd  %xmm2,0x8(%rcx)
ret

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

LLVM IR (-O2):
define void @inverse_2x2(double** nocapture %0, double** nocapture %1) {
%3 = load double*, double** %0
%4 = load double, double* %3
%5 = getelementptr inbounds double*, double** %0, i64 1
%6 = load double*, double** %5
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = fmul double %4, %8
%10 = getelementptr inbounds double, double* %3, i64 1
%11 = load double, double* %10
%12 = load double, double* %6
%13 = fmul double %11, %12
%14 = fsub double %9, %13
%15 = fdiv double 1.000000e+00, %14
%16 = fmul double %8, %15
%17 = load double*, double** %1
store double %16, double* %17
%18 = load double, double* %10
%19 = fneg double %18
%20 = fmul double %15, %19
%21 = getelementptr inbounds double, double* %17, i64 1
store double %20, double* %21
%22 = load double, double* %6
%23 = fneg double %22
%24 = fmul double %15, %23
%25 = getelementptr inbounds double*, double** %1, i64 1
%26 = load double*, double** %25
store double %24, double* %26
%27 = load double, double* %3
%28 = fmul double %15, %27
%29 = getelementptr inbounds double, double* %26, i64 1
store double %28, double* %29
ret void
}