#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*/ MatrixLog3(double **, double **);
int /*<<< orphan*/ printf(char *, ...);
void test_MatrixLog3() {
  double theta = 30 * 3.14159265358979323846 / 180;
  double R[3][3] = {0, 0, 1, 1, 0, 0, 0, 1, 0};
  double so3Mat[3][3] = {0};
  MatrixLog3(R, so3Mat);
  printf("so3Mat:\n");
  int i;
  for (i = 0; i < 3; i++) {
    printf("%lf %lf %lf\n", so3Mat[i][0], so3Mat[i][1], so3Mat[i][2]);
  }
  return;
}


x86 assembly (clang, -O0):
<test_MatrixLog3>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1040 <memset@plt>
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe93(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1050 <MatrixLog3@plt>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x3,-0xa4(%rbp)
jge    1236 <test_MatrixLog3+0x106>
movslq -0xa4(%rbp),%rcx
lea    -0xa0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0xa4(%rbp),%rcx
lea    -0xa0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0xa4(%rbp),%rcx
lea    -0xa0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xdfe(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11ba <test_MatrixLog3+0x8a>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_MatrixLog3>:
push   %rbx
sub    $0xa0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x50(%rsp)
movq   $0x0,0x90(%rsp)
movaps 0xea0(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x88(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x40(%rsp)
lea    0x50(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <MatrixLog3@plt>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0xe4c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"so3Mat:\0A\00"
@.str.1 = [13 x i8] c"%lf %lf %lf\0A\00"
define void @test_MatrixLog3() {
%1 = alloca double
%2 = alloca [3 x [3 x double]]
%3 = alloca [3 x [3 x double]]
%4 = alloca i32
store double 0x3FE0C152382D7365, double* %1
%5 = bitcast [3 x [3 x double]]* %2 to i8*
%6 = bitcast i8* %5 to [3 x [3 x double]]*
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i32 0, i32 0
%8 = getelementptr inbounds [3 x double], [3 x double]* %7, i32 0, i32 2
store double 1.000000e+00, double* %8
%9 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i32 0, i32 1
%10 = getelementptr inbounds [3 x double], [3 x double]* %9, i32 0, i32 0
store double 1.000000e+00, double* %10
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i32 0, i32 2
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 1
store double 1.000000e+00, double* %12
%13 = bitcast [3 x [3 x double]]* %3 to i8*
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%15 = bitcast [3 x double]* %14 to double**
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 0
%17 = bitcast [3 x double]* %16 to double**
%18 = call i32 @MatrixLog3(double** %15, double** %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %40, %0
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 %25
%27 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 0
%28 = load double, double* %27
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 %30
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 1
%33 = load double, double* %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 %35
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0, i64 2
%38 = load double, double* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %28, double %33, double %38)
br label %40
40: ; preds = %23
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %20
43: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"%lf %lf %lf\0A\00"
@str = [8 x i8] c"so3Mat:\00"
define void @test_MatrixLog3() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x [3 x double]]
%3 = bitcast [3 x [3 x double]]* %1 to i8*
%4 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0, i64 2
%5 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 1
store double 1.000000e+00, double* %6
%7 = bitcast [3 x [3 x double]]* %2 to i8*
%8 = bitcast [3 x [3 x double]]* %1 to double**
%9 = bitcast [3 x [3 x double]]* %2 to double**
%10 = call i32 @MatrixLog3(double** %8, double** %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 0
%13 = load double, double* %12
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 2
%17 = load double, double* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %13, double %15, double %17)
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 0
%20 = load double, double* %19
%21 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 1
%22 = load double, double* %21
%23 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 2
%24 = load double, double* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %20, double %22, double %24)
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 0
%27 = load double, double* %26
%28 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 1
%29 = load double, double* %28
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 2
%31 = load double, double* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %27, double %29, double %31)
ret void
}