#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int __m128d;

/* Variables and functions */
int _mm_load_pd(double const *);
int _mm_set1_pd(double);
int /*<<< orphan*/ _mm_store_pd(double *, int);
void _inner_vec_daxpy_sse(double *y0, const double *a0, const double *x0,
                          int incX, double alpha, int nRE, int oddStart) {
  register int i;
  register double cf0;
  register __m128d C0, A0, CF;
  cf0 = alpha * x0[0];
  CF = _mm_set1_pd(cf0);
  if (oddStart) {
    y0[0] += a0[0] * cf0;
    y0++;
    a0++;
    nRE--;
  }
  for (i = 0; i < nRE - 3; i += 4) {
    C0 = _mm_load_pd(y0);
    A0 = _mm_load_pd(a0);
    A0 = A0 * CF;
    C0 = C0 + A0;
    _mm_store_pd(y0, C0);
    y0 += 2;
    a0 += 2;
    C0 = _mm_load_pd(y0);
    A0 = _mm_load_pd(a0);
    A0 = A0 * CF;
    C0 = C0 + A0;
    _mm_store_pd(y0, C0);
    y0 += 2;
    a0 += 2;
  }
  if (i == nRE)
    return;
  if (i < nRE - 1) {
    C0 = _mm_load_pd(y0);
    A0 = _mm_load_pd(a0);
    A0 = A0 * CF;
    C0 = C0 + A0;
    _mm_store_pd(y0, C0);
    y0 += 2;
    a0 += 2;
    i += 2;
  }
  if (i < nRE) {
    y0[0] += a0[0] * cf0;
    i++;
  }
}


x86 assembly (clang, -O0):
<_inner_vec_daxpy_sse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <_mm_set1_pd@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     11bf <_inner_vec_daxpy_sse+0x8f>
mov    -0x10(%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    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x2c(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1283 <_inner_vec_daxpy_sse+0x153>
mov    -0x8(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
imul   -0x4c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <_mm_store_pd@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
imul   -0x4c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <_mm_store_pd@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x34(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x34(%rbp)
jmp    11c6 <_inner_vec_daxpy_sse+0x96>
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1294 <_inner_vec_daxpy_sse+0x164>
jmp    1333 <_inner_vec_daxpy_sse+0x203>
mov    -0x34(%rbp),%eax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12fd <_inner_vec_daxpy_sse+0x1cd>
mov    -0x8(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
imul   -0x4c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <_mm_store_pd@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x34(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1333 <_inner_vec_daxpy_sse+0x203>
mov    -0x10(%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    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_inner_vec_daxpy_sse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r12d
mov    %r8d,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
mulsd  (%rdx),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <_mm_set1_pd@plt>
mov    %eax,%r13d
test   %r12d,%r12d
je     1189 <_inner_vec_daxpy_sse+0x59>
movsd  (%r14),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
add    $0x8,%r15
add    $0x8,%r14
add    $0xffffffff,%ebp
movapd %xmm1,%xmm0
jmp    118e <_inner_vec_daxpy_sse+0x5e>
movsd  (%rsp),%xmm0
xor    %r12d,%r12d
cmp    $0x4,%ebp
jl     1216 <_inner_vec_daxpy_sse+0xe6>
mov    %rbp,0x10(%rsp)
lea    -0x3(%rbp),%eax
mov    %eax,0xc(%rsp)
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    %r15,%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <_mm_load_pd@plt>
imul   %r13d,%eax
add    %eax,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <_mm_store_pd@plt>
lea    0x10(%r15),%rbp
mov    %rbp,%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,%ebx
lea    0x10(%r14),%rdi
call   1050 <_mm_load_pd@plt>
imul   %r13d,%eax
add    %eax,%ebx
mov    %rbp,%rdi
mov    %ebx,%esi
call   1030 <_mm_store_pd@plt>
add    $0x20,%r15
add    $0x20,%r14
add    $0x4,%r12d
cmp    0xc(%rsp),%r12d
jl     11b0 <_inner_vec_daxpy_sse+0x80>
movsd  (%rsp),%xmm0
mov    0x10(%rsp),%rbp
cmp    %ebp,%r12d
je     126c <_inner_vec_daxpy_sse+0x13c>
lea    -0x1(%rbp),%eax
cmp    %eax,%r12d
jge    1258 <_inner_vec_daxpy_sse+0x128>
mov    %r15,%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <_mm_load_pd@plt>
imul   %eax,%r13d
add    %ebx,%r13d
mov    %r15,%rdi
mov    %r13d,%esi
call   1030 <_mm_store_pd@plt>
movsd  (%rsp),%xmm0
add    $0x10,%r15
add    $0x10,%r14
or     $0x2,%r12d
cmp    %ebp,%r12d
jge    126c <_inner_vec_daxpy_sse+0x13c>
mulsd  (%r14),%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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