#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_vec2_daxpy_sse(double *y0, const double *a0, const double *a1,
                           const double *x0, int incX, double alpha, int nRE,
                           int oddStart) {
  register int i;
  register double cf0, cf1, ytmp0, ytmp1;
  register __m128d CF0, CF1, Y0, A0, A1;
  cf0 = alpha * x0[0];
  cf1 = alpha * x0[incX];
  CF0 = _mm_set1_pd(cf0);
  CF1 = _mm_set1_pd(cf1);
  if (oddStart) {
    ytmp0 = a0[0] * cf0;
    ytmp1 = a1[0] * cf1;
    y0[0] += ytmp0 + ytmp1;
    y0++;
    a0++;
    a1++;
    nRE--;
  }
  for (i = nRE - 1; i > 0; i -= 2) {
    Y0 = _mm_load_pd(y0);
    A0 = _mm_load_pd(a0);
    A1 = _mm_load_pd(a1);
    A0 = A0 * CF0;
    Y0 = Y0 + A0;
    A1 = A1 * CF1;
    Y0 = Y0 + A1;
    _mm_store_pd(y0, Y0);
    y0 += 2;
    a0 += 2;
    a1 += 2;
  }
  if (i != 0)
    return;
  ytmp0 = a0[0] * cf0;
  ytmp1 = a1[0] * cf1;
  y0[0] += ytmp0 + ytmp1;
}


x86 assembly (clang, -O0):
<_inner_vec2_daxpy_sse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%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)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <_mm_set1_pd@plt>
mov    %eax,-0x5c(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <_mm_set1_pd@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,0x10(%rbp)
je     120c <_inner_vec2_daxpy_sse+0xdc>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addsd  (%rax),%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    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    12a7 <_inner_vec2_daxpy_sse+0x177>
mov    -0x8(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x68(%rbp),%eax
imul   -0x5c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x64(%rbp),%eax
add    -0x68(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x6c(%rbp),%eax
imul   -0x60(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x64(%rbp),%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x64(%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    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    1215 <_inner_vec2_daxpy_sse+0xe5>
cmpl   $0x0,-0x38(%rbp)
je     12b6 <_inner_vec2_daxpy_sse+0x186>
jmp    12f0 <_inner_vec2_daxpy_sse+0x1c0>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_inner_vec2_daxpy_sse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebp
movapd %xmm0,%xmm1
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  (%rcx),%xmm0
mulsd  %xmm1,%xmm0
movslq %r8d,%rax
mulsd  (%rcx,%rax,8),%xmm1
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <_mm_set1_pd@plt>
mov    %eax,%r12d
movsd  (%rsp),%xmm0
call   1040 <_mm_set1_pd@plt>
cmpl   $0x0,0x50(%rsp)
je     1242 <_inner_vec2_daxpy_sse+0x112>
movsd  (%r15),%xmm0
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movsd  (%r14),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,(%rbx)
add    $0x8,%rbx
add    $0x8,%r15
add    $0x8,%r14
add    $0xffffffff,%ebp
movapd %xmm2,%xmm0
movapd %xmm3,%xmm1
cmp    $0x2,%ebp
jl     1256 <_inner_vec2_daxpy_sse+0x126>
add    $0x1,%ebp
mov    %r12d,0x14(%rsp)
mov    %eax,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1050 <_mm_load_pd@plt>
mov    %eax,%r13d
mov    %r14,%rdi
call   1050 <_mm_load_pd@plt>
imul   0x14(%rsp),%r13d
add    %r12d,%r13d
imul   0x10(%rsp),%eax
add    %eax,%r13d
mov    %rbx,%rdi
mov    %r13d,%esi
call   1030 <_mm_store_pd@plt>
add    $0x10,%rbx
add    $0x10,%r15
add    $0x10,%r14
add    $0xfffffffe,%ebp
cmp    $0x2,%ebp
ja     11e0 <_inner_vec2_daxpy_sse+0xb0>
add    $0xfffffffe,%ebp
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
test   %ebp,%ebp
jne    1273 <_inner_vec2_daxpy_sse+0x143>
jmp    125d <_inner_vec2_daxpy_sse+0x12d>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
cmp    $0x2,%ebp
jge    11cf <_inner_vec2_daxpy_sse+0x9f>
add    $0xffffffff,%ebp
test   %ebp,%ebp
jne    1273 <_inner_vec2_daxpy_sse+0x143>
mulsd  (%r15),%xmm1
mulsd  (%r14),%xmm0
addsd  %xmm1,%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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