void glmGenerateInertiaMatrixForCylinder4f(float m[16], float r, float h,
                                           float mass) {
  m[0] = (1.0f / 12.0f) * mass * h * h + (1.0f / 4.0f) * mass * r * r;
  m[4] = 0;
  m[8] = 0;
  m[12] = 0;
  m[1] = 0;
  m[5] = (1.0f / 12.0f) * mass * h * h + (1.0f / 4.0f) * mass * r * r;
  m[9] = 0;
  m[13] = 0;
  m[2] = 0;
  m[6] = 0;
  m[10] = 0.5f * mass * r * r;
  m[14] = 0;
  m[3] = 0;
  m[7] = 0;
  m[11] = 0;
  m[15] = 1;
}


x86 assembly (clang, -O0):
<glmGenerateInertiaMatrixForCylinder4f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  0xeed(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  0xed2(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
movss  0xe7f(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  0xe64(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x24(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x34(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rax)
movss  0xe08(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x2c(%rax)
mov    -0x8(%rbp),%rax
movss  0xdb0(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateInertiaMatrixForCylinder4f>:
movss  0xef8(%rip),%xmm3
mulss  %xmm2,%xmm3
mulss  %xmm1,%xmm3
movss  0xeec(%rip),%xmm4
mulss  %xmm2,%xmm4
mulss  %xmm0,%xmm4
mulss  %xmm0,%xmm4
mulss  %xmm1,%xmm3
addss  %xmm4,%xmm3
movss  %xmm3,(%rdi)
movss  %xmm3,0x14(%rdi)
mulss  0xecb(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
movss  %xmm2,0x28(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x4(%rdi)
movups %xmm0,0x18(%rdi)
movups %xmm0,0x2c(%rdi)
movl   $0x3f800000,0x3c(%rdi)
ret

LLVM IR (-O0):
define void @glmGenerateInertiaMatrixForCylinder4f(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %8
%10 = fmul float 0x3FB5555560000000, %9
%11 = load float, float* %7
%12 = fmul float %10, %11
%13 = load float, float* %7
%14 = load float, float* %8
%15 = fmul float 2.500000e-01, %14
%16 = load float, float* %6
%17 = fmul float %15, %16
%18 = load float, float* %6
%19 = fmul float %17, %18
%20 = call float @llvm.fmuladd.f32(float %12, float %13, float %19)
%21 = load float*, float** %5
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float*, float** %5
%24 = getelementptr inbounds float, float* %23, i64 4
store float 0.000000e+00, float* %24
%25 = load float*, float** %5
%26 = getelementptr inbounds float, float* %25, i64 8
store float 0.000000e+00, float* %26
%27 = load float*, float** %5
%28 = getelementptr inbounds float, float* %27, i64 12
store float 0.000000e+00, float* %28
%29 = load float*, float** %5
%30 = getelementptr inbounds float, float* %29, i64 1
store float 0.000000e+00, float* %30
%31 = load float, float* %8
%32 = fmul float 0x3FB5555560000000, %31
%33 = load float, float* %7
%34 = fmul float %32, %33
%35 = load float, float* %7
%36 = load float, float* %8
%37 = fmul float 2.500000e-01, %36
%38 = load float, float* %6
%39 = fmul float %37, %38
%40 = load float, float* %6
%41 = fmul float %39, %40
%42 = call float @llvm.fmuladd.f32(float %34, float %35, float %41)
%43 = load float*, float** %5
%44 = getelementptr inbounds float, float* %43, i64 5
store float %42, float* %44
%45 = load float*, float** %5
%46 = getelementptr inbounds float, float* %45, i64 9
store float 0.000000e+00, float* %46
%47 = load float*, float** %5
%48 = getelementptr inbounds float, float* %47, i64 13
store float 0.000000e+00, float* %48
%49 = load float*, float** %5
%50 = getelementptr inbounds float, float* %49, i64 2
store float 0.000000e+00, float* %50
%51 = load float*, float** %5
%52 = getelementptr inbounds float, float* %51, i64 6
store float 0.000000e+00, float* %52
%53 = load float, float* %8
%54 = fmul float 5.000000e-01, %53
%55 = load float, float* %6
%56 = fmul float %54, %55
%57 = load float, float* %6
%58 = fmul float %56, %57
%59 = load float*, float** %5
%60 = getelementptr inbounds float, float* %59, i64 10
store float %58, float* %60
%61 = load float*, float** %5
%62 = getelementptr inbounds float, float* %61, i64 14
store float 0.000000e+00, float* %62
%63 = load float*, float** %5
%64 = getelementptr inbounds float, float* %63, i64 3
store float 0.000000e+00, float* %64
%65 = load float*, float** %5
%66 = getelementptr inbounds float, float* %65, i64 7
store float 0.000000e+00, float* %66
%67 = load float*, float** %5
%68 = getelementptr inbounds float, float* %67, i64 11
store float 0.000000e+00, float* %68
%69 = load float*, float** %5
%70 = getelementptr inbounds float, float* %69, i64 15
store float 1.000000e+00, float* %70
ret void
}

LLVM IR (-O2):
define void @glmGenerateInertiaMatrixForCylinder4f(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = fmul float %3, 0x3FB5555560000000
%6 = fmul float %5, %2
%7 = fmul float %3, 2.500000e-01
%8 = fmul float %7, %1
%9 = fmul float %8, %1
%10 = tail call float @llvm.fmuladd.f32(float %6, float %2, float %9)
store float %10, float* %0
%11 = getelementptr inbounds float, float* %0, i64 1
%12 = getelementptr inbounds float, float* %0, i64 5
store float %10, float* %12
%13 = getelementptr inbounds float, float* %0, i64 6
%14 = fmul float %3, 5.000000e-01
%15 = fmul float %14, %1
%16 = fmul float %15, %1
%17 = getelementptr inbounds float, float* %0, i64 10
store float %16, float* %17
%18 = bitcast float* %11 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %18
%19 = bitcast float* %13 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %19
%20 = getelementptr inbounds float, float* %0, i64 11
%21 = bitcast float* %20 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %21
%22 = getelementptr inbounds float, float* %0, i64 15
store float 1.000000e+00, float* %22
ret void
}