#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 rot3d_mat_transpose(double **);
int rot3d_matrix(double *, double **);
int rot3d_inverse_matrix(double ROT[3], double R[3][3]) {
  int status = -1;
  if ((status = rot3d_matrix(ROT, R)))
    goto rot3d_inverse_matrix_error;
  if ((status = rot3d_mat_transpose(R)))
    goto rot3d_inverse_matrix_error;
  return (status);
rot3d_inverse_matrix_error:
  return (status);
}


x86 assembly (clang, -O0):
<rot3d_inverse_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <rot3d_matrix@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1155 <rot3d_inverse_matrix+0x35>
jmp    117a <rot3d_inverse_matrix+0x5a>
mov    -0x18(%rbp),%rdi
call   1040 <rot3d_mat_transpose@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     116f <rot3d_inverse_matrix+0x4f>
jmp    117a <rot3d_inverse_matrix+0x5a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <rot3d_inverse_matrix+0x60>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot3d_inverse_matrix>:
push   %rbx
mov    %rsi,%rbx
call   1030 <rot3d_matrix@plt>
test   %eax,%eax
je     112f <rot3d_inverse_matrix+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <rot3d_mat_transpose@plt>
test   %eax,%eax
jne    112d <rot3d_inverse_matrix+0xd>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rot3d_inverse_matrix(double* %0, [3 x double]* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca [3 x double]*
%6 = alloca i32
store double* %0, double** %4
store [3 x double]* %1, [3 x double]** %5
store i32 -1, i32* %6
%7 = load double*, double** %4
%8 = load [3 x double]*, [3 x double]** %5
%9 = bitcast [3 x double]* %8 to double**
%10 = call i32 @rot3d_matrix(double* %7, double** %9)
store i32 %10, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
br label %21
13: ; preds = %2
%14 = load [3 x double]*, [3 x double]** %5
%15 = bitcast [3 x double]* %14 to double**
%16 = call i32 @rot3d_mat_transpose(double** %15)
store i32 %16, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
br label %21
19: ; preds = %13
%20 = load i32, i32* %6
store i32 %20, i32* %3
br label %23
21: ; preds = %18, %12
%22 = load i32, i32* %6
store i32 %22, i32* %3
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @rot3d_inverse_matrix(double* %0, [3 x double]* %1) {
%3 = bitcast [3 x double]* %1 to double**
%4 = tail call i32 @rot3d_matrix(double* %0, double** %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @rot3d_mat_transpose(double** %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6, %2
%10 = phi i32 [ %4, %2 ], [ %7, %6 ]
br label %11
11: ; preds = %6, %9
%12 = phi i32 [ %10, %9 ], [ 0, %6 ]
ret i32 %12
}