#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 glmRadd(double);
double sin(double);
void glmGenerateRotationMatrixFromAngles4dDeg(double matrix[16], double a1,
                                              double a2, double a3) {
  double sr, sp, sy, cr, cp, cy;
  a1 = glmRadd(a1);
  a2 = glmRadd(a2);
  a3 = glmRadd(a3);
  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):
<glmGenerateRotationMatrixFromAngles4dDeg>:
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  -0x10(%rbp),%xmm0
call   1030 <glmRadd@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <glmRadd@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <glmRadd@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <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  0xc5e(%rip),%xmm0
movsd  %xmm0,0x78(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateRotationMatrixFromAngles4dDeg>:
push   %rbx
sub    $0x60,%rsp
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,(%rsp)
mov    %rdi,%rbx
call   1030 <glmRadd@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1030 <glmRadd@plt>
movsd  %xmm0,(%rsp)
movsd  0x30(%rsp),%xmm0
call   1030 <glmRadd@plt>
movsd  %xmm0,0x20(%rsp)
call   1040 <sin@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x50(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movapd 0x50(%rsp),%xmm9
movapd %xmm9,%xmm1
movapd 0x30(%rsp),%xmm6
unpcklpd %xmm6,%xmm1
movapd 0x40(%rsp),%xmm7
movapd %xmm7,%xmm2
unpcklpd %xmm7,%xmm2
mulpd  %xmm1,%xmm2
movupd %xmm2,(%rbx)
movapd 0xe0c(%rip),%xmm2
movapd 0x20(%rsp),%xmm8
movapd %xmm8,%xmm3
xorpd  %xmm2,%xmm3
movlpd %xmm3,0x10(%rbx)
movq   $0x0,0x18(%rbx)
movapd %xmm8,%xmm3
movapd (%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 @glmGenerateRotationMatrixFromAngles4dDeg(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* %6
%16 = call double @glmRadd(double %15)
store double %16, double* %6
%17 = load double, double* %7
%18 = call double @glmRadd(double %17)
store double %18, double* %7
%19 = load double, double* %8
%20 = call double @glmRadd(double %19)
store double %20, double* %8
%21 = load double, double* %8
%22 = call double @sin(double %21)
store double %22, double* %11
%23 = load double, double* %8
%24 = call double @cos(double %23)
store double %24, double* %14
%25 = load double, double* %7
%26 = call double @sin(double %25)
store double %26, double* %10
%27 = load double, double* %7
%28 = call double @cos(double %27)
store double %28, double* %13
%29 = load double, double* %6
%30 = call double @sin(double %29)
store double %30, double* %9
%31 = load double, double* %6
%32 = call double @cos(double %31)
store double %32, double* %12
%33 = load double, double* %13
%34 = load double, double* %14
%35 = fmul double %33, %34
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i64 0
store double %35, double* %37
%38 = load double, double* %13
%39 = load double, double* %11
%40 = fmul double %38, %39
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
%43 = load double, double* %10
%44 = fneg double %43
%45 = load double*, double** %5
%46 = getelementptr inbounds double, double* %45, i64 2
store double %44, double* %46
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 3
store double 0.000000e+00, double* %48
%49 = load double, double* %9
%50 = load double, double* %10
%51 = fmul double %49, %50
%52 = load double, double* %14
%53 = load double, double* %12
%54 = load double, double* %11
%55 = fneg double %54
%56 = fmul double %53, %55
%57 = call double @llvm.fmuladd.f64(double %51, double %52, double %56)
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 4
store double %57, double* %59
%60 = load double, double* %9
%61 = load double, double* %10
%62 = fmul double %60, %61
%63 = load double, double* %11
%64 = load double, double* %12
%65 = load double, double* %14
%66 = fmul double %64, %65
%67 = call double @llvm.fmuladd.f64(double %62, double %63, double %66)
%68 = load double*, double** %5
%69 = getelementptr inbounds double, double* %68, i64 5
store double %67, double* %69
%70 = load double, double* %9
%71 = load double, double* %13
%72 = fmul double %70, %71
%73 = load double*, double** %5
%74 = getelementptr inbounds double, double* %73, i64 6
store double %72, double* %74
%75 = load double*, double** %5
%76 = getelementptr inbounds double, double* %75, i64 7
store double 0.000000e+00, double* %76
%77 = load double, double* %12
%78 = load double, double* %10
%79 = fmul double %77, %78
%80 = load double, double* %14
%81 = load double, double* %9
%82 = fneg double %81
%83 = load double, double* %11
%84 = fneg double %83
%85 = fmul double %82, %84
%86 = call double @llvm.fmuladd.f64(double %79, double %80, double %85)
%87 = load double*, double** %5
%88 = getelementptr inbounds double, double* %87, i64 8
store double %86, double* %88
%89 = load double, double* %12
%90 = load double, double* %10
%91 = fmul double %89, %90
%92 = load double, double* %11
%93 = load double, double* %9
%94 = fneg double %93
%95 = load double, double* %14
%96 = fmul double %94, %95
%97 = call double @llvm.fmuladd.f64(double %91, double %92, double %96)
%98 = load double*, double** %5
%99 = getelementptr inbounds double, double* %98, i64 9
store double %97, double* %99
%100 = load double, double* %12
%101 = load double, double* %13
%102 = fmul double %100, %101
%103 = load double*, double** %5
%104 = getelementptr inbounds double, double* %103, i64 10
store double %102, double* %104
%105 = load double*, double** %5
%106 = getelementptr inbounds double, double* %105, i64 11
store double 0.000000e+00, double* %106
%107 = load double*, double** %5
%108 = getelementptr inbounds double, double* %107, i64 12
store double 0.000000e+00, double* %108
%109 = load double*, double** %5
%110 = getelementptr inbounds double, double* %109, i64 13
store double 0.000000e+00, double* %110
%111 = load double*, double** %5
%112 = getelementptr inbounds double, double* %111, i64 14
store double 0.000000e+00, double* %112
%113 = load double*, double** %5
%114 = getelementptr inbounds double, double* %113, i64 15
store double 1.000000e+00, double* %114
ret void
}

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