#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*/ ccp4_dcross(double const *, double const *, double *);
double fabs(double);
double invert3matrix(const double a[3][3], double ai[3][3]) {
  int i, j;
  double c[3][3], d;
  ccp4_dcross(a[1], a[2], c[0]);
  ccp4_dcross(a[2], a[0], c[1]);
  ccp4_dcross(a[0], a[1], c[2]);
  d = a[0][0] * c[0][0] + a[0][1] * c[0][1] + a[0][2] * c[0][2];
  if (fabs(d) > 1.0e-30) {
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++)
        ai[i][j] = c[j][i] / d;
  } else {
    return 0.0;
  }
  return d;
}


x86 assembly (clang, -O0):
<invert3matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x18,%rdi
mov    -0x10(%rbp),%rsi
add    $0x30,%rsi
lea    -0x70(%rbp),%rdx
call   1030 <ccp4_dcross@plt>
mov    -0x10(%rbp),%rdi
add    $0x30,%rdi
mov    -0x10(%rbp),%rsi
lea    -0x70(%rbp),%rdx
add    $0x18,%rdx
call   1030 <ccp4_dcross@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x18,%rsi
lea    -0x70(%rbp),%rdx
add    $0x30,%rdx
call   1030 <ccp4_dcross@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movaps 0xe58(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    124b <invert3matrix+0x13b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1246 <invert3matrix+0x136>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    1233 <invert3matrix+0x123>
movslq -0x20(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x78(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e6 <invert3matrix+0xd6>
jmp    1238 <invert3matrix+0x128>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d5 <invert3matrix+0xc5>
jmp    1258 <invert3matrix+0x148>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1262 <invert3matrix+0x152>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert3matrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x18(%rdi),%r15
lea    0x30(%rdi),%r12
mov    %rsp,%rdx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <ccp4_dcross@plt>
lea    0x18(%rsp),%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <ccp4_dcross@plt>
lea    0x30(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <ccp4_dcross@plt>
movsd  (%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movsd  0x8(%rbx),%xmm0
mulsd  %xmm3,%xmm0
movsd  (%rbx),%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm0,%xmm5
movsd  0x10(%rsp),%xmm2
movsd  0x10(%rbx),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm5,%xmm1
movapd 0xe6e(%rip),%xmm5
andpd  %xmm1,%xmm5
xorpd  %xmm0,%xmm0
ucomisd 0xe6e(%rip),%xmm5
jbe    1209 <invert3matrix+0xf9>
movhpd 0x18(%rsp),%xmm4
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
divpd  %xmm0,%xmm4
movupd %xmm4,(%r14)
movapd 0x30(%rsp),%xmm4
unpcklpd %xmm3,%xmm4
divpd  %xmm0,%xmm4
movupd %xmm4,0x10(%r14)
movapd 0x20(%rsp),%xmm3
movhpd 0x38(%rsp),%xmm3
divpd  %xmm0,%xmm3
movupd %xmm3,0x20(%r14)
movhpd 0x28(%rsp),%xmm2
divpd  %xmm0,%xmm2
movupd %xmm2,0x30(%r14)
movsd  0x40(%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%r14)
movapd %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define double @invert3matrix([3 x double]* %0, [3 x double]* nocapture writeonly %1) {
%3 = alloca [3 x [3 x double]]
%4 = bitcast [3 x [3 x double]]* %3 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 0, i64 0
%8 = call i32 @ccp4_dcross(double* %5, double* %6, double* %7)
%9 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 1, i64 0
%11 = call i32 @ccp4_dcross(double* %6, double* %9, double* %10)
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 2, i64 0
%13 = call i32 @ccp4_dcross(double* %9, double* %5, double* %12)
%14 = load double, double* %9
%15 = load double, double* %7
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%17 = load double, double* %16
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 0, i64 1
%19 = load double, double* %18
%20 = fmul double %17, %19
%21 = call double @llvm.fmuladd.f64(double %14, double %15, double %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%23 = load double, double* %22
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 0, i64 2
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double %23, double %25, double %21)
%27 = call double @llvm.fabs.f64(double %26)
%28 = fcmp ogt double %27, 1.000000e-30
br i1 %28, label %29, label %63
29: ; preds = %2
%30 = load double, double* %10
%31 = insertelement <2 x double> poison, double %15, i64 0
%32 = insertelement <2 x double> %31, double %30, i64 1
%33 = insertelement <2 x double> poison, double %26, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = fdiv <2 x double> %32, %34
%36 = bitcast [3 x double]* %1 to <2 x double>*
store <2 x double> %35, <2 x double>* %36
%37 = bitcast double* %12 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%40 = insertelement <2 x double> %38, double %19, i64 1
%41 = fdiv <2 x double> %40, %34
%42 = bitcast double* %39 to <2 x double>*
store <2 x double> %41, <2 x double>* %42
%43 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 1, i64 1
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%47 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 2, i64 1
%48 = load double, double* %47
%49 = insertelement <2 x double> %45, double %48, i64 1
%50 = fdiv <2 x double> %49, %34
%51 = bitcast double* %46 to <2 x double>*
store <2 x double> %50, <2 x double>* %51
%52 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%53 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 1, i64 2
%54 = load double, double* %53
%55 = insertelement <2 x double> poison, double %25, i64 0
%56 = insertelement <2 x double> %55, double %54, i64 1
%57 = fdiv <2 x double> %56, %34
%58 = bitcast double* %52 to <2 x double>*
store <2 x double> %57, <2 x double>* %58
%59 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 2, i64 2
%60 = load double, double* %59
%61 = fdiv double %60, %26
%62 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
store double %61, double* %62
br label %63
63: ; preds = %29, %2
%64 = phi double [ 0.000000e+00, %2 ], [ %26, %29 ]
ret double %64
}