void glmGenerateInertiaMatrixForCylinder3d(double m[9], double r, double h,
                                           double mass) {
  m[0] = (1.0 / 12.0) * mass * h * h + (1.0 / 4.0) * mass * r * r;
  m[3] = 0;
  m[6] = 0;
  m[1] = 0;
  m[4] = (1.0 / 12.0) * mass * h * h + (1.0 / 4.0) * mass * r * r;
  m[7] = 0;
  m[2] = 0;
  m[5] = 0;
  m[8] = 0.5f * mass * r * r;
}


x86 assembly (clang, -O0):
<glmGenerateInertiaMatrixForCylinder3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xef1(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xed2(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0xe8f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe70(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  0xe1c(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateInertiaMatrixForCylinder3d>:
movsd  0xef8(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
movsd  0xef0(%rip),%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm4
mulsd  %xmm0,%xmm4
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm3,(%rdi)
movq   $0x0,0x18(%rdi)
movsd  %xmm3,0x20(%rdi)
movq   $0x0,0x38(%rdi)
xorpd  %xmm1,%xmm1
movupd %xmm1,0x8(%rdi)
mulsd  0xeba(%rip),%xmm2
movupd %xmm1,0x28(%rdi)
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rdi)
ret

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

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