#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*/ Matrix3Mult(double **, double **, double **);
int /*<<< orphan*/ TransToRp(double **, double **, double *);
int /*<<< orphan*/ VecToso3(double *, double **);
void Adjoint(double T[4][4], double AdT[6][6]) {
  double R[3][3];
  double p[3];
  double so3Mat[3][3];
  int i;
  int j;
  TransToRp(T, R, p);
  VecToso3(p, so3Mat);
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      AdT[i][j] = R[i][j];
    }
  }
  for (i = 0; i < 3; i++) {
    for (j = 3; j < 6; j++) {
      AdT[i][j] = 0.0;
    }
  }
  for (i = 3; i < 6; i++) {
    for (j = 3; j < 6; j++) {
      AdT[i][j] = R[i - 3][j - 3];
    }
  }
  double mat[3][3];
  Matrix3Mult(so3Mat, R, mat);
  for (i = 3; i < 6; i++) {
    for (j = 0; j < 3; j++) {
      AdT[i][j] = mat[i - 3][j];
    }
  }
  return;
}


x86 assembly (clang, -O0):
<Adjoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1040 <TransToRp@plt>
lea    -0x80(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1030 <VecToso3@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x3,-0xd4(%rbp)
jge    11fb <Adjoint+0xcb>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x3,-0xd8(%rbp)
jge    11e2 <Adjoint+0xb2>
movslq -0xd4(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1185 <Adjoint+0x55>
jmp    11e7 <Adjoint+0xb7>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    116e <Adjoint+0x3e>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x3,-0xd4(%rbp)
jge    1277 <Adjoint+0x147>
movl   $0x3,-0xd8(%rbp)
cmpl   $0x6,-0xd8(%rbp)
jge    125e <Adjoint+0x12e>
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    121c <Adjoint+0xec>
jmp    1263 <Adjoint+0x133>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1205 <Adjoint+0xd5>
movl   $0x3,-0xd4(%rbp)
cmpl   $0x6,-0xd4(%rbp)
jge    1318 <Adjoint+0x1e8>
movl   $0x3,-0xd8(%rbp)
cmpl   $0x6,-0xd8(%rbp)
jge    12ff <Adjoint+0x1cf>
mov    -0xd4(%rbp),%eax
sub    $0x3,%eax
movslq %eax,%rcx
lea    -0x60(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    -0xd8(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1298 <Adjoint+0x168>
jmp    1304 <Adjoint+0x1d4>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1281 <Adjoint+0x151>
lea    -0xd0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1050 <Matrix3Mult@plt>
movl   $0x3,-0xd4(%rbp)
cmpl   $0x6,-0xd4(%rbp)
jge    13ce <Adjoint+0x29e>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x3,-0xd8(%rbp)
jge    13b5 <Adjoint+0x285>
mov    -0xd4(%rbp),%eax
sub    $0x3,%eax
movslq %eax,%rcx
lea    -0x120(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1350 <Adjoint+0x220>
jmp    13ba <Adjoint+0x28a>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1339 <Adjoint+0x209>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Adjoint>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
mov    %rsp,%r14
lea    0xa0(%rsp),%r12
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <TransToRp@plt>
lea    0xc0(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <VecToso3@plt>
mov    0x10(%rsp),%rax
mov    %rax,0x10(%rbx)
movaps (%rsp),%xmm0
movups %xmm0,(%rbx)
mov    0x28(%rsp),%rax
mov    %rax,0x40(%rbx)
movups 0x18(%rsp),%xmm0
movups %xmm0,0x30(%rbx)
movaps 0x30(%rsp),%xmm0
movups %xmm0,0x60(%rbx)
mov    0x40(%rsp),%rax
mov    %rax,0x70(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rbx)
movq   $0x0,0x28(%rbx)
movups %xmm0,0x48(%rbx)
movq   $0x0,0x58(%rbx)
movups %xmm0,0x78(%rbx)
movq   $0x0,0x88(%rbx)
mov    0x10(%rsp),%rax
mov    %rax,0xb8(%rbx)
movaps (%rsp),%xmm0
movups %xmm0,0xa8(%rbx)
movups 0x18(%rsp),%xmm0
movups %xmm0,0xd8(%rbx)
mov    0x28(%rsp),%rax
mov    %rax,0xe8(%rbx)
movaps 0x30(%rsp),%xmm0
movups %xmm0,0x108(%rbx)
mov    0x40(%rsp),%rax
mov    %rax,0x118(%rbx)
lea    0x50(%rsp),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <Matrix3Mult@plt>
mov    0x60(%rsp),%rax
mov    %rax,0xa0(%rbx)
movaps 0x50(%rsp),%xmm0
movups %xmm0,0x90(%rbx)
movups 0x68(%rsp),%xmm0
movups %xmm0,0xc0(%rbx)
mov    0x78(%rsp),%rax
mov    %rax,0xd0(%rbx)
mov    0x90(%rsp),%rax
mov    %rax,0x100(%rbx)
movaps 0x80(%rsp),%xmm0
movups %xmm0,0xf0(%rbx)
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Adjoint([4 x double]* %0, [6 x double]* %1) {
%3 = alloca [4 x double]*
%4 = alloca [6 x double]*
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x double]
%7 = alloca [3 x [3 x double]]
%8 = alloca i32
%9 = alloca i32
%10 = alloca [3 x [3 x double]]
store [4 x double]* %0, [4 x double]** %3
store [6 x double]* %1, [6 x double]** %4
%11 = load [4 x double]*, [4 x double]** %3
%12 = bitcast [4 x double]* %11 to double**
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%14 = bitcast [3 x double]* %13 to double**
%15 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%16 = call i32 @TransToRp(double** %12, double** %14, double* %15)
%17 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%19 = bitcast [3 x double]* %18 to double**
%20 = call i32 @VecToso3(double* %17, double** %19)
store i32 0, i32* %8
br label %21
21: ; preds = %47, %2
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %50
24: ; preds = %21
store i32 0, i32* %9
br label %25
25: ; preds = %43, %24
%26 = load i32, i32* %9
%27 = icmp slt i32 %26, 3
br i1 %27, label %28, label %46
28: ; preds = %25
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %30
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 %33
%35 = load double, double* %34
%36 = load [6 x double]*, [6 x double]** %4
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [6 x double], [6 x double]* %36, i64 %38
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [6 x double], [6 x double]* %39, i64 0, i64 %41
store double %35, double* %42
br label %43
43: ; preds = %28
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %25
46: ; preds = %25
br label %47
47: ; preds = %46
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %21
50: ; preds = %21
store i32 0, i32* %8
br label %51
51: ; preds = %70, %50
%52 = load i32, i32* %8
%53 = icmp slt i32 %52, 3
br i1 %53, label %54, label %73
54: ; preds = %51
store i32 3, i32* %9
br label %55
55: ; preds = %66, %54
%56 = load i32, i32* %9
%57 = icmp slt i32 %56, 6
br i1 %57, label %58, label %69
58: ; preds = %55
%59 = load [6 x double]*, [6 x double]** %4
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [6 x double], [6 x double]* %59, i64 %61
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [6 x double], [6 x double]* %62, i64 0, i64 %64
store double 0.000000e+00, double* %65
br label %66
66: ; preds = %58
%67 = load i32, i32* %9
%68 = add nsw i32 %67, 1
store i32 %68, i32* %9
br label %55
69: ; preds = %55
br label %70
70: ; preds = %69
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %51
73: ; preds = %51
store i32 3, i32* %8
br label %74
74: ; preds = %102, %73
%75 = load i32, i32* %8
%76 = icmp slt i32 %75, 6
br i1 %76, label %77, label %105
77: ; preds = %74
store i32 3, i32* %9
br label %78
78: ; preds = %98, %77
%79 = load i32, i32* %9
%80 = icmp slt i32 %79, 6
br i1 %80, label %81, label %101
81: ; preds = %78
%82 = load i32, i32* %8
%83 = sub nsw i32 %82, 3
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %84
%86 = load i32, i32* %9
%87 = sub nsw i32 %86, 3
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [3 x double], [3 x double]* %85, i64 0, i64 %88
%90 = load double, double* %89
%91 = load [6 x double]*, [6 x double]** %4
%92 = load i32, i32* %8
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [6 x double], [6 x double]* %91, i64 %93
%95 = load i32, i32* %9
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [6 x double], [6 x double]* %94, i64 0, i64 %96
store double %90, double* %97
br label %98
98: ; preds = %81
%99 = load i32, i32* %9
%100 = add nsw i32 %99, 1
store i32 %100, i32* %9
br label %78
101: ; preds = %78
br label %102
102: ; preds = %101
%103 = load i32, i32* %8
%104 = add nsw i32 %103, 1
store i32 %104, i32* %8
br label %74
105: ; preds = %74
%106 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%107 = bitcast [3 x double]* %106 to double**
%108 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%109 = bitcast [3 x double]* %108 to double**
%110 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%111 = bitcast [3 x double]* %110 to double**
%112 = call i32 @Matrix3Mult(double** %107, double** %109, double** %111)
store i32 3, i32* %8
br label %113
113: ; preds = %140, %105
%114 = load i32, i32* %8
%115 = icmp slt i32 %114, 6
br i1 %115, label %116, label %143
116: ; preds = %113
store i32 0, i32* %9
br label %117
117: ; preds = %136, %116
%118 = load i32, i32* %9
%119 = icmp slt i32 %118, 3
br i1 %119, label %120, label %139
120: ; preds = %117
%121 = load i32, i32* %8
%122 = sub nsw i32 %121, 3
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 %123
%125 = load i32, i32* %9
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [3 x double], [3 x double]* %124, i64 0, i64 %126
%128 = load double, double* %127
%129 = load [6 x double]*, [6 x double]** %4
%130 = load i32, i32* %8
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [6 x double], [6 x double]* %129, i64 %131
%133 = load i32, i32* %9
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [6 x double], [6 x double]* %132, i64 0, i64 %134
store double %128, double* %135
br label %136
136: ; preds = %120
%137 = load i32, i32* %9
%138 = add nsw i32 %137, 1
store i32 %138, i32* %9
br label %117
139: ; preds = %117
br label %140
140: ; preds = %139
%141 = load i32, i32* %8
%142 = add nsw i32 %141, 1
store i32 %142, i32* %8
br label %113
143: ; preds = %113
ret void
}

LLVM IR (-O2):
define void @Adjoint([4 x double]* %0, [6 x double]* nocapture writeonly %1) {
%3 = alloca [3 x [3 x double]]
%4 = alloca [3 x double]
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x [3 x double]]
%7 = bitcast [3 x [3 x double]]* %3 to i8*
%8 = bitcast [3 x double]* %4 to i8*
%9 = bitcast [3 x [3 x double]]* %5 to i8*
%10 = bitcast [4 x double]* %0 to double**
%11 = bitcast [3 x [3 x double]]* %3 to double**
%12 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%13 = call i32 @TransToRp(double** %10, double** %11, double* %12)
%14 = bitcast [3 x [3 x double]]* %5 to double**
%15 = call i32 @VecToso3(double* %12, double** %14)
%16 = bitcast [6 x double]* %1 to i8*
%17 = bitcast [3 x [3 x double]]* %3 to i8*
%18 = getelementptr [6 x double], [6 x double]* %1, i64 1, i64 0
%19 = bitcast double* %18 to i8*
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 1, i64 0
%21 = bitcast double* %20 to i8*
%22 = getelementptr [6 x double], [6 x double]* %1, i64 2, i64 0
%23 = bitcast double* %22 to i8*
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 2, i64 0
%25 = bitcast double* %24 to i8*
%26 = getelementptr [6 x double], [6 x double]* %1, i64 0, i64 3
%27 = bitcast double* %26 to i8*
%28 = getelementptr [6 x double], [6 x double]* %1, i64 1, i64 3
%29 = bitcast double* %28 to i8*
%30 = getelementptr [6 x double], [6 x double]* %1, i64 2, i64 3
%31 = bitcast double* %30 to i8*
%32 = getelementptr [6 x double], [6 x double]* %1, i64 3, i64 3
%33 = bitcast double* %32 to i8*
%34 = getelementptr [6 x double], [6 x double]* %1, i64 4, i64 3
%35 = bitcast double* %34 to i8*
%36 = getelementptr [6 x double], [6 x double]* %1, i64 5, i64 3
%37 = bitcast double* %36 to i8*
%38 = bitcast [3 x [3 x double]]* %6 to i8*
%39 = bitcast [3 x [3 x double]]* %6 to double**
%40 = call i32 @Matrix3Mult(double** %14, double** %11, double** %39)
%41 = getelementptr [6 x double], [6 x double]* %1, i64 3, i64 0
%42 = bitcast double* %41 to i8*
%43 = bitcast [3 x [3 x double]]* %6 to i8*
%44 = getelementptr [6 x double], [6 x double]* %1, i64 4, i64 0
%45 = bitcast double* %44 to i8*
%46 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 1, i64 0
%47 = bitcast double* %46 to i8*
%48 = getelementptr [6 x double], [6 x double]* %1, i64 5, i64 0
%49 = bitcast double* %48 to i8*
%50 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 2, i64 0
%51 = bitcast double* %50 to i8*
ret void
}