void glmGenerateInertiaMatrixForTorus4f(float m[16], float a, float c,
                                        float mass) {
  m[0] = 0.125f * (5 * a * a + 4 * c * c) * mass;
  m[4] = 0;
  m[8] = 0;
  m[12] = 0;
  m[1] = 0;
  m[5] = 0.125f * (5 * a * a + 4 * c * c) * mass;
  m[9] = 0;
  m[13] = 0;
  m[2] = 0;
  m[6] = 0;
  m[10] = (0.75f * a * a + c * c) * mass;
  m[14] = 0;
  m[3] = 0;
  m[7] = 0;
  m[11] = 0;
  m[15] = 1;
}


x86 assembly (clang, -O0):
<glmGenerateInertiaMatrixForTorus4f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  0xef1(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  0xedb(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xebd(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  -0x14(%rbp),%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  0xe7c(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  0xe66(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe48(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  -0x14(%rbp),%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  0xdfa(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  -0x14(%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  0xd90(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
pop    %rbp
ret

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

LLVM IR (-O2):
define void @glmGenerateInertiaMatrixForTorus4f(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = fmul float %1, 5.000000e+00
%6 = fmul float %2, 4.000000e+00
%7 = fmul float %6, %2
%8 = tail call float @llvm.fmuladd.f32(float %5, float %1, float %7)
%9 = fmul float %8, 1.250000e-01
%10 = fmul float %9, %3
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 %1, 7.500000e-01
%15 = fmul float %2, %2
%16 = tail call float @llvm.fmuladd.f32(float %14, float %1, float %15)
%17 = fmul float %16, %3
%18 = getelementptr inbounds float, float* %0, i64 10
store float %17, float* %18
%19 = bitcast float* %11 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %19
%20 = bitcast float* %13 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
}