#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*/ mat_inverse_matrix_d3(double **, double **, double const);
int /*<<< orphan*/ mat_multiply_matrix_d3(double **, double **, double **);
int mat_get_similar_matrix_d3(double m[3][3], double a[3][3], double b[3][3],
                              const double precision) {
  double c[3][3];
  if (!mat_inverse_matrix_d3(c, b, precision)) {
    ;
    ;
    return 0;
  }
  mat_multiply_matrix_d3(m, a, b);
  mat_multiply_matrix_d3(m, c, m);
  return 1;
}


x86 assembly (clang, -O0):
<mat_get_similar_matrix_d3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
call   1030 <mat_inverse_matrix_d3@plt>
cmp    $0x0,%eax
jne    1160 <mat_get_similar_matrix_d3+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1189 <mat_get_similar_matrix_d3+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <mat_multiply_matrix_d3@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <mat_multiply_matrix_d3@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_get_similar_matrix_d3>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%rdi
mov    %rdx,%rsi
call   1030 <mat_inverse_matrix_d3@plt>
test   %eax,%eax
je     1164 <mat_get_similar_matrix_d3+0x44>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <mat_multiply_matrix_d3@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    %r14,%rdx
call   1040 <mat_multiply_matrix_d3@plt>
mov    $0x1,%eax
jmp    1166 <mat_get_similar_matrix_d3+0x46>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @mat_get_similar_matrix_d3([3 x double]* %0, [3 x double]* %1, [3 x double]* %2, double %3) {
%5 = alloca i32
%6 = alloca [3 x double]*
%7 = alloca [3 x double]*
%8 = alloca [3 x double]*
%9 = alloca double
%10 = alloca [3 x [3 x double]]
store [3 x double]* %0, [3 x double]** %6
store [3 x double]* %1, [3 x double]** %7
store [3 x double]* %2, [3 x double]** %8
store double %3, double* %9
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%12 = bitcast [3 x double]* %11 to double**
%13 = load [3 x double]*, [3 x double]** %8
%14 = bitcast [3 x double]* %13 to double**
%15 = load double, double* %9
%16 = call i32 @mat_inverse_matrix_d3(double** %12, double** %14, double %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %4
store i32 0, i32* %5
br label %34
19: ; preds = %4
%20 = load [3 x double]*, [3 x double]** %6
%21 = bitcast [3 x double]* %20 to double**
%22 = load [3 x double]*, [3 x double]** %7
%23 = bitcast [3 x double]* %22 to double**
%24 = load [3 x double]*, [3 x double]** %8
%25 = bitcast [3 x double]* %24 to double**
%26 = call i32 @mat_multiply_matrix_d3(double** %21, double** %23, double** %25)
%27 = load [3 x double]*, [3 x double]** %6
%28 = bitcast [3 x double]* %27 to double**
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%30 = bitcast [3 x double]* %29 to double**
%31 = load [3 x double]*, [3 x double]** %6
%32 = bitcast [3 x double]* %31 to double**
%33 = call i32 @mat_multiply_matrix_d3(double** %28, double** %30, double** %32)
store i32 1, i32* %5
br label %34
34: ; preds = %19, %18
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
define i32 @mat_get_similar_matrix_d3([3 x double]* %0, [3 x double]* %1, [3 x double]* %2, double %3) {
%5 = alloca [3 x [3 x double]]
%6 = bitcast [3 x [3 x double]]* %5 to i8*
%7 = bitcast [3 x [3 x double]]* %5 to double**
%8 = bitcast [3 x double]* %2 to double**
%9 = call i32 @mat_inverse_matrix_d3(double** %7, double** %8, double %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = bitcast [3 x double]* %0 to double**
%13 = bitcast [3 x double]* %1 to double**
%14 = call i32 @mat_multiply_matrix_d3(double** %12, double** %13, double** %8)
%15 = call i32 @mat_multiply_matrix_d3(double** %12, double** %7, double** %12)
br label %16
16: ; preds = %4, %11
%17 = phi i32 [ 1, %11 ], [ 0, %4 ]
ret i32 %17
}