void Maxpy(len, alpha, x, y) int len;
double alpha;
double *x, *y;
{
  register int i, len4;
  len4 = len / 4;
  len = len % 4;
  for (i = 0; i < len4; i++) {
    y[4 * i] += alpha * x[4 * i];
    y[4 * i + 1] += alpha * x[4 * i + 1];
    y[4 * i + 2] += alpha * x[4 * i + 2];
    y[4 * i + 3] += alpha * x[4 * i + 3];
  }
  x += 4 * len4;
  y += 4 * len4;
  for (i = 0; i < len; i++)
    y[i] += alpha * x[i];
}


x86 assembly (clang, -O0):
<Maxpy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    123b <Maxpy+0x13b>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1137 <Maxpy+0x37>
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12b8 <Maxpy+0x1b8>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1272 <Maxpy+0x172>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maxpy>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%r9d
sar    $0x2,%r9d
and    $0xfffffffc,%eax
mov    %edi,%r8d
sub    %eax,%r8d
cmp    $0x4,%edi
jl     11bf <Maxpy+0xbf>
mov    %r9d,%eax
cmp    $0x2,%r9d
jb     114b <Maxpy+0x4b>
mov    %rax,%r10
shl    $0x5,%r10
lea    (%rsi,%r10,1),%rcx
cmp    %rdx,%rcx
jbe    1213 <Maxpy+0x113>
lea    (%rdx,%r10,1),%rcx
cmp    %rsi,%rcx
jbe    1213 <Maxpy+0x113>
xor    %edi,%edi
sub    %rdi,%rax
shl    $0x5,%rdi
or     $0x18,%rdi
nopl   0x0(%rax,%rax,1)
movsd  -0x18(%rsi,%rdi,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x18(%rdx,%rdi,1),%xmm1
movsd  %xmm1,-0x18(%rdx,%rdi,1)
movsd  -0x10(%rsi,%rdi,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x10(%rdx,%rdi,1),%xmm1
movsd  %xmm1,-0x10(%rdx,%rdi,1)
movsd  -0x8(%rsi,%rdi,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x8(%rdx,%rdi,1),%xmm1
movsd  %xmm1,-0x8(%rdx,%rdi,1)
movsd  (%rsi,%rdi,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdx,%rdi,1),%xmm1
movsd  %xmm1,(%rdx,%rdi,1)
add    $0x20,%rdi
add    $0xffffffffffffffff,%rax
jne    1160 <Maxpy+0x60>
test   %r8d,%r8d
jle    1212 <Maxpy+0x112>
shl    $0x2,%r9d
movslq %r9d,%rax
movsd  (%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdx,%rax,8),%xmm1
movsd  %xmm1,(%rdx,%rax,8)
cmp    $0x1,%r8d
je     1212 <Maxpy+0x112>
movsd  0x8(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rdx,%rax,8),%xmm1
movsd  %xmm1,0x8(%rdx,%rax,8)
cmp    $0x2,%r8d
je     1212 <Maxpy+0x112>
mulsd  0x10(%rsi,%rax,8),%xmm0
addsd  0x10(%rdx,%rax,8),%xmm0
movsd  %xmm0,0x10(%rdx,%rax,8)
ret
mov    %eax,%edi
and    $0xfffffffe,%edi
movapd %xmm0,%xmm8
unpcklpd %xmm0,%xmm8
and    $0xffffffffffffffc0,%r10
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movupd (%rsi,%rcx,1),%xmm2
movupd 0x10(%rsi,%rcx,1),%xmm3
movupd 0x20(%rsi,%rcx,1),%xmm5
movupd 0x30(%rsi,%rcx,1),%xmm6
movapd %xmm2,%xmm4
unpcklpd %xmm5,%xmm4
unpckhpd %xmm5,%xmm2
movapd %xmm3,%xmm5
unpcklpd %xmm6,%xmm5
unpckhpd %xmm6,%xmm3
movupd (%rdx,%rcx,1),%xmm6
movupd 0x10(%rdx,%rcx,1),%xmm10
movupd 0x20(%rdx,%rcx,1),%xmm1
movupd 0x30(%rdx,%rcx,1),%xmm9
movapd %xmm6,%xmm7
unpcklpd %xmm1,%xmm7
unpckhpd %xmm1,%xmm6
movapd %xmm10,%xmm1
unpcklpd %xmm9,%xmm1
unpckhpd %xmm9,%xmm10
mulpd  %xmm8,%xmm4
addpd  %xmm7,%xmm4
mulpd  %xmm8,%xmm2
addpd  %xmm6,%xmm2
mulpd  %xmm8,%xmm5
addpd  %xmm1,%xmm5
mulpd  %xmm8,%xmm3
addpd  %xmm10,%xmm3
movapd %xmm5,%xmm1
unpcklpd %xmm3,%xmm1
movapd %xmm4,%xmm6
unpcklpd %xmm2,%xmm6
movhlps %xmm5,%xmm3
movhlps %xmm4,%xmm2
movups %xmm2,0x20(%rdx,%rcx,1)
movups %xmm3,0x30(%rdx,%rcx,1)
movupd %xmm6,(%rdx,%rcx,1)
movupd %xmm1,0x10(%rdx,%rcx,1)
add    $0x40,%rcx
cmp    %rcx,%r10
jne    1230 <Maxpy+0x130>
cmp    %rax,%rdi
je     11bf <Maxpy+0xbf>
jmp    114d <Maxpy+0x4d>

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

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