#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*/ get_orthonormal_basis(double **, double **);
int /*<<< orphan*/ mat_inverse_matrix_d3(double **, double **,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ mat_multiply_matrix_d3(double **, double **, double **);
void measure_rigid_rotation(double rotation[3][3], double bravais_lattice[3][3],
                            double std_lattice[3][3]) {
  double brv_basis[3][3], std_basis[3][3], inv_brv_basis[3][3];
  get_orthonormal_basis(brv_basis, bravais_lattice);
  get_orthonormal_basis(std_basis, std_lattice);
  mat_inverse_matrix_d3(inv_brv_basis, brv_basis, 0);
  mat_multiply_matrix_d3(rotation, std_basis, inv_brv_basis);
}


x86 assembly (clang, -O0):
<measure_rigid_rotation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_orthonormal_basis@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <get_orthonormal_basis@plt>
lea    -0x100(%rbp),%rdi
lea    -0x60(%rbp),%rsi
xor    %edx,%edx
call   1030 <mat_inverse_matrix_d3@plt>
mov    -0x8(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   1050 <mat_multiply_matrix_d3@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<measure_rigid_rotation>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
lea    0xa0(%rsp),%r15
mov    %r15,%rdi
call   1040 <get_orthonormal_basis@plt>
lea    0x50(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <get_orthonormal_basis@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <mat_inverse_matrix_d3@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <mat_multiply_matrix_d3@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @measure_rigid_rotation([3 x double]* %0, [3 x double]* %1, [3 x double]* %2) {
%4 = alloca [3 x [3 x double]]
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x [3 x double]]
%7 = bitcast [3 x [3 x double]]* %4 to i8*
%8 = bitcast [3 x [3 x double]]* %5 to i8*
%9 = bitcast [3 x [3 x double]]* %6 to i8*
%10 = bitcast [3 x [3 x double]]* %4 to double**
%11 = bitcast [3 x double]* %1 to double**
%12 = call i32 @get_orthonormal_basis(double** %10, double** %11)
%13 = bitcast [3 x [3 x double]]* %5 to double**
%14 = bitcast [3 x double]* %2 to double**
%15 = call i32 @get_orthonormal_basis(double** %13, double** %14)
%16 = bitcast [3 x [3 x double]]* %6 to double**
%17 = call i32 @mat_inverse_matrix_d3(double** %16, double** %10, i32 0)
%18 = bitcast [3 x double]* %0 to double**
%19 = call i32 @mat_multiply_matrix_d3(double** %18, double** %13, double** %16)
ret void
}