#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*/ printf(char *, ...);
int /*<<< orphan*/ so3ToVec(double **, double *);
void test_so3ToVec() {
  double so3[3][3] = {0, -3, 2, 3, 0, -1, -2, 1, 0};
  double omg[3] = {0};
  int i;
  so3ToVec(so3, omg);
  printf("so3:\n");
  for (i = 0; i < 3; i++) {
    printf("%lf %lf %lf\n", so3[i][0], so3[i][1], so3[i][2]);
  }
  printf("omg:\n");
  printf("%lf %lf %lf\n", omg[0], omg[1], omg[2]);
}


x86 assembly (clang, -O0):
<test_so3ToVec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <so3ToVec@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    122c <test_so3ToVec+0xfc>
movslq -0x74(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x74(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0x74(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xe1f(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11cb <test_so3ToVec+0x9b>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
lea    0xde6(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_so3ToVec>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movaps 0xea5(%rip),%xmm1
movups %xmm1,0x8(%rsp)
movabs $0x4008000000000000,%rax
mov    %rax,0x18(%rsp)
movaps 0xe9a(%rip),%xmm1
movups %xmm1,0x28(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x38(%rsp)
movaps %xmm0,0x50(%rsp)
movq   $0x0,0x60(%rsp)
mov    %rsp,%rdi
lea    0x50(%rsp),%rsi
call   1040 <so3ToVec@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0xe57(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
lea    0xe20(%rip),%rdi
call   1030 <puts@plt>
movsd  0x50(%rsp),%xmm0
movsd  0x58(%rsp),%xmm1
movsd  0x60(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

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

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