#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*/ cofatores(double **, double **);
double determinante(double **);
int /*<<< orphan*/ transposta(double **, double **);
void inversa(double mtx[3][3], double resp[3][3]) {
  int i, j;
  double coef[3][3];
  double adj[3][3];
  double determ;
  cofatores(mtx, coef);
  transposta(coef, adj);
  determ = determinante(mtx);
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      resp[i][j] = adj[i][j] / determ;
}


x86 assembly (clang, -O0):
<inversa>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1050 <cofatores@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1040 <transposta@plt>
mov    -0x8(%rbp),%rdi
call   1030 <determinante@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11ef <inversa+0xbf>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11dc <inversa+0xac>
movslq -0x14(%rbp),%rcx
lea    -0xb0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0xb8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1189 <inversa+0x59>
jmp    11e1 <inversa+0xb1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <inversa+0x48>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inversa>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x50(%rsp),%r15
mov    %r15,%rsi
call   1050 <cofatores@plt>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <transposta@plt>
mov    %r14,%rdi
call   1030 <determinante@plt>
movapd (%rsp),%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movupd %xmm1,(%rbx)
movapd 0x10(%rsp),%xmm1
divpd  %xmm2,%xmm1
movupd %xmm1,0x10(%rbx)
movapd 0x20(%rsp),%xmm1
divpd  %xmm2,%xmm1
movupd %xmm1,0x20(%rbx)
movapd 0x30(%rsp),%xmm1
divpd  %xmm2,%xmm1
movupd %xmm1,0x30(%rbx)
movsd  0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%rbx)
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @inversa([3 x double]* %0, [3 x double]* nocapture writeonly %1) {
%3 = alloca [3 x [3 x double]]
%4 = alloca [3 x [3 x double]]
%5 = bitcast [3 x [3 x double]]* %3 to i8*
%6 = bitcast [3 x [3 x double]]* %4 to i8*
%7 = bitcast [3 x double]* %0 to double**
%8 = bitcast [3 x [3 x double]]* %3 to double**
%9 = call i32 @cofatores(double** %7, double** %8)
%10 = bitcast [3 x [3 x double]]* %4 to double**
%11 = call i32 @transposta(double** %8, double** %10)
%12 = call double @determinante(double** %7)
%13 = bitcast [3 x [3 x double]]* %4 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = insertelement <2 x double> poison, double %12, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fdiv <2 x double> %14, %16
%18 = bitcast [3 x double]* %1 to <2 x double>*
store <2 x double> %17, <2 x double>* %18
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 2
%20 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%21 = bitcast double* %19 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = fdiv <2 x double> %22, %16
%24 = bitcast double* %20 to <2 x double>*
store <2 x double> %23, <2 x double>* %24
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 1
%26 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%27 = bitcast double* %25 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = fdiv <2 x double> %28, %16
%30 = bitcast double* %26 to <2 x double>*
store <2 x double> %29, <2 x double>* %30
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%33 = bitcast double* %31 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = fdiv <2 x double> %34, %16
%36 = bitcast double* %32 to <2 x double>*
store <2 x double> %35, <2 x double>* %36
%37 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 2
%38 = load double, double* %37
%39 = fdiv double %38, %12
%40 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
store double %39, double* %40
ret void
}