#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double determinant3x3(double *);
double fabs(double);
int inverse_mat3(double m[9], double r[9]) {
  double d;
  d = determinant3x3(m);
  if (fabs(d) == 0.0) {
    return 1;
  }
  d = 1.0 / d;
  r[0] = d * (m[4] * m[8] - m[7] * m[5]);
  r[1] = d * (m[7] * m[2] - m[8] * m[1]);
  r[2] = d * (m[1] * m[5] - m[2] * m[4]);
  r[3] = d * (m[5] * m[6] - m[3] * m[8]);
  r[4] = d * (m[8] * m[0] - m[2] * m[6]);
  r[5] = d * (m[2] * m[3] - m[0] * m[5]);
  r[6] = d * (m[3] * m[7] - m[6] * m[4]);
  r[7] = d * (m[1] * m[6] - m[0] * m[7]);
  r[8] = d * (m[0] * m[4] - m[3] * m[1]);
  return 0;
}


x86 assembly (clang, -O0):
<inverse_mat3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <determinant3x3@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xec6(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115d <inverse_mat3+0x4d>
jp     115d <inverse_mat3+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    146e <inverse_mat3+0x35e>
movsd  0xeab(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x28(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x40(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x30(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x28(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x38(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x40(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse_mat3>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <determinant3x3@plt>
mov    $0x1,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1134 <inverse_mat3+0x24>
jnp    126f <inverse_mat3+0x15f>
movsd  0xec4(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0x20(%rbx),%xmm0
movsd  0x28(%rbx),%xmm2
mulsd  0x38(%rbx),%xmm2
mulsd  0x40(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
mulsd  0x40(%rbx),%xmm0
movsd  0x38(%rbx),%xmm2
mulsd  0x10(%rbx),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%r14)
movsd  0x8(%rbx),%xmm0
movsd  0x20(%rbx),%xmm2
mulsd  0x10(%rbx),%xmm2
mulsd  0x28(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x28(%rbx),%xmm0
movsd  0x40(%rbx),%xmm2
mulsd  0x18(%rbx),%xmm2
mulsd  0x30(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%r14)
movsd  0x30(%rbx),%xmm0
mulsd  0x10(%rbx),%xmm0
movsd  0x40(%rbx),%xmm2
mulsd  (%rbx),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%r14)
movsd  0x10(%rbx),%xmm0
movsd  0x28(%rbx),%xmm2
mulsd  (%rbx),%xmm2
mulsd  0x18(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%r14)
movsd  0x18(%rbx),%xmm0
movsd  0x20(%rbx),%xmm2
mulsd  0x30(%rbx),%xmm2
mulsd  0x38(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%r14)
movsd  0x38(%rbx),%xmm0
mulsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm2
mulsd  0x30(%rbx),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x38(%r14)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm2
mulsd  0x18(%rbx),%xmm2
mulsd  0x20(%rbx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @inverse_mat3(double* %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store double* %0, double** %4
store double* %1, double** %5
%7 = load double*, double** %4
%8 = call double @determinant3x3(double* %7)
store double %8, double* %6
%9 = load double, double* %6
%10 = call double @llvm.fabs.f64(double %9)
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %187
13: ; preds = %2
%14 = load double, double* %6
%15 = fdiv double 1.000000e+00, %14
store double %15, double* %6
%16 = load double, double* %6
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 4
%19 = load double, double* %18
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 8
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 7
%25 = load double, double* %24
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 5
%28 = load double, double* %27
%29 = fmul double %25, %28
%30 = fneg double %29
%31 = call double @llvm.fmuladd.f64(double %19, double %22, double %30)
%32 = fmul double %16, %31
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 0
store double %32, double* %34
%35 = load double, double* %6
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 7
%38 = load double, double* %37
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 8
%44 = load double, double* %43
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
%48 = fmul double %44, %47
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double %38, double %41, double %49)
%51 = fmul double %35, %50
%52 = load double*, double** %5
%53 = getelementptr inbounds double, double* %52, i64 1
store double %51, double* %53
%54 = load double, double* %6
%55 = load double*, double** %4
%56 = getelementptr inbounds double, double* %55, i64 1
%57 = load double, double* %56
%58 = load double*, double** %4
%59 = getelementptr inbounds double, double* %58, i64 5
%60 = load double, double* %59
%61 = load double*, double** %4
%62 = getelementptr inbounds double, double* %61, i64 2
%63 = load double, double* %62
%64 = load double*, double** %4
%65 = getelementptr inbounds double, double* %64, i64 4
%66 = load double, double* %65
%67 = fmul double %63, %66
%68 = fneg double %67
%69 = call double @llvm.fmuladd.f64(double %57, double %60, double %68)
%70 = fmul double %54, %69
%71 = load double*, double** %5
%72 = getelementptr inbounds double, double* %71, i64 2
store double %70, double* %72
%73 = load double, double* %6
%74 = load double*, double** %4
%75 = getelementptr inbounds double, double* %74, i64 5
%76 = load double, double* %75
%77 = load double*, double** %4
%78 = getelementptr inbounds double, double* %77, i64 6
%79 = load double, double* %78
%80 = load double*, double** %4
%81 = getelementptr inbounds double, double* %80, i64 3
%82 = load double, double* %81
%83 = load double*, double** %4
%84 = getelementptr inbounds double, double* %83, i64 8
%85 = load double, double* %84
%86 = fmul double %82, %85
%87 = fneg double %86
%88 = call double @llvm.fmuladd.f64(double %76, double %79, double %87)
%89 = fmul double %73, %88
%90 = load double*, double** %5
%91 = getelementptr inbounds double, double* %90, i64 3
store double %89, double* %91
%92 = load double, double* %6
%93 = load double*, double** %4
%94 = getelementptr inbounds double, double* %93, i64 8
%95 = load double, double* %94
%96 = load double*, double** %4
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load double, double* %97
%99 = load double*, double** %4
%100 = getelementptr inbounds double, double* %99, i64 2
%101 = load double, double* %100
%102 = load double*, double** %4
%103 = getelementptr inbounds double, double* %102, i64 6
%104 = load double, double* %103
%105 = fmul double %101, %104
%106 = fneg double %105
%107 = call double @llvm.fmuladd.f64(double %95, double %98, double %106)
%108 = fmul double %92, %107
%109 = load double*, double** %5
%110 = getelementptr inbounds double, double* %109, i64 4
store double %108, double* %110
%111 = load double, double* %6
%112 = load double*, double** %4
%113 = getelementptr inbounds double, double* %112, i64 2
%114 = load double, double* %113
%115 = load double*, double** %4
%116 = getelementptr inbounds double, double* %115, i64 3
%117 = load double, double* %116
%118 = load double*, double** %4
%119 = getelementptr inbounds double, double* %118, i64 0
%120 = load double, double* %119
%121 = load double*, double** %4
%122 = getelementptr inbounds double, double* %121, i64 5
%123 = load double, double* %122
%124 = fmul double %120, %123
%125 = fneg double %124
%126 = call double @llvm.fmuladd.f64(double %114, double %117, double %125)
%127 = fmul double %111, %126
%128 = load double*, double** %5
%129 = getelementptr inbounds double, double* %128, i64 5
store double %127, double* %129
%130 = load double, double* %6
%131 = load double*, double** %4
%132 = getelementptr inbounds double, double* %131, i64 3
%133 = load double, double* %132
%134 = load double*, double** %4
%135 = getelementptr inbounds double, double* %134, i64 7
%136 = load double, double* %135
%137 = load double*, double** %4
%138 = getelementptr inbounds double, double* %137, i64 6
%139 = load double, double* %138
%140 = load double*, double** %4
%141 = getelementptr inbounds double, double* %140, i64 4
%142 = load double, double* %141
%143 = fmul double %139, %142
%144 = fneg double %143
%145 = call double @llvm.fmuladd.f64(double %133, double %136, double %144)
%146 = fmul double %130, %145
%147 = load double*, double** %5
%148 = getelementptr inbounds double, double* %147, i64 6
store double %146, double* %148
%149 = load double, double* %6
%150 = load double*, double** %4
%151 = getelementptr inbounds double, double* %150, i64 1
%152 = load double, double* %151
%153 = load double*, double** %4
%154 = getelementptr inbounds double, double* %153, i64 6
%155 = load double, double* %154
%156 = load double*, double** %4
%157 = getelementptr inbounds double, double* %156, i64 0
%158 = load double, double* %157
%159 = load double*, double** %4
%160 = getelementptr inbounds double, double* %159, i64 7
%161 = load double, double* %160
%162 = fmul double %158, %161
%163 = fneg double %162
%164 = call double @llvm.fmuladd.f64(double %152, double %155, double %163)
%165 = fmul double %149, %164
%166 = load double*, double** %5
%167 = getelementptr inbounds double, double* %166, i64 7
store double %165, double* %167
%168 = load double, double* %6
%169 = load double*, double** %4
%170 = getelementptr inbounds double, double* %169, i64 0
%171 = load double, double* %170
%172 = load double*, double** %4
%173 = getelementptr inbounds double, double* %172, i64 4
%174 = load double, double* %173
%175 = load double*, double** %4
%176 = getelementptr inbounds double, double* %175, i64 3
%177 = load double, double* %176
%178 = load double*, double** %4
%179 = getelementptr inbounds double, double* %178, i64 1
%180 = load double, double* %179
%181 = fmul double %177, %180
%182 = fneg double %181
%183 = call double @llvm.fmuladd.f64(double %171, double %174, double %182)
%184 = fmul double %168, %183
%185 = load double*, double** %5
%186 = getelementptr inbounds double, double* %185, i64 8
store double %184, double* %186
store i32 0, i32* %3
br label %187
187: ; preds = %13, %12
%188 = load i32, i32* %3
ret i32 %188
}

LLVM IR (-O2):
define i32 @inverse_mat3(double* %0, double* nocapture writeonly %1) {
%3 = tail call double @determinant3x3(double* %0)
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %95, label %5
5: ; preds = %2
%6 = fdiv double 1.000000e+00, %3
%7 = getelementptr inbounds double, double* %0, i64 4
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 8
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 7
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 5
%14 = load double, double* %13
%15 = fneg double %12
%16 = fmul double %14, %15
%17 = tail call double @llvm.fmuladd.f64(double %8, double %10, double %16)
%18 = fmul double %6, %17
store double %18, double* %1
%19 = load double, double* %11
%20 = getelementptr inbounds double, double* %0, i64 2
%21 = load double, double* %20
%22 = load double, double* %9
%23 = getelementptr inbounds double, double* %0, i64 1
%24 = load double, double* %23
%25 = fneg double %22
%26 = fmul double %24, %25
%27 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %26)
%28 = fmul double %6, %27
%29 = getelementptr inbounds double, double* %1, i64 1
store double %28, double* %29
%30 = load double, double* %23
%31 = load double, double* %13
%32 = load double, double* %20
%33 = load double, double* %7
%34 = fneg double %32
%35 = fmul double %33, %34
%36 = tail call double @llvm.fmuladd.f64(double %30, double %31, double %35)
%37 = fmul double %6, %36
%38 = getelementptr inbounds double, double* %1, i64 2
store double %37, double* %38
%39 = load double, double* %13
%40 = getelementptr inbounds double, double* %0, i64 6
%41 = load double, double* %40
%42 = getelementptr inbounds double, double* %0, i64 3
%43 = load double, double* %42
%44 = load double, double* %9
%45 = fneg double %43
%46 = fmul double %44, %45
%47 = tail call double @llvm.fmuladd.f64(double %39, double %41, double %46)
%48 = fmul double %6, %47
%49 = getelementptr inbounds double, double* %1, i64 3
store double %48, double* %49
%50 = load double, double* %9
%51 = load double, double* %0
%52 = load double, double* %20
%53 = load double, double* %40
%54 = fneg double %52
%55 = fmul double %53, %54
%56 = tail call double @llvm.fmuladd.f64(double %50, double %51, double %55)
%57 = fmul double %6, %56
%58 = getelementptr inbounds double, double* %1, i64 4
store double %57, double* %58
%59 = load double, double* %20
%60 = load double, double* %42
%61 = load double, double* %0
%62 = load double, double* %13
%63 = fneg double %61
%64 = fmul double %62, %63
%65 = tail call double @llvm.fmuladd.f64(double %59, double %60, double %64)
%66 = fmul double %6, %65
%67 = getelementptr inbounds double, double* %1, i64 5
store double %66, double* %67
%68 = load double, double* %42
%69 = load double, double* %11
%70 = load double, double* %40
%71 = load double, double* %7
%72 = fneg double %70
%73 = fmul double %71, %72
%74 = tail call double @llvm.fmuladd.f64(double %68, double %69, double %73)
%75 = fmul double %6, %74
%76 = getelementptr inbounds double, double* %1, i64 6
store double %75, double* %76
%77 = load double, double* %23
%78 = load double, double* %40
%79 = load double, double* %0
%80 = load double, double* %11
%81 = fneg double %79
%82 = fmul double %80, %81
%83 = tail call double @llvm.fmuladd.f64(double %77, double %78, double %82)
%84 = fmul double %6, %83
%85 = getelementptr inbounds double, double* %1, i64 7
store double %84, double* %85
%86 = load double, double* %0
%87 = load double, double* %7
%88 = load double, double* %42
%89 = load double, double* %23
%90 = fneg double %88
%91 = fmul double %89, %90
%92 = tail call double @llvm.fmuladd.f64(double %86, double %87, double %91)
%93 = fmul double %6, %92
%94 = getelementptr inbounds double, double* %1, i64 8
store double %93, double* %94
br label %95
95: ; preds = %2, %5
%96 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %96
}