void pdoublesumcexalpha(double *a, double *y, double alpha, unsigned long n) {
  for (n -= 1; n > 0; n--)
    a[n] = (*(a + n)) + ((*(y + n)) * alpha);
}


x86 assembly (clang, -O0):
<pdoublesumcexalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    1171 <pdoublesumcexalpha+0x71>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1121 <pdoublesumcexalpha+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdoublesumcexalpha>:
mov    %rdx,%r10
add    $0xffffffffffffffff,%r10
je     1213 <pdoublesumcexalpha+0x113>
cmp    $0x4,%r10
jb     112d <pdoublesumcexalpha+0x2d>
lea    0x8(%rdi),%rax
lea    (%rsi,%rdx,8),%rcx
cmp    %rcx,%rax
jae    1194 <pdoublesumcexalpha+0x94>
lea    (%rdi,%rdx,8),%rax
lea    0x8(%rsi),%rcx
cmp    %rax,%rcx
jae    1194 <pdoublesumcexalpha+0x94>
mov    %r10,%r9
mov    %r9,%rax
test   $0x1,%r9b
je     1153 <pdoublesumcexalpha+0x53>
movsd  (%rsi,%r9,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi,%r9,8),%xmm1
movsd  %xmm1,(%rdi,%r9,8)
lea    -0x1(%r9),%rax
cmp    $0x1,%r9
je     1213 <pdoublesumcexalpha+0x113>
nopl   (%rax)
movsd  (%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi,%rax,8),%xmm1
movsd  %xmm1,(%rdi,%rax,8)
movsd  -0x8(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x8(%rdi,%rax,8),%xmm1
movsd  %xmm1,-0x8(%rdi,%rax,8)
add    $0xfffffffffffffffe,%rax
jne    1160 <pdoublesumcexalpha+0x60>
jmp    1213 <pdoublesumcexalpha+0x113>
mov    %r10,%r8
and    $0xfffffffffffffffc,%r8
mov    %r10d,%r9d
and    $0x3,%r9d
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
mov    %r8,%r11
neg    %r11
lea    (%rdi,%rdx,8),%rcx
add    $0xfffffffffffffff0,%rcx
lea    (%rsi,%rdx,8),%rdx
add    $0xfffffffffffffff0,%rdx
xor    %eax,%eax
shufpd $0x1,%xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
movupd -0x10(%rcx,%rax,8),%xmm2
movupd (%rcx,%rax,8),%xmm3
movupd -0x10(%rdx,%rax,8),%xmm4
movupd (%rdx,%rax,8),%xmm5
mulpd  %xmm1,%xmm5
addpd  %xmm3,%xmm5
movupd %xmm5,(%rcx,%rax,8)
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm4,-0x10(%rcx,%rax,8)
add    $0xfffffffffffffffc,%rax
cmp    %rax,%r11
jne    11d0 <pdoublesumcexalpha+0xd0>
cmp    %r8,%r10
jne    1130 <pdoublesumcexalpha+0x30>
ret

LLVM IR (-O0):
define void @pdoublesumcexalpha(double* %0, double* %1, double %2, i64 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca i64
store double* %0, double** %5
store double* %1, double** %6
store double %2, double* %7
store i64 %3, i64* %8
%9 = load i64, i64* %8
%10 = sub i64 %9, 1
store i64 %10, i64* %8
br label %11
11: ; preds = %28, %4
%12 = load i64, i64* %8
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load double*, double** %5
%16 = load i64, i64* %8
%17 = getelementptr inbounds double, double* %15, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load i64, i64* %8
%21 = getelementptr inbounds double, double* %19, i64 %20
%22 = load double, double* %21
%23 = load double, double* %7
%24 = call double @llvm.fmuladd.f64(double %22, double %23, double %18)
%25 = load double*, double** %5
%26 = load i64, i64* %8
%27 = getelementptr inbounds double, double* %25, i64 %26
store double %24, double* %27
br label %28
28: ; preds = %14
%29 = load i64, i64* %8
%30 = add i64 %29, -1
store i64 %30, i64* %8
br label %11
31: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @pdoublesumcexalpha(double* nocapture %0, double* nocapture %1, double %2, i64 %3) {
%5 = add i64 %3, -1
%6 = icmp eq i64 %5, 0
br i1 %6, label %86, label %7
7: ; preds = %4
%8 = icmp ult i64 %5, 4
br i1 %8, label %57, label %9
9: ; preds = %7
%10 = getelementptr double, double* %0, i64 1
%11 = getelementptr double, double* %0, i64 %3
%12 = getelementptr double, double* %1, i64 1
%13 = getelementptr double, double* %1, i64 %3
%14 = icmp ult double* %10, %13
%15 = icmp ult double* %12, %11
%16 = and i1 %14, %15
br i1 %16, label %57, label %17
17: ; preds = %9
%18 = and i64 %5, -4
%19 = and i64 %5, 3
%20 = insertelement <2 x double> poison, double %2, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %2, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
br label %24
24: ; preds = %24, %17
%25 = phi i64 [ 0, %17 ], [ %53, %24 ]
%26 = sub i64 %5, %25
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = getelementptr inbounds double, double* %27, i64 -1
%29 = bitcast double* %28 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%32 = getelementptr inbounds double, double* %27, i64 -2
%33 = getelementptr inbounds double, double* %32, i64 -1
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%37 = getelementptr inbounds double, double* %1, i64 %26
%38 = getelementptr inbounds double, double* %37, i64 -1
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%42 = getelementptr inbounds double, double* %37, i64 -2
%43 = getelementptr inbounds double, double* %42, i64 -1
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%47 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %21, <2 x double> %31)
%48 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %23, <2 x double> %36)
%49 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%50 = bitcast double* %28 to <2 x double>*
store <2 x double> %49, <2 x double>* %50
%51 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%52 = bitcast double* %33 to <2 x double>*
store <2 x double> %51, <2 x double>* %52
%53 = add nuw i64 %25, 4
%54 = icmp eq i64 %53, %18
br i1 %54, label %55, label %24
55: ; preds = %24
%56 = icmp eq i64 %5, %18
br i1 %56, label %86, label %57
57: ; preds = %9, %7, %55
%58 = phi i64 [ %5, %9 ], [ %5, %7 ], [ %19, %55 ]
%59 = and i64 %58, 1
%60 = icmp eq i64 %59, 0
br i1 %60, label %68, label %61
61: ; preds = %57
%62 = getelementptr inbounds double, double* %0, i64 %58
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %1, i64 %58
%65 = load double, double* %64
%66 = tail call double @llvm.fmuladd.f64(double %65, double %2, double %63)
store double %66, double* %62
%67 = add i64 %58, -1
br label %68
68: ; preds = %61, %57
%69 = phi i64 [ %58, %57 ], [ %67, %61 ]
%70 = icmp eq i64 %58, 1
br i1 %70, label %86, label %71
71: ; preds = %68, %71
%72 = phi i64 [ %84, %71 ], [ %69, %68 ]
%73 = getelementptr inbounds double, double* %0, i64 %72
%74 = load double, double* %73
%75 = getelementptr inbounds double, double* %1, i64 %72
%76 = load double, double* %75
%77 = tail call double @llvm.fmuladd.f64(double %76, double %2, double %74)
store double %77, double* %73
%78 = add i64 %72, -1
%79 = getelementptr inbounds double, double* %0, i64 %78
%80 = load double, double* %79
%81 = getelementptr inbounds double, double* %1, i64 %78
%82 = load double, double* %81
%83 = tail call double @llvm.fmuladd.f64(double %82, double %2, double %80)
store double %83, double* %79
%84 = add i64 %72, -2
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %71
86: ; preds = %68, %71, %55, %4
ret void
}