#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 VRotationMatrix(double roll, double pitch, double yaw, double rot[3][3]) {
  double cr, cy, cp, sr, sy, sp;
  cr = cos(roll);
  cp = cos(pitch);
  cy = cos(yaw);
  sr = sin(roll);
  sp = sin(pitch);
  sy = sin(yaw);
  rot[0][0] = cr * cy + sr * sp * sy;
  rot[0][1] = sr * cp;
  rot[0][2] = sr * sp * cy - sy * cr;
  rot[1][0] = cr * sp * sy - sr * cy;
  rot[1][1] = cr * cp;
  rot[1][2] = sr * sy + cy * cr * sp;
  rot[2][0] = cp * sy;
  rot[2][1] = -sp;
  rot[2][2] = cp * cy;
}


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

x86 assembly (clang, -O2):
<VRotationMatrix>:
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x50(%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 0x20(%rsp),%xmm4
movapd %xmm4,%xmm1
movapd 0x40(%rsp),%xmm7
unpcklpd %xmm7,%xmm1
movapd 0x10(%rsp),%xmm9
movapd %xmm9,%xmm2
unpcklpd %xmm9,%xmm2
mulpd  %xmm1,%xmm2
movapd 0x50(%rsp),%xmm6
movapd %xmm6,%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
mulsd  %xmm0,%xmm2
movapd %xmm7,%xmm3
mulsd  %xmm6,%xmm3
addsd  %xmm3,%xmm2
movsd  %xmm2,(%rbx)
movsd  0x38(%rsp),%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x8(%rbx)
movapd %xmm0,%xmm2
unpcklpd %xmm4,%xmm2
movapd %xmm4,%xmm8
movapd %xmm7,%xmm4
unpcklpd %xmm6,%xmm4
mulpd  %xmm2,%xmm4
subpd  %xmm4,%xmm1
movupd %xmm1,0x10(%rbx)
movapd %xmm7,%xmm1
mulsd  %xmm5,%xmm1
movsd  %xmm1,0x20(%rbx)
movapd %xmm9,%xmm1
mulsd  %xmm9,%xmm3
movapd %xmm8,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,0x28(%rbx)
mulsd  %xmm5,%xmm0
xorpd  0xdb7(%rip),%xmm1
movsd  %xmm0,0x30(%rbx)
movlpd %xmm1,0x38(%rbx)
mulsd  %xmm6,%xmm5
movsd  %xmm5,0x40(%rbx)
add    $0x60,%rsp
pop    %rbx
ret

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