#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 setUpRotationMatrix(double rotationMatrix[3][3], double angle, double u,
                         double v, double w) {
  double ca = cos(angle);
  double sa = sin(angle);
  double cam = 1 - ca;
  rotationMatrix[0][0] = u * u * cam + ca;
  rotationMatrix[0][1] = u * v * cam - w * sa;
  rotationMatrix[0][2] = u * w * cam + v * sa;
  rotationMatrix[1][0] = u * v * cam + w * sa;
  rotationMatrix[1][1] = v * v * cam + ca;
  rotationMatrix[1][2] = v * w * cam - u * sa;
  rotationMatrix[2][0] = u * w * cam - v * sa;
  rotationMatrix[2][1] = v * w * cam + u * sa;
  rotationMatrix[2][2] = w * w * cam + ca;
}


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

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

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

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