#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 */
float cos(float);
float sin(float);
void glmGenerateRotationMatrixFromAngles4fRad(float matrix[16], float a1,
                                              float a2, float a3) {
  float 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):
<glmGenerateRotationMatrixFromAngles4fRad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x28(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x28(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rax)
movss  -0x18(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
movss  -0x20(%rbp),%xmm3
movd   %xmm3,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x10(%rax)
movss  -0x18(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  -0x2c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x18(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rax)
movss  -0x24(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x20(%rbp),%xmm3
movd   %xmm3,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x20(%rax)
movss  -0x24(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  -0x2c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x24(%rax)
movss  -0x24(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x2c(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x34(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movss  0xccd(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateRotationMatrixFromAngles4fRad>:
push   %rbx
sub    $0x30,%rsp
movss  %xmm2,0x20(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
movaps %xmm2,%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x20(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movss  0x18(%rsp),%xmm5
movaps %xmm5,%xmm1
movss  0x14(%rsp),%xmm8
mulss  %xmm8,%xmm1
movss  %xmm1,(%rbx)
movss  0x1c(%rsp),%xmm4
movaps %xmm4,%xmm1
mulss  %xmm8,%xmm1
movss  %xmm1,0x4(%rbx)
movaps 0xe37(%rip),%xmm1
movaps 0x20(%rsp),%xmm7
xorps  %xmm7,%xmm1
movss  %xmm1,0x8(%rbx)
movaps %xmm7,%xmm1
movss  0xc(%rsp),%xmm9
mulss  %xmm9,%xmm1
movaps %xmm5,%xmm2
mulss  %xmm0,%xmm2
movaps %xmm8,%xmm3
mulss  %xmm0,%xmm7
mulss  %xmm0,%xmm8
mulss  %xmm4,%xmm0
movaps %xmm4,%xmm6
movaps %xmm1,%xmm4
mulss  %xmm5,%xmm4
subss  %xmm0,%xmm4
movl   $0x0,0xc(%rbx)
movss  %xmm4,0x10(%rbx)
movaps %xmm6,%xmm4
mulss  %xmm6,%xmm1
addss  %xmm2,%xmm1
movss  %xmm1,0x14(%rbx)
mulss  %xmm9,%xmm3
movss  %xmm3,0x18(%rbx)
movl   $0x0,0x1c(%rbx)
movaps %xmm4,%xmm0
mulss  %xmm9,%xmm0
movaps %xmm7,%xmm2
movaps %xmm7,%xmm1
mulss  %xmm5,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x20(%rbx)
movaps %xmm5,%xmm0
mulss  %xmm9,%xmm0
mulss  %xmm4,%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,0x24(%rbx)
movss  %xmm8,0x28(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x2c(%rbx)
movl   $0x3f800000,0x3c(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @glmGenerateRotationMatrixFromAngles4fRad(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = tail call float @sin(float %3)
%6 = tail call float @cos(float %3)
%7 = tail call float @sin(float %2)
%8 = tail call float @cos(float %2)
%9 = tail call float @sin(float %1)
%10 = tail call float @cos(float %1)
%11 = fmul float %6, %8
store float %11, float* %0
%12 = fmul float %5, %8
%13 = getelementptr inbounds float, float* %0, i64 1
store float %12, float* %13
%14 = fneg float %7
%15 = getelementptr inbounds float, float* %0, i64 2
store float %14, float* %15
%16 = getelementptr inbounds float, float* %0, i64 3
store float 0.000000e+00, float* %16
%17 = fmul float %7, %9
%18 = fneg float %5
%19 = fmul float %10, %18
%20 = tail call float @llvm.fmuladd.f32(float %17, float %6, float %19)
%21 = getelementptr inbounds float, float* %0, i64 4
store float %20, float* %21
%22 = fmul float %6, %10
%23 = tail call float @llvm.fmuladd.f32(float %17, float %5, float %22)
%24 = getelementptr inbounds float, float* %0, i64 5
store float %23, float* %24
%25 = fmul float %8, %9
%26 = getelementptr inbounds float, float* %0, i64 6
store float %25, float* %26
%27 = getelementptr inbounds float, float* %0, i64 7
store float 0.000000e+00, float* %27
%28 = fmul float %7, %10
%29 = fneg float %9
%30 = fmul float %5, %9
%31 = tail call float @llvm.fmuladd.f32(float %28, float %6, float %30)
%32 = getelementptr inbounds float, float* %0, i64 8
store float %31, float* %32
%33 = fmul float %6, %29
%34 = tail call float @llvm.fmuladd.f32(float %28, float %5, float %33)
%35 = getelementptr inbounds float, float* %0, i64 9
store float %34, float* %35
%36 = fmul float %8, %10
%37 = getelementptr inbounds float, float* %0, i64 10
store float %36, float* %37
%38 = getelementptr inbounds float, float* %0, i64 11
%39 = getelementptr inbounds float, float* %0, i64 15
%40 = bitcast float* %38 to i8*
store float 1.000000e+00, float* %39
ret void
}