void glmGenerateInertiaMatrixForSphere4d(double m[16], double r, double mass) {
  mass *= 2.0 / 5.0;
  m[0] = mass * r * r;
  m[4] = 0;
  m[8] = 0;
  m[12] = 0;
  m[1] = 0;
  m[5] = mass * r * r;
  m[9] = 0;
  m[13] = 0;
  m[2] = 0;
  m[6] = 0;
  m[10] = mass * r * r;
  m[14] = 0;
  m[3] = 0;
  m[7] = 0;
  m[11] = 0;
  m[15] = 1;
}


x86 assembly (clang, -O0):
<glmGenerateInertiaMatrixForSphere4d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xeee(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x60(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x48(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x68(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x50(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x70(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x58(%rax)
mov    -0x8(%rbp),%rax
movsd  0xdf9(%rip),%xmm0
movsd  %xmm0,0x78(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateInertiaMatrixForSphere4d>:
mulsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi)
movsd  %xmm1,0x28(%rdi)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x40(%rdi)
movupd %xmm0,0x8(%rdi)
movsd  %xmm1,0x50(%rdi)
movupd %xmm0,0x68(%rdi)
movupd %xmm0,0x18(%rdi)
movupd %xmm0,0x30(%rdi)
movupd %xmm0,0x58(%rdi)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x78(%rdi)
ret

LLVM IR (-O0):
define void @glmGenerateInertiaMatrixForSphere4d(double* %0, double %1, double %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fmul double %7, 4.000000e-01
store double %8, double* %6
%9 = load double, double* %6
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = load double, double* %5
%13 = fmul double %11, %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 0
store double %13, double* %15
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 4
store double 0.000000e+00, double* %17
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 8
store double 0.000000e+00, double* %19
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 12
store double 0.000000e+00, double* %21
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 1
store double 0.000000e+00, double* %23
%24 = load double, double* %6
%25 = load double, double* %5
%26 = fmul double %24, %25
%27 = load double, double* %5
%28 = fmul double %26, %27
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 5
store double %28, double* %30
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 9
store double 0.000000e+00, double* %32
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 13
store double 0.000000e+00, double* %34
%35 = load double*, double** %4
%36 = getelementptr inbounds double, double* %35, i64 2
store double 0.000000e+00, double* %36
%37 = load double*, double** %4
%38 = getelementptr inbounds double, double* %37, i64 6
store double 0.000000e+00, double* %38
%39 = load double, double* %6
%40 = load double, double* %5
%41 = fmul double %39, %40
%42 = load double, double* %5
%43 = fmul double %41, %42
%44 = load double*, double** %4
%45 = getelementptr inbounds double, double* %44, i64 10
store double %43, double* %45
%46 = load double*, double** %4
%47 = getelementptr inbounds double, double* %46, i64 14
store double 0.000000e+00, double* %47
%48 = load double*, double** %4
%49 = getelementptr inbounds double, double* %48, i64 3
store double 0.000000e+00, double* %49
%50 = load double*, double** %4
%51 = getelementptr inbounds double, double* %50, i64 7
store double 0.000000e+00, double* %51
%52 = load double*, double** %4
%53 = getelementptr inbounds double, double* %52, i64 11
store double 0.000000e+00, double* %53
%54 = load double*, double** %4
%55 = getelementptr inbounds double, double* %54, i64 15
store double 1.000000e+00, double* %55
ret void
}

LLVM IR (-O2):
define void @glmGenerateInertiaMatrixForSphere4d(double* nocapture writeonly %0, double %1, double %2) {
%4 = fmul double %2, 4.000000e-01
%5 = fmul double %4, %1
%6 = fmul double %5, %1
store double %6, double* %0
%7 = getelementptr inbounds double, double* %0, i64 8
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = getelementptr inbounds double, double* %0, i64 5
store double %6, double* %9
%10 = bitcast double* %7 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %10
%11 = getelementptr inbounds double, double* %0, i64 13
%12 = bitcast double* %8 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %12
%13 = getelementptr inbounds double, double* %0, i64 6
%14 = getelementptr inbounds double, double* %0, i64 10
store double %6, double* %14
%15 = bitcast double* %11 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %15
%16 = getelementptr inbounds double, double* %0, i64 3
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %17
%18 = bitcast double* %13 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %18
%19 = getelementptr inbounds double, double* %0, i64 11
%20 = bitcast double* %19 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %20
%21 = getelementptr inbounds double, double* %0, i64 15
store double 1.000000e+00, double* %21
ret void
}