#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 */

/* Variables and functions */
int /*<<< orphan*/ _inner_vec2_ddot(double *, int, double const *,
                                    double const *, double const *, int, double,
                                    int);
int /*<<< orphan*/ _inner_vec_ddot(double *, int, double const *,
                                   double const *, int, double, int);
void _dmvec_ddot(double *Yc, const double *Aroot, const double *Xc,
                 double alpha, int incY, int ldA, int incX, int nRE, int nC) {
  register int j, k;
  register const double *a0, *a1, *a2, *a3, *x0;
  register double *y0;
  const double *Ac;
  Ac = Aroot;
  x0 = Xc;
  for (j = 0; j < nRE - 3; j += 4) {
    y0 = Yc;
    a0 = Ac;
    a1 = a0 + ldA;
    a2 = a1 + ldA;
    a3 = a2 + ldA;
    _inner_vec2_ddot(y0, incY, a0, a1, Xc, incX, alpha, nC);
    y0 += 2 * incY;
    _inner_vec2_ddot(y0, incY, a2, a3, Xc, incX, alpha, nC);
    Ac += 4 * ldA;
    Yc += 4 * incY;
  }
  if (j == nRE)
    return;
  if (j < nRE - 1) {
    y0 = Yc;
    a0 = Ac;
    a1 = a0 + ldA;
    _inner_vec2_ddot(y0, incY, a0, a1, Xc, incX, alpha, nC);
    y0 += incY;
    Yc += 2 * incY;
    Ac += 2 * ldA;
    j += 2;
  }
  if (j < nRE) {
    y0 = Yc;
    a0 = Ac;
    _inner_vec_ddot(y0, incY, a0, Xc, incX, alpha, nC);
    Yc += incY;
    Ac += ldA;
    j++;
  }
}


