void pdoubledifferencexalpha(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):
<pdoubledifferencexalpha>:
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    1188 <pdoubledifferencexalpha+0x88>
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
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
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 <pdoubledifferencexalpha+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdoubledifferencexalpha>:
mov    %rdx,%r10
add    $0xffffffffffffffff,%r10
je     124f <pdoubledifferencexalpha+0x14f>
cmp    $0x4,%r10
jb     1131 <pdoubledifferencexalpha+0x31>
lea    0x8(%rdi),%rax
lea    (%rsi,%rdx,8),%rcx
cmp    %rcx,%rax
jae    11ac <pdoubledifferencexalpha+0xac>
lea    (%rdi,%rdx,8),%rax
lea    0x8(%rsi),%rcx
cmp    %rax,%rcx
jae    11ac <pdoubledifferencexalpha+0xac>
mov    %r10,%r9
mov    %r9,%rax
test   $0x1,%r9b
je     115b <pdoubledifferencexalpha+0x5b>
movsd  (%rdi,%r9,8),%xmm1
movsd  (%rsi,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi,%r9,8)
lea    -0x1(%r9),%rax
cmp    $0x1,%r9
je     124f <pdoubledifferencexalpha+0x14f>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x8(%rdi,%rax,8),%xmm1
movsd  (%rdi,%rax,8),%xmm2
movsd  (%rsi,%rax,8),%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
movsd  -0x8(%rsi,%rax,8),%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,-0x8(%rdi,%rax,8)
add    $0xfffffffffffffffe,%rax
jne    1170 <pdoubledifferencexalpha+0x70>
jmp    124f <pdoubledifferencexalpha+0x14f>
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
movapd 0xe1e(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd -0x10(%rcx,%rax,8),%xmm3
movupd (%rcx,%rax,8),%xmm4
movupd -0x10(%rdx,%rax,8),%xmm5
movupd (%rdx,%rax,8),%xmm6
shufpd $0x1,%xmm6,%xmm6
shufpd $0x1,%xmm5,%xmm5
xorpd  %xmm2,%xmm6
xorpd  %xmm2,%xmm5
mulpd  %xmm1,%xmm6
mulpd  %xmm1,%xmm5
shufpd $0x1,%xmm6,%xmm6
addpd  %xmm4,%xmm6
movupd %xmm6,(%rcx,%rax,8)
shufpd $0x1,%xmm5,%xmm5
addpd  %xmm3,%xmm5
movupd %xmm5,-0x10(%rcx,%rax,8)
add    $0xfffffffffffffffc,%rax
cmp    %rax,%r11
jne    11f0 <pdoubledifferencexalpha+0xf0>
cmp    %r8,%r10
jne    1134 <pdoubledifferencexalpha+0x34>
ret

LLVM IR (-O0):
define void @pdoubledifferencexalpha(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 = %29, %4
%12 = load i64, i64* %8
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %32
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 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %18)
%26 = load double*, double** %5
%27 = load i64, i64* %8
%28 = getelementptr inbounds double, double* %26, i64 %27
store double %25, double* %28
br label %29
29: ; preds = %14
%30 = load i64, i64* %8
%31 = add i64 %30, -1
store i64 %31, i64* %8
br label %11
32: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @pdoubledifferencexalpha(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 %91, label %7
7: ; preds = %4
%8 = icmp ult i64 %5, 4
br i1 %8, label %59, 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 %59, 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 ], [ %55, %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 = fneg <2 x double> %41
%48 = fneg <2 x double> %46
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %47, <2 x double> %21, <2 x double> %31)
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %23, <2 x double> %36)
%51 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%52 = bitcast double* %28 to <2 x double>*
store <2 x double> %51, <2 x double>* %52
%53 = shufflevector <2 x double> %50, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%54 = bitcast double* %33 to <2 x double>*
store <2 x double> %53, <2 x double>* %54
%55 = add nuw i64 %25, 4
%56 = icmp eq i64 %55, %18
br i1 %56, label %57, label %24
57: ; preds = %24
%58 = icmp eq i64 %5, %18
br i1 %58, label %91, label %59
59: ; preds = %9, %7, %57
%60 = phi i64 [ %5, %9 ], [ %5, %7 ], [ %19, %57 ]
%61 = and i64 %60, 1
%62 = icmp eq i64 %61, 0
br i1 %62, label %71, label %63
63: ; preds = %59
%64 = getelementptr inbounds double, double* %0, i64 %60
%65 = load double, double* %64
%66 = getelementptr inbounds double, double* %1, i64 %60
%67 = load double, double* %66
%68 = fneg double %67
%69 = tail call double @llvm.fmuladd.f64(double %68, double %2, double %65)
store double %69, double* %64
%70 = add i64 %60, -1
br label %71
71: ; preds = %63, %59
%72 = phi i64 [ %60, %59 ], [ %70, %63 ]
%73 = icmp eq i64 %60, 1
br i1 %73, label %91, label %74
74: ; preds = %71, %74
%75 = phi i64 [ %89, %74 ], [ %72, %71 ]
%76 = getelementptr inbounds double, double* %0, i64 %75
%77 = load double, double* %76
%78 = getelementptr inbounds double, double* %1, i64 %75
%79 = load double, double* %78
%80 = fneg double %79
%81 = tail call double @llvm.fmuladd.f64(double %80, double %2, double %77)
store double %81, double* %76
%82 = add i64 %75, -1
%83 = getelementptr inbounds double, double* %0, i64 %82
%84 = load double, double* %83
%85 = getelementptr inbounds double, double* %1, i64 %82
%86 = load double, double* %85
%87 = fneg double %86
%88 = tail call double @llvm.fmuladd.f64(double %87, double %2, double %84)
store double %88, double* %83
%89 = add i64 %75, -2
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %74
91: ; preds = %71, %74, %57, %4
ret void
}