#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 /*<<< orphan*/ warning_print(char *);
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)) {
    warning_print("spglib: No similar matrix due to 0 determinant.\n");
    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    117c <mat_get_similar_matrix_d3+0x4c>
lea    0xe95(%rip),%rdi
call   1040 <warning_print@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <mat_get_similar_matrix_d3+0x75>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <mat_multiply_matrix_d3@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <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     1174 <mat_get_similar_matrix_d3+0x44>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <mat_multiply_matrix_d3@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    %r14,%rdx
call   1050 <mat_multiply_matrix_d3@plt>
mov    $0x1,%eax
jmp    1182 <mat_get_similar_matrix_d3+0x52>
lea    0xe85(%rip),%rdi
call   1040 <warning_print@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [49 x i8] c"spglib: No similar matrix due to 0 determinant.\0A\00"
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 %20, label %18
18: ; preds = %4
%19 = call i32 @warning_print(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %35
20: ; preds = %4
%21 = load [3 x double]*, [3 x double]** %6
%22 = bitcast [3 x double]* %21 to double**
%23 = load [3 x double]*, [3 x double]** %7
%24 = bitcast [3 x double]* %23 to double**
%25 = load [3 x double]*, [3 x double]** %8
%26 = bitcast [3 x double]* %25 to double**
%27 = call i32 @mat_multiply_matrix_d3(double** %22, double** %24, double** %26)
%28 = load [3 x double]*, [3 x double]** %6
%29 = bitcast [3 x double]* %28 to double**
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%31 = bitcast [3 x double]* %30 to double**
%32 = load [3 x double]*, [3 x double]** %6
%33 = bitcast [3 x double]* %32 to double**
%34 = call i32 @mat_multiply_matrix_d3(double** %29, double** %31, double** %33)
store i32 1, i32* %5
br label %35
35: ; preds = %20, %18
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
@.str = [49 x i8] c"spglib: No similar matrix due to 0 determinant.\0A\00"
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 %11, label %13
11: ; preds = %4
%12 = call i32 @warning_print(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %18
13: ; preds = %4
%14 = bitcast [3 x double]* %0 to double**
%15 = bitcast [3 x double]* %1 to double**
%16 = call i32 @mat_multiply_matrix_d3(double** %14, double** %15, double** %8)
%17 = call i32 @mat_multiply_matrix_d3(double** %14, double** %7, double** %14)
br label %18
18: ; preds = %13, %11
%19 = phi i32 [ 1, %13 ], [ 0, %11 ]
ret i32 %19
}