void glmGenerateInertiaMatrixForBox4f(float m[16], float x, float y, float z,
                                      float mass) {
  mass /= 12.0f;
  m[0] = mass * (y * y + z * z);
  m[4] = 0;
  m[8] = 0;
  m[12] = 0;
  m[1] = 0;
  m[5] = mass * (x * x + z * z);
  m[9] = 0;
  m[13] = 0;
  m[2] = 0;
  m[6] = 0;
  m[10] = mass * (x * x + y * y);
  m[14] = 0;
  m[3] = 0;
  m[7] = 0;
  m[11] = 0;
  m[15] = 1;
}


x86 assembly (clang, -O0):
<glmGenerateInertiaMatrixForBox4f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xedb(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm3
movss  -0x14(%rbp),%xmm2
mulss  -0x14(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %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  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x14(%rbp),%xmm2
mulss  -0x14(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %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  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x10(%rbp),%xmm2
mulss  -0x10(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%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  0xda9(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateInertiaMatrixForBox4f>:
divss  0xef8(%rip),%xmm3
mulss  %xmm2,%xmm2
mulss  %xmm1,%xmm1
movaps %xmm1,%xmm4
addss  %xmm2,%xmm4
mulss  %xmm3,%xmm4
movss  %xmm4,(%rdi)
mulss  %xmm0,%xmm0
addss  %xmm0,%xmm2
mulss  %xmm3,%xmm2
movss  %xmm2,0x14(%rdi)
addss  %xmm1,%xmm0
mulss  %xmm3,%xmm0
movss  %xmm0,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 @glmGenerateInertiaMatrixForBox4f(float* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float, float* %10
%12 = fdiv float %11, 1.200000e+01
store float %12, float* %10
%13 = load float, float* %10
%14 = load float, float* %8
%15 = load float, float* %8
%16 = load float, float* %9
%17 = load float, float* %9
%18 = fmul float %16, %17
%19 = call float @llvm.fmuladd.f32(float %14, float %15, float %18)
%20 = fmul float %13, %19
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float*, float** %6
%24 = getelementptr inbounds float, float* %23, i64 4
store float 0.000000e+00, float* %24
%25 = load float*, float** %6
%26 = getelementptr inbounds float, float* %25, i64 8
store float 0.000000e+00, float* %26
%27 = load float*, float** %6
%28 = getelementptr inbounds float, float* %27, i64 12
store float 0.000000e+00, float* %28
%29 = load float*, float** %6
%30 = getelementptr inbounds float, float* %29, i64 1
store float 0.000000e+00, float* %30
%31 = load float, float* %10
%32 = load float, float* %7
%33 = load float, float* %7
%34 = load float, float* %9
%35 = load float, float* %9
%36 = fmul float %34, %35
%37 = call float @llvm.fmuladd.f32(float %32, float %33, float %36)
%38 = fmul float %31, %37
%39 = load float*, float** %6
%40 = getelementptr inbounds float, float* %39, i64 5
store float %38, float* %40
%41 = load float*, float** %6
%42 = getelementptr inbounds float, float* %41, i64 9
store float 0.000000e+00, float* %42
%43 = load float*, float** %6
%44 = getelementptr inbounds float, float* %43, i64 13
store float 0.000000e+00, float* %44
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i64 2
store float 0.000000e+00, float* %46
%47 = load float*, float** %6
%48 = getelementptr inbounds float, float* %47, i64 6
store float 0.000000e+00, float* %48
%49 = load float, float* %10
%50 = load float, float* %7
%51 = load float, float* %7
%52 = load float, float* %8
%53 = load float, float* %8
%54 = fmul float %52, %53
%55 = call float @llvm.fmuladd.f32(float %50, float %51, float %54)
%56 = fmul float %49, %55
%57 = load float*, float** %6
%58 = getelementptr inbounds float, float* %57, i64 10
store float %56, float* %58
%59 = load float*, float** %6
%60 = getelementptr inbounds float, float* %59, i64 14
store float 0.000000e+00, float* %60
%61 = load float*, float** %6
%62 = getelementptr inbounds float, float* %61, i64 3
store float 0.000000e+00, float* %62
%63 = load float*, float** %6
%64 = getelementptr inbounds float, float* %63, i64 7
store float 0.000000e+00, float* %64
%65 = load float*, float** %6
%66 = getelementptr inbounds float, float* %65, i64 11
store float 0.000000e+00, float* %66
%67 = load float*, float** %6
%68 = getelementptr inbounds float, float* %67, i64 15
store float 1.000000e+00, float* %68
ret void
}

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