#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 Rmq(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] + ctet * spsi * Vin[1] - stet * Vin[2];
  Vout[1] = (cpsi * sphi * stet - cphi * spsi) * Vin[0] +
            (cphi * cpsi + sphi * spsi * stet) * Vin[1] + ctet * sphi * Vin[2];
  Vout[2] = (sphi * spsi + cphi * cpsi * stet) * Vin[0] +
            (cphi * spsi * stet - cpsi * stet) * Vin[1] + cphi * ctet * Vin[2];
}


x86 assembly (clang, -O0):
<Rmq>:
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  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%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  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm3
mulsd  -0x48(%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  -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):
<Rmq>:
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,0x18(%rsp)
movsd  0x10(%rbx),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rbx),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rbx),%xmm0
call   1030 <sin@plt>
movsd  0x18(%rsp),%xmm3
movapd %xmm3,%xmm1
movsd  0x10(%rsp),%xmm7
mulsd  %xmm7,%xmm1
movapd %xmm3,%xmm2
movapd %xmm3,%xmm8
mulsd  %xmm0,%xmm2
mulsd  0x8(%r15),%xmm2
mulsd  (%r15),%xmm1
addsd  %xmm2,%xmm1
movsd  0x10(%r15),%xmm2
movsd  0x8(%rsp),%xmm4
mulsd  %xmm4,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%r14)
movapd %xmm7,%xmm3
movsd  0x20(%rsp),%xmm6
mulsd  %xmm6,%xmm3
movsd  0x28(%rsp),%xmm5
movapd %xmm5,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm4,%xmm3
mulsd  %xmm6,%xmm0
movapd %xmm4,%xmm9
mulsd  %xmm0,%xmm4
movapd %xmm5,%xmm2
mulsd  %xmm7,%xmm2
addsd  %xmm2,%xmm4
mulsd  0x8(%r15),%xmm4
subsd  %xmm1,%xmm3
mulsd  (%r15),%xmm3
addsd  %xmm4,%xmm3
movapd %xmm6,%xmm4
mulsd  %xmm8,%xmm4
mulsd  0x10(%r15),%xmm4
addsd  %xmm3,%xmm4
movsd  %xmm4,0x8(%r14)
mulsd  %xmm9,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm7,%xmm0
mulsd  %xmm9,%xmm0
mulsd  %xmm9,%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%r15),%xmm1
mulsd  (%r15),%xmm2
addsd  %xmm1,%xmm2
movapd %xmm5,%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 @Rmq(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* %9
%44 = load double, double* %10
%45 = fmul double %43, %44
%46 = load double*, double** %5
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = fmul double %45, %48
%50 = call double @llvm.fmuladd.f64(double %39, double %42, double %49)
%51 = load double, double* %12
%52 = load double*, double** %5
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = fneg double %51
%56 = call double @llvm.fmuladd.f64(double %55, double %54, double %50)
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
store double %56, double* %58
%59 = load double, double* %7
%60 = load double, double* %11
%61 = fmul double %59, %60
%62 = load double, double* %12
%63 = load double, double* %8
%64 = load double, double* %10
%65 = fmul double %63, %64
%66 = fneg double %65
%67 = call double @llvm.fmuladd.f64(double %61, double %62, double %66)
%68 = load double*, double** %5
%69 = getelementptr inbounds double, double* %68, i64 0
%70 = load double, double* %69
%71 = load double, double* %8
%72 = load double, double* %7
%73 = load double, double* %11
%74 = load double, double* %10
%75 = fmul double %73, %74
%76 = load double, double* %12
%77 = fmul double %75, %76
%78 = call double @llvm.fmuladd.f64(double %71, double %72, double %77)
%79 = load double*, double** %5
%80 = getelementptr inbounds double, double* %79, i64 1
%81 = load double, double* %80
%82 = fmul double %78, %81
%83 = call double @llvm.fmuladd.f64(double %67, double %70, double %82)
%84 = load double, double* %9
%85 = load double, double* %11
%86 = fmul double %84, %85
%87 = load double*, double** %5
%88 = getelementptr inbounds double, double* %87, i64 2
%89 = load double, double* %88
%90 = call double @llvm.fmuladd.f64(double %86, double %89, double %83)
%91 = load double*, double** %6
%92 = getelementptr inbounds double, double* %91, i64 1
store double %90, double* %92
%93 = load double, double* %11
%94 = load double, double* %10
%95 = load double, double* %8
%96 = load double, double* %7
%97 = fmul double %95, %96
%98 = load double, double* %12
%99 = fmul double %97, %98
%100 = call double @llvm.fmuladd.f64(double %93, double %94, double %99)
%101 = load double*, double** %5
%102 = getelementptr inbounds double, double* %101, i64 0
%103 = load double, double* %102
%104 = load double, double* %8
%105 = load double, double* %10
%106 = fmul double %104, %105
%107 = load double, double* %12
%108 = load double, double* %7
%109 = load double, double* %12
%110 = fmul double %108, %109
%111 = fneg double %110
%112 = call double @llvm.fmuladd.f64(double %106, double %107, double %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 %100, double %103, 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 @Rmq(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 %8, %17
%21 = getelementptr inbounds double, double* %1, i64 1
%22 = load double, double* %21
%23 = fmul double %20, %22
%24 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %23)
%25 = getelementptr inbounds double, double* %1, i64 2
%26 = load double, double* %25
%27 = fneg double %15
%28 = tail call double @llvm.fmuladd.f64(double %27, double %26, double %24)
store double %28, double* %2
%29 = fmul double %11, %13
%30 = fmul double %5, %17
%31 = fneg double %30
%32 = tail call double @llvm.fmuladd.f64(double %29, double %15, double %31)
%33 = load double, double* %1
%34 = fmul double %13, %17
%35 = fmul double %15, %34
%36 = tail call double @llvm.fmuladd.f64(double %5, double %11, double %35)
%37 = load double, double* %21
%38 = fmul double %36, %37
%39 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %38)
%40 = fmul double %8, %13
%41 = load double, double* %25
%42 = tail call double @llvm.fmuladd.f64(double %40, double %41, double %39)
%43 = getelementptr inbounds double, double* %2, i64 1
store double %42, double* %43
%44 = fmul double %5, %11
%45 = fmul double %44, %15
%46 = tail call double @llvm.fmuladd.f64(double %13, double %17, double %45)
%47 = load double, double* %1
%48 = fneg double %11
%49 = fmul double %15, %48
%50 = tail call double @llvm.fmuladd.f64(double %30, double %15, double %49)
%51 = load double, double* %21
%52 = fmul double %50, %51
%53 = tail call double @llvm.fmuladd.f64(double %46, double %47, double %52)
%54 = fmul double %5, %8
%55 = load double, double* %25
%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
}