#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 Rqm(double theta[3], double Vin[3], double Vout[3]) {
  double cpsi, cphi, ctet;
  double spsi, sphi, stet;
  cphi = cos(theta[0]);
  ctet = cos(theta[1]);
  cpsi = cos(theta[2]);
  sphi = sin(theta[0]);
  stet = sin(theta[1]);
  spsi = sin(theta[2]);
  Vout[0] = cpsi * ctet * Vin[0] + (cpsi * sphi * stet - cphi * spsi) * Vin[1] +
            (sphi * spsi + cphi * cpsi * stet) * Vin[2];
  Vout[1] = ctet * spsi * Vin[0] + (cphi * cpsi + sphi * spsi * stet) * Vin[1] +
            (cphi * spsi * stet - cpsi * stet) * Vin[2];
  Vout[2] = -stet * Vin[0] + ctet * sphi * Vin[1] + cphi * ctet * Vin[2];
}


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

x86 assembly (clang, -O2):
<Rqm>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rbx),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rbx),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rbx),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rbx),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rbx),%xmm0
call   1030 <sin@plt>
movsd  0x20(%rsp),%xmm8
movapd %xmm8,%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm2
movapd %xmm1,%xmm3
movapd %xmm1,%xmm10
movsd  0x10(%rsp),%xmm7
mulsd  %xmm7,%xmm3
movsd  0x28(%rsp),%xmm6
movapd %xmm6,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm5
mulsd  %xmm5,%xmm3
subsd  %xmm1,%xmm3
mulsd  0x8(%r15),%xmm3
mulsd  (%r15),%xmm2
addsd  %xmm3,%xmm2
movapd %xmm6,%xmm3
movapd %xmm6,%xmm9
mulsd  %xmm10,%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm5,%xmm4
movapd %xmm5,%xmm6
movapd %xmm7,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm5,%xmm4
mulsd  0x10(%r15),%xmm4
addsd  %xmm2,%xmm4
movsd  %xmm4,(%r14)
mulsd  %xmm8,%xmm0
mulsd  %xmm6,%xmm5
addsd  %xmm3,%xmm5
mulsd  0x8(%r15),%xmm5
mulsd  (%r15),%xmm0
addsd  %xmm5,%xmm0
movapd %xmm6,%xmm2
mulsd  %xmm6,%xmm10
mulsd  %xmm6,%xmm1
subsd  %xmm10,%xmm1
mulsd  0x10(%r15),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14)
movapd %xmm7,%xmm0
mulsd  %xmm8,%xmm0
mulsd  0x8(%r15),%xmm0
mulsd  (%r15),%xmm2
subsd  %xmm2,%xmm0
movapd %xmm0,%xmm2
movapd %xmm9,%xmm0
mulsd  %xmm8,%xmm0
mulsd  0x10(%r15),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @Rqm(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = tail call double @cos(double %4)
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = tail call double @cos(double %7)
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = tail call double @cos(double %10)
%12 = load double, double* %0
%13 = tail call double @sin(double %12)
%14 = load double, double* %6
%15 = tail call double @sin(double %14)
%16 = load double, double* %9
%17 = tail call double @sin(double %16)
%18 = fmul double %8, %11
%19 = load double, double* %1
%20 = fmul double %11, %13
%21 = fmul double %5, %17
%22 = fneg double %21
%23 = tail call double @llvm.fmuladd.f64(double %20, double %15, double %22)
%24 = getelementptr inbounds double, double* %1, i64 1
%25 = load double, double* %24
%26 = fmul double %23, %25
%27 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %26)
%28 = fmul double %5, %11
%29 = fmul double %28, %15
%30 = tail call double @llvm.fmuladd.f64(double %13, double %17, double %29)
%31 = getelementptr inbounds double, double* %1, i64 2
%32 = load double, double* %31
%33 = tail call double @llvm.fmuladd.f64(double %30, double %32, double %27)
store double %33, double* %2
%34 = fmul double %8, %17
%35 = load double, double* %1
%36 = fmul double %13, %17
%37 = fmul double %15, %36
%38 = tail call double @llvm.fmuladd.f64(double %5, double %11, double %37)
%39 = load double, double* %24
%40 = fmul double %38, %39
%41 = tail call double @llvm.fmuladd.f64(double %34, double %35, double %40)
%42 = fneg double %11
%43 = fmul double %15, %42
%44 = tail call double @llvm.fmuladd.f64(double %21, double %15, double %43)
%45 = load double, double* %31
%46 = tail call double @llvm.fmuladd.f64(double %44, double %45, double %41)
%47 = getelementptr inbounds double, double* %2, i64 1
store double %46, double* %47
%48 = fneg double %15
%49 = load double, double* %1
%50 = fmul double %8, %13
%51 = load double, double* %24
%52 = fmul double %50, %51
%53 = tail call double @llvm.fmuladd.f64(double %48, double %49, double %52)
%54 = fmul double %5, %8
%55 = load double, double* %31
%56 = tail call double @llvm.fmuladd.f64(double %54, double %55, double %53)
%57 = getelementptr inbounds double, double* %2, i64 2
store double %56, double* %57
ret void
}