#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);
double sin(double);
void eulerDC(double tBL[3][3], double phi, double theta, double psi) {
  const double cpsi = cos(psi);
  const double cphi = cos(phi);
  const double ctheta = cos(theta);
  const double spsi = sin(psi);
  const double sphi = sin(phi);
  const double stheta = sin(theta);
  tBL[0][0] = cpsi * ctheta;
  tBL[0][1] = spsi * ctheta;
  tBL[0][2] = -stheta;
  tBL[1][0] = -spsi * cphi + cpsi * stheta * sphi;
  tBL[1][1] = cpsi * cphi + sphi * stheta * sphi;
  tBL[1][2] = ctheta * sphi;
  tBL[2][0] = spsi * sphi + cpsi * stheta * cphi;
  tBL[2][1] = -cpsi * sphi + spsi * stheta * cphi;
  tBL[2][2] = ctheta * cphi;
}


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

x86 assembly (clang, -O2):
<eulerDC>:
push   %rbx
sub    $0x60,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
movaps %xmm2,%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x50(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x30(%rsp),%xmm6
movapd %xmm6,%xmm1
unpcklpd %xmm6,%xmm1
movapd 0x40(%rsp),%xmm5
movapd %xmm5,%xmm2
movapd 0x20(%rsp),%xmm4
unpcklpd %xmm4,%xmm2
mulpd  %xmm1,%xmm2
movupd %xmm2,(%rbx)
movapd 0xe3b(%rip),%xmm8
movapd %xmm0,%xmm1
xorpd  %xmm8,%xmm1
movlpd %xmm1,0x10(%rbx)
movapd %xmm4,%xmm3
movapd %xmm4,%xmm10
xorpd  %xmm8,%xmm3
movapd %xmm5,%xmm4
movapd %xmm5,%xmm2
movapd 0x10(%rsp),%xmm7
unpcklpd %xmm7,%xmm4
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm4,%xmm1
movapd %xmm6,%xmm4
movapd %xmm6,%xmm9
mulsd  %xmm7,%xmm4
unpcklpd %xmm7,%xmm7
movapd %xmm7,%xmm5
movapd %xmm7,%xmm11
mulpd  %xmm1,%xmm5
unpcklpd %xmm2,%xmm3
movapd 0x50(%rsp),%xmm7
movapd %xmm7,%xmm6
unpcklpd %xmm7,%xmm6
mulpd  %xmm6,%xmm3
addpd  %xmm5,%xmm3
movupd %xmm3,0x18(%rbx)
movsd  %xmm4,0x28(%rbx)
xorpd  %xmm8,%xmm2
mulsd  %xmm10,%xmm0
unpcklpd %xmm0,%xmm1
mulpd  %xmm6,%xmm1
movapd %xmm10,%xmm0
unpcklpd %xmm2,%xmm0
mulpd  %xmm11,%xmm0
addpd  %xmm1,%xmm0
movupd %xmm0,0x30(%rbx)
movapd %xmm7,%xmm0
mulsd  %xmm9,%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @eulerDC([3 x double]* %0, double %1, double %2, double %3) {
%5 = alloca [3 x double]*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store [3 x double]* %0, [3 x double]** %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%15 = load double, double* %8
%16 = call double @cos(double %15)
store double %16, double* %9
%17 = load double, double* %6
%18 = call double @cos(double %17)
store double %18, double* %10
%19 = load double, double* %7
%20 = call double @cos(double %19)
store double %20, double* %11
%21 = load double, double* %8
%22 = call double @sin(double %21)
store double %22, double* %12
%23 = load double, double* %6
%24 = call double @sin(double %23)
store double %24, double* %13
%25 = load double, double* %7
%26 = call double @sin(double %25)
store double %26, double* %14
%27 = load double, double* %9
%28 = load double, double* %11
%29 = fmul double %27, %28
%30 = load [3 x double]*, [3 x double]** %5
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 0
store double %29, double* %32
%33 = load double, double* %12
%34 = load double, double* %11
%35 = fmul double %33, %34
%36 = load [3 x double]*, [3 x double]** %5
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0
%38 = getelementptr inbounds [3 x double], [3 x double]* %37, i64 0, i64 1
store double %35, double* %38
%39 = load double, double* %14
%40 = fneg double %39
%41 = load [3 x double]*, [3 x double]** %5
%42 = getelementptr inbounds [3 x double], [3 x double]* %41, i64 0
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 0, i64 2
store double %40, double* %43
%44 = load double, double* %12
%45 = fneg double %44
%46 = load double, double* %10
%47 = load double, double* %9
%48 = load double, double* %14
%49 = fmul double %47, %48
%50 = load double, double* %13
%51 = fmul double %49, %50
%52 = call double @llvm.fmuladd.f64(double %45, double %46, double %51)
%53 = load [3 x double]*, [3 x double]** %5
%54 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 1
%55 = getelementptr inbounds [3 x double], [3 x double]* %54, i64 0, i64 0
store double %52, double* %55
%56 = load double, double* %9
%57 = load double, double* %10
%58 = load double, double* %13
%59 = load double, double* %14
%60 = fmul double %58, %59
%61 = load double, double* %13
%62 = fmul double %60, %61
%63 = call double @llvm.fmuladd.f64(double %56, double %57, double %62)
%64 = load [3 x double]*, [3 x double]** %5
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 1
%66 = getelementptr inbounds [3 x double], [3 x double]* %65, i64 0, i64 1
store double %63, double* %66
%67 = load double, double* %11
%68 = load double, double* %13
%69 = fmul double %67, %68
%70 = load [3 x double]*, [3 x double]** %5
%71 = getelementptr inbounds [3 x double], [3 x double]* %70, i64 1
%72 = getelementptr inbounds [3 x double], [3 x double]* %71, i64 0, i64 2
store double %69, double* %72
%73 = load double, double* %12
%74 = load double, double* %13
%75 = load double, double* %9
%76 = load double, double* %14
%77 = fmul double %75, %76
%78 = load double, double* %10
%79 = fmul double %77, %78
%80 = call double @llvm.fmuladd.f64(double %73, double %74, double %79)
%81 = load [3 x double]*, [3 x double]** %5
%82 = getelementptr inbounds [3 x double], [3 x double]* %81, i64 2
%83 = getelementptr inbounds [3 x double], [3 x double]* %82, i64 0, i64 0
store double %80, double* %83
%84 = load double, double* %9
%85 = fneg double %84
%86 = load double, double* %13
%87 = load double, double* %12
%88 = load double, double* %14
%89 = fmul double %87, %88
%90 = load double, double* %10
%91 = fmul double %89, %90
%92 = call double @llvm.fmuladd.f64(double %85, double %86, double %91)
%93 = load [3 x double]*, [3 x double]** %5
%94 = getelementptr inbounds [3 x double], [3 x double]* %93, i64 2
%95 = getelementptr inbounds [3 x double], [3 x double]* %94, i64 0, i64 1
store double %92, double* %95
%96 = load double, double* %11
%97 = load double, double* %10
%98 = fmul double %96, %97
%99 = load [3 x double]*, [3 x double]** %5
%100 = getelementptr inbounds [3 x double], [3 x double]* %99, i64 2
%101 = getelementptr inbounds [3 x double], [3 x double]* %100, i64 0, i64 2
store double %98, double* %101
ret void
}

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