void gaussian(double r0, double r1, double r2, double r3, double r4, double r5,
              double r6, double r7, double r8, double c0, double c1, double c2,
              double c3, double c4, double c5, double c6, double c7, double c8,
              double *sum) {
  double T0 = r0 * c0;
  double T1 = r1 * c1;
  double T2 = r2 * c2;
  double T3 = r3 * c3;
  double T4 = r4 * c4;
  double T5 = r5 * c5;
  double T6 = r6 * c6;
  double T7 = r7 * c7;
  double T8 = r8 * c8;
  *sum = T0 + T1 + T2 + T3 + T4 + T5 + T6 + T7 + T8;
}


x86 assembly (clang, -O0):
<gaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0x58(%rbp),%xmm8
movsd  0x50(%rbp),%xmm8
movsd  0x48(%rbp),%xmm8
movsd  0x40(%rbp),%xmm8
movsd  0x38(%rbp),%xmm8
movsd  0x30(%rbp),%xmm8
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
mov    %rdi,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  0x48(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  0x50(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0x10(%rbp),%xmm0
mulsd  0x58(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
addsd  -0x90(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussian>:
mulsd  0x10(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm8
addsd  %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
mulsd  0x28(%rsp),%xmm3
addsd  %xmm2,%xmm3
mulsd  0x30(%rsp),%xmm4
mulsd  0x38(%rsp),%xmm5
addsd  %xmm3,%xmm4
addsd  %xmm4,%xmm5
mulsd  0x40(%rsp),%xmm6
addsd  %xmm5,%xmm6
mulsd  0x48(%rsp),%xmm7
addsd  %xmm6,%xmm7
mulsd  0x50(%rsp),%xmm8
addsd  %xmm7,%xmm8
movsd  %xmm8,(%rdi)
ret

LLVM IR (-O0):
define void @gaussian(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, double %16, double %17, double* %18) {
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double*
%39 = alloca double
%40 = alloca double
%41 = alloca double
%42 = alloca double
%43 = alloca double
%44 = alloca double
%45 = alloca double
%46 = alloca double
%47 = alloca double
store double %0, double* %20
store double %1, double* %21
store double %2, double* %22
store double %3, double* %23
store double %4, double* %24
store double %5, double* %25
store double %6, double* %26
store double %7, double* %27
store double %8, double* %28
store double %9, double* %29
store double %10, double* %30
store double %11, double* %31
store double %12, double* %32
store double %13, double* %33
store double %14, double* %34
store double %15, double* %35
store double %16, double* %36
store double %17, double* %37
store double* %18, double** %38
%48 = load double, double* %20
%49 = load double, double* %29
%50 = fmul double %48, %49
store double %50, double* %39
%51 = load double, double* %21
%52 = load double, double* %30
%53 = fmul double %51, %52
store double %53, double* %40
%54 = load double, double* %22
%55 = load double, double* %31
%56 = fmul double %54, %55
store double %56, double* %41
%57 = load double, double* %23
%58 = load double, double* %32
%59 = fmul double %57, %58
store double %59, double* %42
%60 = load double, double* %24
%61 = load double, double* %33
%62 = fmul double %60, %61
store double %62, double* %43
%63 = load double, double* %25
%64 = load double, double* %34
%65 = fmul double %63, %64
store double %65, double* %44
%66 = load double, double* %26
%67 = load double, double* %35
%68 = fmul double %66, %67
store double %68, double* %45
%69 = load double, double* %27
%70 = load double, double* %36
%71 = fmul double %69, %70
store double %71, double* %46
%72 = load double, double* %28
%73 = load double, double* %37
%74 = fmul double %72, %73
store double %74, double* %47
%75 = load double, double* %39
%76 = load double, double* %40
%77 = fadd double %75, %76
%78 = load double, double* %41
%79 = fadd double %77, %78
%80 = load double, double* %42
%81 = fadd double %79, %80
%82 = load double, double* %43
%83 = fadd double %81, %82
%84 = load double, double* %44
%85 = fadd double %83, %84
%86 = load double, double* %45
%87 = fadd double %85, %86
%88 = load double, double* %46
%89 = fadd double %87, %88
%90 = load double, double* %47
%91 = fadd double %89, %90
%92 = load double*, double** %38
store double %91, double* %92
ret void
}

LLVM IR (-O2):
define void @gaussian(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, double %16, double %17, double* nocapture writeonly %18) {
%20 = fmul double %0, %9
%21 = fmul double %1, %10
%22 = fmul double %2, %11
%23 = fmul double %3, %12
%24 = fmul double %4, %13
%25 = fmul double %5, %14
%26 = fmul double %6, %15
%27 = fmul double %7, %16
%28 = fmul double %8, %17
%29 = fadd double %20, %21
%30 = fadd double %29, %22
%31 = fadd double %30, %23
%32 = fadd double %31, %24
%33 = fadd double %32, %25
%34 = fadd double %33, %26
%35 = fadd double %34, %27
%36 = fadd double %35, %28
store double %36, double* %18
ret void
}