#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 glmGenerateRotationMatrixFromAngles4dRad(double matrix[16], double a1,
                                              double a2, double a3) {
  double sr, sp, sy, cr, cp, cy;
  sy = sin(a3);
  cy = cos(a3);
  sp = sin(a2);
  cp = cos(a2);
  sr = sin(a1);
  cr = cos(a1);
  matrix[0] = cp * cy;
  matrix[1] = cp * sy;
  matrix[2] = -sp;
  matrix[3] = 0;
  matrix[4] = sr * sp * cy + cr * -sy;
  matrix[5] = sr * sp * sy + cr * cy;
  matrix[6] = sr * cp;
  matrix[7] = 0;
  matrix[8] = (cr * sp * cy + -sr * -sy);
  matrix[9] = (cr * sp * sy + -sr * cy);
  matrix[10] = cr * cp;
  matrix[11] = 0;
  matrix[12] = 0.0;
  matrix[13] = 0.0;
  matrix[14] = 0.0;
  matrix[15] = 1;
}


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

x86 assembly (clang, -O2):
<glmGenerateRotationMatrixFromAngles4dRad>:
push   %rbx
sub    $0x60,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movaps %xmm2,%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x50(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movapd 0x40(%rsp),%xmm9
movapd %xmm9,%xmm1
movapd 0x50(%rsp),%xmm6
unpcklpd %xmm6,%xmm1
movapd 0x30(%rsp),%xmm7
movapd %xmm7,%xmm2
unpcklpd %xmm7,%xmm2
mulpd  %xmm1,%xmm2
movupd %xmm2,(%rbx)
movapd 0xe3a(%rip),%xmm2
movapd 0x20(%rsp),%xmm8
movapd %xmm8,%xmm3
xorpd  %xmm2,%xmm3
movlpd %xmm3,0x10(%rbx)
movq   $0x0,0x18(%rbx)
movapd %xmm8,%xmm3
movapd 0x10(%rsp),%xmm11
mulsd  %xmm11,%xmm3
movapd %xmm6,%xmm4
movapd %xmm6,%xmm10
xorpd  %xmm2,%xmm4
movapd %xmm7,%xmm5
movapd %xmm7,%xmm6
mulsd  %xmm0,%xmm8
mulsd  %xmm0,%xmm6
unpcklpd %xmm0,%xmm0
unpcklpd %xmm9,%xmm4
mulpd  %xmm0,%xmm4
unpcklpd %xmm3,%xmm3
mulpd  %xmm1,%xmm3
addpd  %xmm4,%xmm3
movupd %xmm3,0x20(%rbx)
movapd %xmm11,%xmm3
mulsd  %xmm11,%xmm5
movsd  %xmm5,0x30(%rbx)
movq   $0x0,0x38(%rbx)
xorpd  %xmm11,%xmm2
movapd %xmm10,%xmm0
unpcklpd %xmm9,%xmm0
unpcklpd %xmm2,%xmm3
mulpd  %xmm0,%xmm3
movapd %xmm8,%xmm0
unpcklpd %xmm8,%xmm0
mulpd  %xmm1,%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,0x40(%rbx)
movsd  %xmm6,0x50(%rbx)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x58(%rbx)
movupd %xmm0,0x68(%rbx)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x78(%rbx)
add    $0x60,%rsp
pop    %rbx
ret

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

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