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


x86 assembly (clang, -O0):
<test_VecToso3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0xebe(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
lea    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <VecToso3@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
lea    0xe81(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    121a <test_VecToso3+0xea>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xe19(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11b9 <test_VecToso3+0x89>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_VecToso3>:
push   %rbx
sub    $0x70,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x60(%rsp)
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
call   1030 <VecToso3@plt>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0xe7b(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
mov    %rbx,%rdi
mov    $0x3,%al
call   1050 <printf@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):
@__const.test_VecToso3.omg = [3 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00]
@.str = [6 x i8] c"omg:\0A\00"
@.str.1 = [13 x i8] c"%lf %lf %lf\0A\00"
@.str.2 = [6 x i8] c"so3:\0A\00"
define void @test_VecToso3() {
%1 = alloca [3 x double]
%2 = alloca [3 x [3 x double]]
%3 = alloca i32
%4 = bitcast [3 x double]* %1 to i8*
%5 = bitcast [3 x [3 x double]]* %2 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%8 = bitcast [3 x double]* %7 to double**
%9 = call i32 @VecToso3(double* %6, double** %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%12 = load double, double* %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%16 = load double, double* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %12, double %14, double %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %19
19: ; preds = %39, %0
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %42
22: ; preds = %19
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 %24
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%27 = load double, double* %26
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 %29
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 1
%32 = load double, double* %31
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 %34
%36 = getelementptr inbounds [3 x double], [3 x double]* %35, i64 0, i64 2
%37 = load double, double* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %27, double %32, double %37)
br label %39
39: ; preds = %22
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %19
42: ; preds = %19
ret void
}

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