#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 */
int /*<<< orphan*/ adjoint(double **, double **);
double det3x3(double **);
double fabs(double);
int inverse3x3(double out[3][3], double in[3][3]) {
  int i, j;
  double det;
  det = det3x3(in);
  if (fabs(det) < 1.e-8)
    return 1;
  adjoint(out, in);
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      out[i][j] /= det;
  return 0;
}


x86 assembly (clang, -O0):
<inverse3x3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <det3x3@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movaps 0xec6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    116c <inverse3x3+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <inverse3x3+0xc9>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <adjoint@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11e2 <inverse3x3+0xc2>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11cf <inverse3x3+0xaf>
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1191 <inverse3x3+0x71>
jmp    11d4 <inverse3x3+0xb4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1180 <inverse3x3+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse3x3>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <det3x3@plt>
movapd 0xec3(%rip),%xmm2
andpd  %xmm0,%xmm2
mov    $0x1,%eax
movsd  0xec2(%rip),%xmm1
ucomisd %xmm2,%xmm1
ja     11b7 <inverse3x3+0x97>
mov    %rbx,%rdi
mov    %r14,%rsi
movapd %xmm0,(%rsp)
call   1030 <adjoint@plt>
movapd (%rsp),%xmm5
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
movupd (%rbx),%xmm1
movupd 0x10(%rbx),%xmm2
movupd 0x20(%rbx),%xmm3
movupd 0x30(%rbx),%xmm4
divpd  %xmm0,%xmm1
movupd %xmm1,(%rbx)
divpd  %xmm0,%xmm2
movupd %xmm2,0x10(%rbx)
divpd  %xmm0,%xmm3
movupd %xmm3,0x20(%rbx)
divpd  %xmm0,%xmm4
movupd %xmm4,0x30(%rbx)
movsd  0x40(%rbx),%xmm0
divsd  %xmm5,%xmm0
movsd  %xmm0,0x40(%rbx)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @inverse3x3([3 x double]* %0, [3 x double]* %1) {
%3 = alloca i32
%4 = alloca [3 x double]*
%5 = alloca [3 x double]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store [3 x double]* %0, [3 x double]** %4
store [3 x double]* %1, [3 x double]** %5
%9 = load [3 x double]*, [3 x double]** %5
%10 = bitcast [3 x double]* %9 to double**
%11 = call double @det3x3(double** %10)
store double %11, double* %8
%12 = load double, double* %8
%13 = call double @llvm.fabs.f64(double %12)
%14 = fcmp olt double %13, 1.000000e-08
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 1, i32* %3
br label %48
16: ; preds = %2
%17 = load [3 x double]*, [3 x double]** %4
%18 = bitcast [3 x double]* %17 to double**
%19 = load [3 x double]*, [3 x double]** %5
%20 = bitcast [3 x double]* %19 to double**
%21 = call i32 @adjoint(double** %18, double** %20)
store i32 0, i32* %6
br label %22
22: ; preds = %44, %16
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 3
br i1 %24, label %25, label %47
25: ; preds = %22
store i32 0, i32* %7
br label %26
26: ; preds = %40, %25
%27 = load i32, i32* %7
%28 = icmp slt i32 %27, 3
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = load double, double* %8
%31 = load [3 x double]*, [3 x double]** %4
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 %33
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 0, i64 %36
%38 = load double, double* %37
%39 = fdiv double %38, %30
store double %39, double* %37
br label %40
40: ; preds = %29
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %26
43: ; preds = %26
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %22
47: ; preds = %22
store i32 0, i32* %3
br label %48
48: ; preds = %47, %15
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
define i32 @inverse3x3([3 x double]* %0, [3 x double]* %1) {
%3 = bitcast [3 x double]* %1 to double**
%4 = tail call double @det3x3(double** %3)
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, 1.000000e-08
br i1 %6, label %34, label %7
7: ; preds = %2
%8 = bitcast [3 x double]* %0 to double**
%9 = tail call i32 @adjoint(double** %8, double** %3)
%10 = bitcast [3 x double]* %0 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = insertelement <2 x double> poison, double %4, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = fdiv <2 x double> %11, %13
%15 = bitcast [3 x double]* %0 to <2 x double>*
store <2 x double> %14, <2 x double>* %15
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%17 = bitcast double* %16 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = fdiv <2 x double> %18, %13
%20 = bitcast double* %16 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
%21 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%22 = bitcast double* %21 to <2 x double>*
%23 = load <2 x double>, <2 x double>* %22
%24 = fdiv <2 x double> %23, %13
%25 = bitcast double* %21 to <2 x double>*
store <2 x double> %24, <2 x double>* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%27 = bitcast double* %26 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = fdiv <2 x double> %28, %13
%30 = bitcast double* %26 to <2 x double>*
store <2 x double> %29, <2 x double>* %30
%31 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%32 = load double, double* %31
%33 = fdiv double %32, %4
store double %33, double* %31
br label %34
34: ; preds = %7, %2
%35 = phi i32 [ 1, %2 ], [ 0, %7 ]
ret i32 %35
}