#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*/ Matrix3MultValue(double **, double, double **);
int /*<<< orphan*/ Matrix3MultVec(double **, double *, double *);
int /*<<< orphan*/ RotInv(double **, double **);
int /*<<< orphan*/ RpToTrans(double **, double *, double **);
int /*<<< orphan*/ TransToRp(double **, double **, double *);
void TransInv(double T[4][4], double InvT[4][4]) {
  double R[3][3];
  double InvR[3][3];
  double p[3];
  double p2[3];
  TransToRp(T, R, p);
  RotInv(R, InvR);
  Matrix3MultValue(InvR, -1.0, R);
  Matrix3MultVec(R, p, p2);
  RpToTrans(InvR, p2, InvT);
  return;
}


x86 assembly (clang, -O0):
<TransInv>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   1030 <TransToRp@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1050 <RotInv@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
movsd  0xe66(%rip),%xmm0
call   1070 <Matrix3MultValue@plt>
lea    -0x60(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
call   1040 <Matrix3MultVec@plt>
lea    -0xb0(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1060 <RpToTrans@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TransInv>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe0,%rsp
mov    %rsi,%r14
lea    0x90(%rsp),%rbx
lea    0x20(%rsp),%r15
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <TransToRp@plt>
lea    0x40(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <RotInv@plt>
movsd  0xe6d(%rip),%xmm0
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <Matrix3MultValue@plt>
mov    %rsp,%r13
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1040 <Matrix3MultVec@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <RpToTrans@plt>
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @TransInv([4 x double]* %0, [4 x double]* %1) {
%3 = alloca [4 x double]*
%4 = alloca [4 x double]*
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x [3 x double]]
%7 = alloca [3 x double]
%8 = alloca [3 x double]
store [4 x double]* %0, [4 x double]** %3
store [4 x double]* %1, [4 x double]** %4
%9 = load [4 x double]*, [4 x double]** %3
%10 = bitcast [4 x double]* %9 to double**
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%12 = bitcast [3 x double]* %11 to double**
%13 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%14 = call i32 @TransToRp(double** %10, double** %12, double* %13)
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%16 = bitcast [3 x double]* %15 to double**
%17 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 0
%18 = bitcast [3 x double]* %17 to double**
%19 = call i32 @RotInv(double** %16, double** %18)
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 0
%21 = bitcast [3 x double]* %20 to double**
%22 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%23 = bitcast [3 x double]* %22 to double**
%24 = call i32 @Matrix3MultValue(double** %21, double -1.000000e+00, double** %23)
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%26 = bitcast [3 x double]* %25 to double**
%27 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%28 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%29 = call i32 @Matrix3MultVec(double** %26, double* %27, double* %28)
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 0
%31 = bitcast [3 x double]* %30 to double**
%32 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%33 = load [4 x double]*, [4 x double]** %4
%34 = bitcast [4 x double]* %33 to double**
%35 = call i32 @RpToTrans(double** %31, double* %32, double** %34)
ret void
}

LLVM IR (-O2):
define void @TransInv([4 x double]* %0, [4 x double]* %1) {
%3 = alloca [3 x [3 x double]]
%4 = alloca [3 x [3 x double]]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x [3 x double]]* %3 to i8*
%8 = bitcast [3 x [3 x double]]* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = bitcast [3 x double]* %6 to i8*
%11 = bitcast [4 x double]* %0 to double**
%12 = bitcast [3 x [3 x double]]* %3 to double**
%13 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%14 = call i32 @TransToRp(double** %11, double** %12, double* %13)
%15 = bitcast [3 x [3 x double]]* %4 to double**
%16 = call i32 @RotInv(double** %12, double** %15)
%17 = call i32 @Matrix3MultValue(double** %15, double -1.000000e+00, double** %12)
%18 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%19 = call i32 @Matrix3MultVec(double** %12, double* %13, double* %18)
%20 = bitcast [4 x double]* %1 to double**
%21 = call i32 @RpToTrans(double** %15, double* %18, double** %20)
ret void
}