#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 RPYToRot(double roll, double pitch, double yaw, double R[3][3]) {
  double alpha = yaw;
  double beta = pitch;
  double gamma = roll;
  R[0][0] = cos(alpha) * cos(beta);
  R[0][1] = cos(alpha) * sin(beta) * sin(gamma) - sin(alpha) * cos(gamma);
  R[0][2] = cos(alpha) * sin(beta) * cos(gamma) + sin(alpha) * sin(gamma);
  R[1][0] = sin(alpha) * cos(beta);
  R[1][1] = sin(alpha) * sin(beta) * sin(gamma) + cos(alpha) * cos(gamma);
  R[1][2] = sin(alpha) * sin(beta) * cos(gamma) - cos(alpha) * sin(gamma);
  R[2][0] = -sin(beta);
  R[2][1] = cos(beta) * sin(gamma);
  R[2][2] = cos(beta) * cos(gamma);
  return;
}


x86 assembly (clang, -O0):
<RPYToRot>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  -0xc0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x40(%rax)
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RPYToRot>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
movaps %xmm2,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x18(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rbx)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
xorps  0xcbe(%rip),%xmm0
movlps %xmm0,0x30(%rbx)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x38(%rbx)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

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

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