#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*/ MatrixExp6(double **, double **);
int /*<<< orphan*/ printf(char *, ...);
void test_MatrixExp6() {
  double se3Mat[4][4] = {0, 0,        0, 0,      0, 0, -1.570796, 2.3562,
                         0, 1.570796, 0, 2.3562, 0, 0, 0,         0};
  double T[4][4];
  MatrixExp6(se3Mat, T);
  int i;
  printf("T:\n");
  for (i = 0; i < 4; i++) {
    printf("%lf %lf %lf %lf\n", T[i][0], T[i][1], T[i][2], T[i][3]);
  }
  return;
}


x86 assembly (clang, -O0):
<test_MatrixExp6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1030 <MatrixExp6@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0x4,-0x104(%rbp)
jge    123d <test_MatrixExp6+0x10d>
movslq -0x104(%rbp),%rcx
lea    -0x100(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x104(%rbp),%rcx
lea    -0x100(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0x104(%rbp),%rcx
lea    -0x100(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
movslq -0x104(%rbp),%rcx
lea    -0x100(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x18(%rax),%xmm3
lea    0xdfa(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    11a7 <test_MatrixExp6+0x77>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_MatrixExp6>:
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movabs $0x3ff921fafc8b007a,%rax
21 f9 3f
mov    %rax,0xc8(%rsp)
movabs $0x4002d97f62b6ae7d,%rax
d9 02 40
mov    %rax,0xd8(%rsp)
lea    0x80(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <MatrixExp6@plt>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
lea    0xe30(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%al
call   1050 <printf@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
mov    %rbx,%rdi
mov    $0x4,%al
call   1050 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x58(%rsp),%xmm3
mov    %rbx,%rdi
mov    $0x4,%al
call   1050 <printf@plt>
movsd  0x60(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
movsd  0x70(%rsp),%xmm2
movsd  0x78(%rsp),%xmm3
mov    %rbx,%rdi
mov    $0x4,%al
call   1050 <printf@plt>
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [17 x i8] c"%lf %lf %lf %lf\0A\00"
@str = [3 x i8] c"T:\00"
define void @test_MatrixExp6() {
%1 = alloca [4 x [4 x double]]
%2 = alloca [4 x [4 x double]]
%3 = bitcast [4 x [4 x double]]* %1 to i8*
%4 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %1, i64 0, i64 1, i64 2
%5 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 0xBFF921FAFC8B007A, double 2.356200e+00>, <2 x double>* %5
%6 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %1, i64 0, i64 2, i64 1
store double 0x3FF921FAFC8B007A, double* %6
%7 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %1, i64 0, i64 2, i64 3
store double 2.356200e+00, double* %7
%8 = bitcast [4 x [4 x double]]* %2 to i8*
%9 = bitcast [4 x [4 x double]]* %1 to double**
%10 = bitcast [4 x [4 x double]]* %2 to double**
%11 = call i32 @MatrixExp6(double** %9, double** %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%13 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 0, i64 0
%14 = load double, double* %13
%15 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 0, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 0, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 0, i64 3
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %14, double %16, double %18, double %20)
%22 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 1, i64 0
%23 = load double, double* %22
%24 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 1, i64 1
%25 = load double, double* %24
%26 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 1, i64 2
%27 = load double, double* %26
%28 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 1, i64 3
%29 = load double, double* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %23, double %25, double %27, double %29)
%31 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 2, i64 0
%32 = load double, double* %31
%33 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 2, i64 1
%34 = load double, double* %33
%35 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 2, i64 2
%36 = load double, double* %35
%37 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 2, i64 3
%38 = load double, double* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %32, double %34, double %36, double %38)
%40 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 3, i64 0
%41 = load double, double* %40
%42 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 3, i64 1
%43 = load double, double* %42
%44 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 3, i64 2
%45 = load double, double* %44
%46 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 3, i64 3
%47 = load double, double* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %41, double %43, double %45, double %47)
ret void
}