#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*/ Rot2Euler(float *, float *);
int /*<<< orphan*/ print(float *, int, int);
int /*<<< orphan*/ printf(char *);
void QuatLibtest(void) {
  printf("Quat Library Test \n");
  printf("Quat2Rot Test:\n");
  printf("Rot2Euler Test:\n");
  float rotMat[3][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
  float eulerAngles[3];
  Rot2Euler((float *)rotMat, (float *)eulerAngles);
  printf("Rotation Matrix is \n");
  print((float *)rotMat, 3, 3);
  printf("Euler Angles are: \n");
  print((float *)eulerAngles, 3, 1);
  printf("QuatMultiply Test:\n");
  printf("Euler2Quat Test:\n");
  printf("Rodrigues Test:\n");
  printf("IntegrateEuler Test:\n");
}


x86 assembly (clang, -O0):
<QuatLibtest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movss  0xe7c(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xe6f(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe62(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
call   1060 <Rot2Euler@plt>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1050 <print@plt>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x3c(%rbp),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
call   1050 <print@plt>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuatLibtest>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x3f800000,(%rsp)
movl   $0x3f800000,0x10(%rsp)
3f
movl   $0x3f800000,0x20(%rsp)
3f
mov    %rsp,%rbx
lea    0x2c(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <Rot2Euler@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <print@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x1,%edx
call   1040 <print@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Quat Library Test \0A\00"
@.str.1 = [16 x i8] c"Quat2Rot Test:\0A\00"
@.str.2 = [17 x i8] c"Rot2Euler Test:\0A\00"
@.str.3 = [21 x i8] c"Rotation Matrix is \0A\00"
@.str.4 = [20 x i8] c"Euler Angles are: \0A\00"
@.str.5 = [20 x i8] c"QuatMultiply Test:\0A\00"
@.str.6 = [18 x i8] c"Euler2Quat Test:\0A\00"
@.str.7 = [17 x i8] c"Rodrigues Test:\0A\00"
@.str.8 = [22 x i8] c"IntegrateEuler Test:\0A\00"
define void @QuatLibtest() {
%1 = alloca [3 x [3 x float]]
%2 = alloca [3 x float]
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%6 = bitcast [3 x [3 x float]]* %1 to i8*
%7 = bitcast i8* %6 to [3 x [3 x float]]*
%8 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %7, i32 0, i32 0
%9 = getelementptr inbounds [3 x float], [3 x float]* %8, i32 0, i32 0
store float 1.000000e+00, float* %9
%10 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %7, i32 0, i32 1
%11 = getelementptr inbounds [3 x float], [3 x float]* %10, i32 0, i32 1
store float 1.000000e+00, float* %11
%12 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %7, i32 0, i32 2
%13 = getelementptr inbounds [3 x float], [3 x float]* %12, i32 0, i32 2
store float 1.000000e+00, float* %13
%14 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %1, i64 0, i64 0
%15 = bitcast [3 x float]* %14 to float*
%16 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%17 = call i32 @Rot2Euler(float* %15, float* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %1, i64 0, i64 0
%20 = bitcast [3 x float]* %19 to float*
%21 = call i32 @print(float* %20, i32 3, i32 3)
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%23 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%24 = call i32 @print(float* %23, i32 3, i32 1)
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Quat Library Test \00"
@str.9 = [15 x i8] c"Quat2Rot Test:\00"
@str.10 = [16 x i8] c"Rot2Euler Test:\00"
@str.11 = [20 x i8] c"Rotation Matrix is \00"
@str.12 = [19 x i8] c"Euler Angles are: \00"
@str.13 = [19 x i8] c"QuatMultiply Test:\00"
@str.14 = [17 x i8] c"Euler2Quat Test:\00"
@str.15 = [16 x i8] c"Rodrigues Test:\00"
@str.16 = [21 x i8] c"IntegrateEuler Test:\00"
define void @QuatLibtest() {
%1 = alloca [3 x [3 x float]]
%2 = alloca [3 x float]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.10, i64 0, i64 0))
%6 = bitcast [3 x [3 x float]]* %1 to i8*
%7 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %1, i64 0, i64 0, i64 0
store float 1.000000e+00, float* %7
%8 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %1, i64 0, i64 1, i64 1
store float 1.000000e+00, float* %8
%9 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %1, i64 0, i64 2, i64 2
store float 1.000000e+00, float* %9
%10 = bitcast [3 x float]* %2 to i8*
%11 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%12 = call i32 @Rot2Euler(float* %7, float* %11)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
%14 = call i32 @print(float* %7, i32 3, i32 3)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
%16 = call i32 @print(float* %11, i32 3, i32 1)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.15, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0))
ret void
}