#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 */
double cos(double const);
double sin(double const);
void rpy_to_T44(const double rpy_xyz[6], double T44[4][4]) {
  T44[0][3] = rpy_xyz[3];
  T44[1][3] = rpy_xyz[4];
  T44[2][3] = rpy_xyz[5];
  T44[3][3] = 1;
  double c_r = cos(rpy_xyz[0]);
  double c_p = cos(rpy_xyz[1]);
  double c_y = cos(rpy_xyz[2]);
  double s_r = sin(rpy_xyz[0]);
  double s_p = sin(rpy_xyz[1]);
  double s_y = sin(rpy_xyz[2]);
  T44[0][0] = c_y * c_p;
  T44[0][1] = c_y * s_p * s_r - s_y * c_r;
  T44[0][2] = c_y * s_p * c_r + s_y * s_r;
  T44[1][0] = s_y * c_p;
  T44[1][1] = s_y * s_p * s_r + c_y * c_r;
  T44[1][2] = s_y * s_p * c_r - c_y * s_r;
  T44[2][0] = -s_p;
  T44[2][1] = c_p * s_r;
  T44[2][2] = c_p * c_r;
}


x86 assembly (clang, -O0):
<rpy_to_T44>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x58(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,0x78(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x48(%rax)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x50(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpy_to_T44>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
movsd  0x20(%rdi),%xmm0
movsd  %xmm0,0x38(%rsi)
movsd  0x28(%rdi),%xmm0
movsd  %xmm0,0x58(%rsi)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x78(%rsi)
movsd  (%rdi),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x8(%rbx),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x10(%rbx),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x8(%rbx),%xmm0
call   1030 <sin@plt>
movaps %xmm0,(%rsp)
movsd  0x10(%rbx),%xmm0
call   1030 <sin@plt>
movapd 0x30(%rsp),%xmm5
movapd %xmm5,%xmm1
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  %xmm1,(%r14)
movapd %xmm3,%xmm2
movapd %xmm3,%xmm9
movapd (%rsp),%xmm7
mulsd  %xmm7,%xmm2
movapd 0xe21(%rip),%xmm8
movapd %xmm0,%xmm3
xorpd  %xmm8,%xmm3
movapd 0x40(%rsp),%xmm1
movapd %xmm1,%xmm4
movapd 0x20(%rsp),%xmm6
unpcklpd %xmm6,%xmm4
unpcklpd %xmm0,%xmm3
mulpd  %xmm4,%xmm3
unpcklpd %xmm2,%xmm2
unpcklpd %xmm1,%xmm6
mulpd  %xmm6,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,0x8(%r14)
movapd %xmm5,%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x20(%r14)
mulsd  %xmm7,%xmm0
movapd %xmm9,%xmm3
movapd %xmm9,%xmm2
xorpd  %xmm8,%xmm2
unpcklpd %xmm2,%xmm3
mulpd  %xmm4,%xmm3
unpcklpd %xmm0,%xmm0
mulpd  %xmm6,%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,0x28(%r14)
movapd %xmm7,%xmm0
xorpd  %xmm8,%xmm0
movlpd %xmm0,0x40(%r14)
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
mulpd  %xmm6,%xmm0
movupd %xmm0,0x48(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rpy_to_T44(double* %0, [4 x double]* %1) {
%3 = alloca double*
%4 = alloca [4 x double]*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %3
store [4 x double]* %1, [4 x double]** %4
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 3
%13 = load double, double* %12
%14 = load [4 x double]*, [4 x double]** %4
%15 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0
%16 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 3
store double %13, double* %16
%17 = load double*, double** %3
%18 = getelementptr inbounds double, double* %17, i64 4
%19 = load double, double* %18
%20 = load [4 x double]*, [4 x double]** %4
%21 = getelementptr inbounds [4 x double], [4 x double]* %20, i64 1
%22 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 3
store double %19, double* %22
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 5
%25 = load double, double* %24
%26 = load [4 x double]*, [4 x double]** %4
%27 = getelementptr inbounds [4 x double], [4 x double]* %26, i64 2
%28 = getelementptr inbounds [4 x double], [4 x double]* %27, i64 0, i64 3
store double %25, double* %28
%29 = load [4 x double]*, [4 x double]** %4
%30 = getelementptr inbounds [4 x double], [4 x double]* %29, i64 3
%31 = getelementptr inbounds [4 x double], [4 x double]* %30, i64 0, i64 3
store double 1.000000e+00, double* %31
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 0
%34 = load double, double* %33
%35 = call double @cos(double %34)
store double %35, double* %5
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
%39 = call double @cos(double %38)
store double %39, double* %6
%40 = load double*, double** %3
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = call double @cos(double %42)
store double %43, double* %7
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = call double @sin(double %46)
store double %47, double* %8
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = call double @sin(double %50)
store double %51, double* %9
%52 = load double*, double** %3
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = call double @sin(double %54)
store double %55, double* %10
%56 = load double, double* %7
%57 = load double, double* %6
%58 = fmul double %56, %57
%59 = load [4 x double]*, [4 x double]** %4
%60 = getelementptr inbounds [4 x double], [4 x double]* %59, i64 0
%61 = getelementptr inbounds [4 x double], [4 x double]* %60, i64 0, i64 0
store double %58, double* %61
%62 = load double, double* %7
%63 = load double, double* %9
%64 = fmul double %62, %63
%65 = load double, double* %8
%66 = load double, double* %10
%67 = load double, double* %5
%68 = fmul double %66, %67
%69 = fneg double %68
%70 = call double @llvm.fmuladd.f64(double %64, double %65, double %69)
%71 = load [4 x double]*, [4 x double]** %4
%72 = getelementptr inbounds [4 x double], [4 x double]* %71, i64 0
%73 = getelementptr inbounds [4 x double], [4 x double]* %72, i64 0, i64 1
store double %70, double* %73
%74 = load double, double* %7
%75 = load double, double* %9
%76 = fmul double %74, %75
%77 = load double, double* %5
%78 = load double, double* %10
%79 = load double, double* %8
%80 = fmul double %78, %79
%81 = call double @llvm.fmuladd.f64(double %76, double %77, double %80)
%82 = load [4 x double]*, [4 x double]** %4
%83 = getelementptr inbounds [4 x double], [4 x double]* %82, i64 0
%84 = getelementptr inbounds [4 x double], [4 x double]* %83, i64 0, i64 2
store double %81, double* %84
%85 = load double, double* %10
%86 = load double, double* %6
%87 = fmul double %85, %86
%88 = load [4 x double]*, [4 x double]** %4
%89 = getelementptr inbounds [4 x double], [4 x double]* %88, i64 1
%90 = getelementptr inbounds [4 x double], [4 x double]* %89, i64 0, i64 0
store double %87, double* %90
%91 = load double, double* %10
%92 = load double, double* %9
%93 = fmul double %91, %92
%94 = load double, double* %8
%95 = load double, double* %7
%96 = load double, double* %5
%97 = fmul double %95, %96
%98 = call double @llvm.fmuladd.f64(double %93, double %94, double %97)
%99 = load [4 x double]*, [4 x double]** %4
%100 = getelementptr inbounds [4 x double], [4 x double]* %99, i64 1
%101 = getelementptr inbounds [4 x double], [4 x double]* %100, i64 0, i64 1
store double %98, double* %101
%102 = load double, double* %10
%103 = load double, double* %9
%104 = fmul double %102, %103
%105 = load double, double* %5
%106 = load double, double* %7
%107 = load double, double* %8
%108 = fmul double %106, %107
%109 = fneg double %108
%110 = call double @llvm.fmuladd.f64(double %104, double %105, double %109)
%111 = load [4 x double]*, [4 x double]** %4
%112 = getelementptr inbounds [4 x double], [4 x double]* %111, i64 1
%113 = getelementptr inbounds [4 x double], [4 x double]* %112, i64 0, i64 2
store double %110, double* %113
%114 = load double, double* %9
%115 = fneg double %114
%116 = load [4 x double]*, [4 x double]** %4
%117 = getelementptr inbounds [4 x double], [4 x double]* %116, i64 2
%118 = getelementptr inbounds [4 x double], [4 x double]* %117, i64 0, i64 0
store double %115, double* %118
%119 = load double, double* %6
%120 = load double, double* %8
%121 = fmul double %119, %120
%122 = load [4 x double]*, [4 x double]** %4
%123 = getelementptr inbounds [4 x double], [4 x double]* %122, i64 2
%124 = getelementptr inbounds [4 x double], [4 x double]* %123, i64 0, i64 1
store double %121, double* %124
%125 = load double, double* %6
%126 = load double, double* %5
%127 = fmul double %125, %126
%128 = load [4 x double]*, [4 x double]** %4
%129 = getelementptr inbounds [4 x double], [4 x double]* %128, i64 2
%130 = getelementptr inbounds [4 x double], [4 x double]* %129, i64 0, i64 2
store double %127, double* %130
ret void
}

LLVM IR (-O2):
define void @rpy_to_T44(double* nocapture %0, [4 x double]* nocapture writeonly %1) {
%3 = getelementptr inbounds double, double* %0, i64 3
%4 = load double, double* %3
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 3
store double %4, double* %5
%6 = getelementptr inbounds double, double* %0, i64 4
%7 = load double, double* %6
%8 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
store double %7, double* %8
%9 = getelementptr inbounds double, double* %0, i64 5
%10 = load double, double* %9
%11 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
store double %10, double* %11
%12 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
store double 1.000000e+00, double* %12
%13 = load double, double* %0
%14 = tail call double @cos(double %13)
%15 = getelementptr inbounds double, double* %0, i64 1
%16 = load double, double* %15
%17 = tail call double @cos(double %16)
%18 = getelementptr inbounds double, double* %0, i64 2
%19 = load double, double* %18
%20 = tail call double @cos(double %19)
%21 = load double, double* %0
%22 = tail call double @sin(double %21)
%23 = load double, double* %15
%24 = tail call double @sin(double %23)
%25 = load double, double* %18
%26 = tail call double @sin(double %25)
%27 = fmul double %17, %20
%28 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
store double %27, double* %28
%29 = fmul double %20, %24
%30 = fneg double %26
%31 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
%32 = insertelement <2 x double> poison, double %14, i64 0
%33 = insertelement <2 x double> %32, double %22, i64 1
%34 = insertelement <2 x double> poison, double %30, i64 0
%35 = insertelement <2 x double> %34, double %26, i64 1
%36 = fmul <2 x double> %33, %35
%37 = insertelement <2 x double> poison, double %29, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = insertelement <2 x double> poison, double %22, i64 0
%40 = insertelement <2 x double> %39, double %14, i64 1
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %38, <2 x double> %40, <2 x double> %36)
%42 = bitcast double* %31 to <2 x double>*
store <2 x double> %41, <2 x double>* %42
%43 = fmul double %17, %26
%44 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 0
store double %43, double* %44
%45 = fmul double %24, %26
%46 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
%47 = fneg double %20
%48 = insertelement <2 x double> poison, double %20, i64 0
%49 = insertelement <2 x double> %48, double %47, i64 1
%50 = fmul <2 x double> %33, %49
%51 = insertelement <2 x double> poison, double %45, i64 0
%52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
%53 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %52, <2 x double> %40, <2 x double> %50)
%54 = bitcast double* %46 to <2 x double>*
store <2 x double> %53, <2 x double>* %54
%55 = fneg double %24
%56 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
store double %55, double* %56
%57 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
%58 = insertelement <2 x double> poison, double %17, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = fmul <2 x double> %40, %59
%61 = bitcast double* %57 to <2 x double>*
store <2 x double> %60, <2 x double>* %61
ret void
}