double volumetric_heat_capacity(double soil_fract, double water_fract,
                                double ice_fract, double organic_fract) {
  double Cs;
  Cs = 2.0e6 * soil_fract * (1 - organic_fract);
  Cs += 2.7e6 * soil_fract * organic_fract;
  Cs += 4.2e6 * water_fract;
  Cs += 1.9e6 * ice_fract;
  Cs += 1.3e3 * (1. - (soil_fract + water_fract + ice_fract));
  return (Cs);
}


x86 assembly (clang, -O0):
<volumetric_heat_capacity>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  0xf08(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xedd(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xea7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe80(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe54(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe3b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<volumetric_heat_capacity>:
movsd  0xef8(%rip),%xmm5
mulsd  %xmm0,%xmm5
movsd  0xef4(%rip),%xmm4
movapd %xmm4,%xmm6
subsd  %xmm3,%xmm6
mulsd  %xmm5,%xmm6
movsd  0xee8(%rip),%xmm5
mulsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm6,%xmm5
addsd  %xmm1,%xmm0
mulsd  0xed8(%rip),%xmm1
addsd  %xmm1,%xmm5
addsd  %xmm2,%xmm0
mulsd  0xed0(%rip),%xmm2
addsd  %xmm2,%xmm5
subsd  %xmm0,%xmm4
mulsd  0xec8(%rip),%xmm4
addsd  %xmm5,%xmm4
movapd %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @volumetric_heat_capacity(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %5
%11 = fmul double 2.000000e+06, %10
%12 = load double, double* %8
%13 = fsub double 1.000000e+00, %12
%14 = fmul double %11, %13
store double %14, double* %9
%15 = load double, double* %5
%16 = fmul double 2.700000e+06, %15
%17 = load double, double* %8
%18 = load double, double* %9
%19 = call double @llvm.fmuladd.f64(double %16, double %17, double %18)
store double %19, double* %9
%20 = load double, double* %6
%21 = load double, double* %9
%22 = call double @llvm.fmuladd.f64(double 4.200000e+06, double %20, double %21)
store double %22, double* %9
%23 = load double, double* %7
%24 = load double, double* %9
%25 = call double @llvm.fmuladd.f64(double 1.900000e+06, double %23, double %24)
store double %25, double* %9
%26 = load double, double* %5
%27 = load double, double* %6
%28 = fadd double %26, %27
%29 = load double, double* %7
%30 = fadd double %28, %29
%31 = fsub double 1.000000e+00, %30
%32 = load double, double* %9
%33 = call double @llvm.fmuladd.f64(double 1.300000e+03, double %31, double %32)
store double %33, double* %9
%34 = load double, double* %9
ret double %34
}

LLVM IR (-O2):
define double @volumetric_heat_capacity(double %0, double %1, double %2, double %3) {
%5 = fmul double %0, 2.000000e+06
%6 = fsub double 1.000000e+00, %3
%7 = fmul double %5, %6
%8 = fmul double %0, 2.700000e+06
%9 = tail call double @llvm.fmuladd.f64(double %8, double %3, double %7)
%10 = tail call double @llvm.fmuladd.f64(double %1, double 4.200000e+06, double %9)
%11 = tail call double @llvm.fmuladd.f64(double %2, double 1.900000e+06, double %10)
%12 = fadd double %0, %1
%13 = fadd double %12, %2
%14 = fsub double 1.000000e+00, %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double 1.300000e+03, double %11)
ret double %15
}