x86 assembly (clang, -O0):
<_dmvec_ddot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    0x10(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1262 <_dmvec_ddot+0x142>
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x2c(%rbp),%r9d
movsd  -0x20(%rbp),%xmm0
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <_inner_vec2_ddot@plt>
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x68(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x2c(%rbp),%r9d
movsd  -0x20(%rbp),%xmm0
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <_inner_vec2_ddot@plt>
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x30(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x30(%rbp)
jmp    1164 <_dmvec_ddot+0x44>
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jne    1273 <_dmvec_ddot+0x153>
jmp    138c <_dmvec_ddot+0x26c>
mov    -0x30(%rbp),%eax
mov    0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    131c <_dmvec_ddot+0x1fc>
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x2c(%rbp),%r9d
movsd  -0x20(%rbp),%xmm0
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <_inner_vec2_ddot@plt>
mov    -0x24(%rbp),%ecx
mov    -0x68(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    138c <_dmvec_ddot+0x26c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
movsd  -0x20(%rbp),%xmm0
mov    0x18(%rbp),%r9d
call   1030 <_inner_vec_ddot@plt>
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmvec_ddot>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,%r14d
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
mov    0xb8(%rsp),%r9d
mov    0xb0(%rsp),%eax
xor    %ebp,%ebp
cmp    $0x4,%eax
mov    %rcx,0x20(%rsp)
mov    %rax,0x30(%rsp)
mov    %r8d,0x28(%rsp)
mov    %r9d,0xc(%rsp)
jl     127a <_dmvec_ddot+0x15a>
add    $0xfffffffd,%eax
mov    %eax,0x2c(%rsp)
movslq %r8d,%rsi
lea    (%rcx,%rcx,1),%eax
movslq %eax,%r8
lea    0x0(,%rsi,4),%eax
movslq %eax,%rdx
lea    0x0(,%rcx,4),%eax
cltq
lea    0x0(,%rsi,8),%rdi
shl    $0x3,%rdx
mov    %rdx,0x50(%rsp)
mov    %rdi,0x40(%rsp)
lea    (%rdi,%rdi,2),%rdx
mov    %rdx,0x38(%rsp)
shl    $0x4,%rsi
mov    %rsi,0x60(%rsp)
shl    $0x3,%rax
mov    %rax,0x48(%rsp)
shl    $0x3,%r8
mov    %r8,0x58(%rsp)
xor    %ebp,%ebp
movsd  %xmm0,0x10(%rsp)
mov    %r14d,0x1c(%rsp)
mov    0xc(%rsp),%r13d
nopw   0x0(%rax,%rax,1)
mov    0x40(%rsp),%rax
lea    (%rbx,%rax,1),%rcx
mov    0x60(%rsp),%rax
add    %rbx,%rax
mov    %rax,0x70(%rsp)
mov    0x38(%rsp),%rax
lea    (%rbx,%rax,1),%rax
mov    %rax,0x68(%rsp)
mov    %r13d,(%rsp)
mov    %r12,%rdi
mov    %rbx,%r14
mov    0x20(%rsp),%rbx
mov    %ebx,%esi
mov    %r14,%rdx
mov    %r15,%r8
mov    0x1c(%rsp),%r9d
movsd  0x10(%rsp),%xmm0
call   1040 <_inner_vec2_ddot@plt>
mov    0x58(%rsp),%rax
lea    (%r12,%rax,1),%rdi
mov    %r13d,(%rsp)
mov    %ebx,%esi
mov    %r14,%rbx
mov    0x70(%rsp),%rdx
mov    0x1c(%rsp),%r14d
mov    0x68(%rsp),%rcx
mov    %r15,%r8
mov    %r14d,%r9d
movsd  0x10(%rsp),%xmm0
call   1040 <_inner_vec2_ddot@plt>
movsd  0x10(%rsp),%xmm0
add    $0x4,%ebp
add    0x50(%rsp),%rbx
add    0x48(%rsp),%r12
cmp    0x2c(%rsp),%ebp
jl     11e0 <_dmvec_ddot+0xc0>
mov    0x30(%rsp),%rdx
cmp    %edx,%ebp
mov    0xc(%rsp),%r9d
je     1317 <_dmvec_ddot+0x1f7>
lea    -0x1(%rdx),%eax
cmp    %eax,%ebp
jge    12ef <_dmvec_ddot+0x1cf>
mov    0x28(%rsp),%r13d
movslq %r13d,%rax
lea    (%rbx,%rax,8),%rcx
mov    %r9d,(%rsp)
mov    %r12,%rdi
mov    0x20(%rsp),%rsi
mov    %rbx,%rdx
mov    %r15,%r8
mov    %r14d,%r9d
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <_inner_vec2_ddot@plt>
mov    0xc(%rsp),%r9d
mov    0x30(%rsp),%rdx
movsd  0x10(%rsp),%xmm0
mov    0x20(%rsp),%rax
add    %eax,%eax
cltq
lea    (%r12,%rax,8),%r12
add    %r13d,%r13d
movslq %r13d,%rax
lea    (%rbx,%rax,8),%rbx
or     $0x2,%ebp
cmp    %edx,%ebp
jge    1317 <_dmvec_ddot+0x1f7>
mov    %r12,%rdi
mov    0x20(%rsp),%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_inner_vec_ddot@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_dmvec_ddot(double* %0, double* %1, double* %2, double %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = add nsw i32 %7, -3
%11 = icmp sgt i32 %7, 3
br i1 %11, label %12, label %34
12: ; preds = %9
%13 = sext i32 %5 to i64
%14 = shl nsw i32 %4, 1
%15 = sext i32 %14 to i64
%16 = shl nsw i32 %5, 2
%17 = sext i32 %16 to i64
%18 = shl nsw i32 %4, 2
%19 = sext i32 %18 to i64
br label %20
20: ; preds = %12, %20
%21 = phi double* [ %1, %12 ], [ %30, %20 ]
%22 = phi double* [ %0, %12 ], [ %31, %20 ]
%23 = phi i32 [ 0, %12 ], [ %32, %20 ]
%24 = getelementptr inbounds double, double* %21, i64 %13
%25 = getelementptr inbounds double, double* %24, i64 %13
%26 = getelementptr inbounds double, double* %25, i64 %13
%27 = tail call i32 @_inner_vec2_ddot(double* %22, i32 %4, double* %21, double* %24, double* %2, i32 %6, double %3, i32 %8)
%28 = getelementptr inbounds double, double* %22, i64 %15
%29 = tail call i32 @_inner_vec2_ddot(double* %28, i32 %4, double* %25, double* %26, double* %2, i32 %6, double %3, i32 %8)
%30 = getelementptr inbounds double, double* %21, i64 %17
%31 = getelementptr inbounds double, double* %22, i64 %19
%32 = add nuw nsw i32 %23, 4
%33 = icmp slt i32 %32, %10
br i1 %33, label %20, label %34
34: ; preds = %20, %9
%35 = phi i32 [ 0, %9 ], [ %32, %20 ]
%36 = phi double* [ %0, %9 ], [ %31, %20 ]
%37 = phi double* [ %1, %9 ], [ %30, %20 ]
%38 = icmp eq i32 %35, %7
br i1 %38, label %60, label %39
39: ; preds = %34
%40 = add nsw i32 %7, -1
%41 = icmp slt i32 %35, %40
br i1 %41, label %42, label %53
42: ; preds = %39
%43 = sext i32 %5 to i64
%44 = getelementptr inbounds double, double* %37, i64 %43
%45 = tail call i32 @_inner_vec2_ddot(double* %36, i32 %4, double* %37, double* %44, double* %2, i32 %6, double %3, i32 %8)
%46 = shl nsw i32 %4, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %36, i64 %47
%49 = shl nsw i32 %5, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %37, i64 %50
%52 = or i32 %35, 2
br label %53
53: ; preds = %42, %39
%54 = phi i32 [ %52, %42 ], [ %35, %39 ]
%55 = phi double* [ %48, %42 ], [ %36, %39 ]
%56 = phi double* [ %51, %42 ], [ %37, %39 ]
%57 = icmp slt i32 %54, %7
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = tail call i32 @_inner_vec_ddot(double* %55, i32 %4, double* %56, double* %2, i32 %6, double %3, i32 %8)
br label %60
60: ; preds = %53, %58, %34
ret void
}