void _inner_vec_daxpy(double *y0, int incY, const double *a0, const double *x0,
                      int incX, double alpha, int nRE) {
  register int i;
  register double cf0 = alpha * x0[0];
  for (i = 0; i < nRE - 3; i += 4) {
    y0[0] += a0[0] * cf0;
    y0 += incY;
    y0[0] += a0[1] * cf0;
    y0 += incY;
    y0[0] += a0[2] * cf0;
    y0 += incY;
    y0[0] += a0[3] * cf0;
    y0 += incY;
    a0 += 4;
  }
  if (i == nRE)
    return;
  if (i < nRE - 1) {
    y0[0] += a0[0] * cf0;
    y0 += incY;
    y0[0] += a0[1] * cf0;
    y0 += incY;
    a0 += 2;
    i += 2;
  }
  if (i < nRE) {
    y0[0] += a0[0] * cf0;
    y0 += incY;
    i++;
  }
}


x86 assembly (clang, -O0):
<_inner_vec_daxpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    123f <_inner_vec_daxpy+0x13f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    1139 <_inner_vec_daxpy+0x39>
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jne    1250 <_inner_vec_daxpy+0x150>
jmp    132e <_inner_vec_daxpy+0x22e>
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12e3 <_inner_vec_daxpy+0x1e3>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    132e <_inner_vec_daxpy+0x22e>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_inner_vec_daxpy>:
push   %rbx
mulsd  (%rcx),%xmm0
xor    %eax,%eax
cmp    $0x4,%r9d
jl     11a3 <_inner_vec_daxpy+0xa3>
lea    -0x3(%r9),%r10d
movslq %esi,%rax
mov    %rax,%r8
shl    $0x5,%r8
shl    $0x3,%rax
xor    %r11d,%r11d
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,%rcx
movsd  (%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi),%xmm1
movsd  %xmm1,(%rdi)
add    %rax,%rdi
movsd  0x8(%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rcx,%rax,1),%xmm1
movsd  %xmm1,(%rcx,%rax,1)
movsd  0x10(%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rax,%rdi,1),%xmm1
lea    (%rdi,%rax,1),%rbx
movsd  %xmm1,(%rax,%rdi,1)
lea    (%rbx,%rax,1),%rdi
movsd  0x18(%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rax,%rbx,1),%xmm1
movsd  %xmm1,(%rax,%rbx,1)
add    $0x20,%rdx
add    $0x4,%r11d
add    %rax,%rdi
cmp    %r10d,%r11d
jl     1130 <_inner_vec_daxpy+0x30>
add    %r8,%rcx
mov    %r9d,%eax
and    $0xfffffffc,%eax
mov    %rcx,%rdi
cmp    %r9d,%eax
je     11f6 <_inner_vec_daxpy+0xf6>
lea    -0x1(%r9),%ecx
cmp    %ecx,%eax
jge    11e5 <_inner_vec_daxpy+0xe5>
movsd  (%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi),%xmm1
movsd  %xmm1,(%rdi)
movslq %esi,%rcx
lea    (%rdi,%rcx,8),%rsi
movsd  0x8(%rdx),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi,%rcx,8),%xmm1
movsd  %xmm1,(%rdi,%rcx,8)
lea    (%rsi,%rcx,8),%rdi
add    $0x10,%rdx
or     $0x2,%eax
cmp    %r9d,%eax
jge    11f6 <_inner_vec_daxpy+0xf6>
mulsd  (%rdx),%xmm0
addsd  (%rdi),%xmm0
movsd  %xmm0,(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @_inner_vec_daxpy(double* %0, i32 %1, double* %2, double* %3, i32 %4, double %5, i32 %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
store double* %0, double** %8
store i32 %1, i32* %9
store double* %2, double** %10
store double* %3, double** %11
store i32 %4, i32* %12
store double %5, double* %13
store i32 %6, i32* %14
%17 = load double, double* %13
%18 = load double*, double** %11
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = fmul double %17, %20
store double %21, double* %16
store i32 0, i32* %15
br label %22
22: ; preds = %78, %7
%23 = load i32, i32* %15
%24 = load i32, i32* %14
%25 = sub nsw i32 %24, 3
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %81
27: ; preds = %22
%28 = load double*, double** %10
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = load double, double* %16
%32 = load double*, double** %8
%33 = getelementptr inbounds double, double* %32, i64 0
%34 = load double, double* %33
%35 = call double @llvm.fmuladd.f64(double %30, double %31, double %34)
store double %35, double* %33
%36 = load i32, i32* %9
%37 = load double*, double** %8
%38 = sext i32 %36 to i64
%39 = getelementptr inbounds double, double* %37, i64 %38
store double* %39, double** %8
%40 = load double*, double** %10
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
%43 = load double, double* %16
%44 = load double*, double** %8
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = call double @llvm.fmuladd.f64(double %42, double %43, double %46)
store double %47, double* %45
%48 = load i32, i32* %9
%49 = load double*, double** %8
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds double, double* %49, i64 %50
store double* %51, double** %8
%52 = load double*, double** %10
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = load double, double* %16
%56 = load double*, double** %8
%57 = getelementptr inbounds double, double* %56, i64 0
%58 = load double, double* %57
%59 = call double @llvm.fmuladd.f64(double %54, double %55, double %58)
store double %59, double* %57
%60 = load i32, i32* %9
%61 = load double*, double** %8
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds double, double* %61, i64 %62
store double* %63, double** %8
%64 = load double*, double** %10
%65 = getelementptr inbounds double, double* %64, i64 3
%66 = load double, double* %65
%67 = load double, double* %16
%68 = load double*, double** %8
%69 = getelementptr inbounds double, double* %68, i64 0
%70 = load double, double* %69
%71 = call double @llvm.fmuladd.f64(double %66, double %67, double %70)
store double %71, double* %69
%72 = load i32, i32* %9
%73 = load double*, double** %8
%74 = sext i32 %72 to i64
%75 = getelementptr inbounds double, double* %73, i64 %74
store double* %75, double** %8
%76 = load double*, double** %10
%77 = getelementptr inbounds double, double* %76, i64 4
store double* %77, double** %10
br label %78
78: ; preds = %27
%79 = load i32, i32* %15
%80 = add nsw i32 %79, 4
store i32 %80, i32* %15
br label %22
81: ; preds = %22
%82 = load i32, i32* %15
%83 = load i32, i32* %14
%84 = icmp eq i32 %82, %83
br i1 %84, label %85, label %86
85: ; preds = %81
br label %139
86: ; preds = %81
%87 = load i32, i32* %15
%88 = load i32, i32* %14
%89 = sub nsw i32 %88, 1
%90 = icmp slt i32 %87, %89
br i1 %90, label %91, label %120
91: ; preds = %86
%92 = load double*, double** %10
%93 = getelementptr inbounds double, double* %92, i64 0
%94 = load double, double* %93
%95 = load double, double* %16
%96 = load double*, double** %8
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load double, double* %97
%99 = call double @llvm.fmuladd.f64(double %94, double %95, double %98)
store double %99, double* %97
%100 = load i32, i32* %9
%101 = load double*, double** %8
%102 = sext i32 %100 to i64
%103 = getelementptr inbounds double, double* %101, i64 %102
store double* %103, double** %8
%104 = load double*, double** %10
%105 = getelementptr inbounds double, double* %104, i64 1
%106 = load double, double* %105
%107 = load double, double* %16
%108 = load double*, double** %8
%109 = getelementptr inbounds double, double* %108, i64 0
%110 = load double, double* %109
%111 = call double @llvm.fmuladd.f64(double %106, double %107, double %110)
store double %111, double* %109
%112 = load i32, i32* %9
%113 = load double*, double** %8
%114 = sext i32 %112 to i64
%115 = getelementptr inbounds double, double* %113, i64 %114
store double* %115, double** %8
%116 = load double*, double** %10
%117 = getelementptr inbounds double, double* %116, i64 2
store double* %117, double** %10
%118 = load i32, i32* %15
%119 = add nsw i32 %118, 2
store i32 %119, i32* %15
br label %120
120: ; preds = %91, %86
%121 = load i32, i32* %15
%122 = load i32, i32* %14
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %139
124: ; preds = %120
%125 = load double*, double** %10
%126 = getelementptr inbounds double, double* %125, i64 0
%127 = load double, double* %126
%128 = load double, double* %16
%129 = load double*, double** %8
%130 = getelementptr inbounds double, double* %129, i64 0
%131 = load double, double* %130
%132 = call double @llvm.fmuladd.f64(double %127, double %128, double %131)
store double %132, double* %130
%133 = load i32, i32* %9
%134 = load double*, double** %8
%135 = sext i32 %133 to i64
%136 = getelementptr inbounds double, double* %134, i64 %135
store double* %136, double** %8
%137 = load i32, i32* %15
%138 = add nsw i32 %137, 1
store i32 %138, i32* %15
br label %139
139: ; preds = %85, %124, %120
ret void
}

LLVM IR (-O2):
define void @_inner_vec_daxpy(double* nocapture %0, i32 %1, double* nocapture %2, double* nocapture %3, i32 %4, double %5, i32 %6) {
%8 = load double, double* %3
%9 = fmul double %8, %5
%10 = add nsw i32 %6, -3
%11 = icmp sgt i32 %6, 3
br i1 %11, label %12, label %42
12: ; preds = %7
%13 = sext i32 %1 to i64
br label %14
14: ; preds = %12, %14
%15 = phi double* [ %0, %12 ], [ %36, %14 ]
%16 = phi i32 [ 0, %12 ], [ %38, %14 ]
%17 = phi double* [ %2, %12 ], [ %37, %14 ]
%18 = load double, double* %17
%19 = load double, double* %15
%20 = tail call double @llvm.fmuladd.f64(double %18, double %9, double %19)
store double %20, double* %15
%21 = getelementptr inbounds double, double* %15, i64 %13
%22 = getelementptr inbounds double, double* %17, i64 1
%23 = load double, double* %22
%24 = load double, double* %21
%25 = tail call double @llvm.fmuladd.f64(double %23, double %9, double %24)
store double %25, double* %21
%26 = getelementptr inbounds double, double* %21, i64 %13
%27 = getelementptr inbounds double, double* %17, i64 2
%28 = load double, double* %27
%29 = load double, double* %26
%30 = tail call double @llvm.fmuladd.f64(double %28, double %9, double %29)
store double %30, double* %26
%31 = getelementptr inbounds double, double* %26, i64 %13
%32 = getelementptr inbounds double, double* %17, i64 3
%33 = load double, double* %32
%34 = load double, double* %31
%35 = tail call double @llvm.fmuladd.f64(double %33, double %9, double %34)
store double %35, double* %31
%36 = getelementptr inbounds double, double* %31, i64 %13
%37 = getelementptr inbounds double, double* %17, i64 4
%38 = add nuw nsw i32 %16, 4
%39 = icmp slt i32 %38, %10
br i1 %39, label %14, label %40
40: ; preds = %14
%41 = and i32 %6, -4
br label %42
42: ; preds = %40, %7
%43 = phi double* [ %2, %7 ], [ %37, %40 ]
%44 = phi i32 [ 0, %7 ], [ %41, %40 ]
%45 = phi double* [ %0, %7 ], [ %36, %40 ]
%46 = icmp eq i32 %44, %6
br i1 %46, label %72, label %47
47: ; preds = %42
%48 = add nsw i32 %6, -1
%49 = icmp slt i32 %44, %48
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load double, double* %43
%52 = load double, double* %45
%53 = tail call double @llvm.fmuladd.f64(double %51, double %9, double %52)
store double %53, double* %45
%54 = sext i32 %1 to i64
%55 = getelementptr inbounds double, double* %45, i64 %54
%56 = getelementptr inbounds double, double* %43, i64 1
%57 = load double, double* %56
%58 = load double, double* %55
%59 = tail call double @llvm.fmuladd.f64(double %57, double %9, double %58)
store double %59, double* %55
%60 = getelementptr inbounds double, double* %55, i64 %54
%61 = getelementptr inbounds double, double* %43, i64 2
%62 = or i32 %44, 2
br label %63
63: ; preds = %50, %47
%64 = phi double* [ %61, %50 ], [ %43, %47 ]
%65 = phi i32 [ %62, %50 ], [ %44, %47 ]
%66 = phi double* [ %60, %50 ], [ %45, %47 ]
%67 = icmp slt i32 %65, %6
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = load double, double* %64
%70 = load double, double* %66
%71 = tail call double @llvm.fmuladd.f64(double %69, double %9, double %70)
store double %71, double* %66
br label %72
72: ; preds = %63, %68, %42
ret void
}