#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_vec_ddot(double *, int, double const *, double *, int,
                                   double, int);
void _dmvec_trid_dot_forward(double *Xc, const double *Ac, int unit, int incX,
                             int ldA, int nRE) {
  register int i;
  register double *x1;
  double xtmp;
  register const double *a11;
  x1 = Xc;
  for (i = 0; i < nRE; i++) {
    a11 = Ac + i + unit;
    xtmp = unit ? x1[0] : 0.0;
    _inner_vec_ddot(&xtmp, 1, a11, x1, incX, 1.0, nRE - unit - i);
    x1[0] = xtmp;
    x1 += incX;
    Ac += ldA;
  }
}


x86 assembly (clang, -O0):
<_dmvec_trid_dot_forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    120d <_dmvec_trid_dot_forward+0xfd>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1183 <_dmvec_trid_dot_forward+0x73>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1190 <_dmvec_trid_dot_forward+0x80>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1190 <_dmvec_trid_dot_forward+0x80>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    -0x20(%rbp),%r9d
sub    -0x14(%rbp),%r9d
sub    -0x24(%rbp),%r9d
lea    -0x38(%rbp),%rdi
mov    $0x1,%esi
movsd  0xe3d(%rip),%xmm0
call   1030 <_inner_vec_ddot@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <_dmvec_trid_dot_forward+0x2d>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmvec_trid_dot_forward>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
mov    %edx,0x8(%rsp)
test   %r9d,%r9d
jle    11b2 <_dmvec_trid_dot_forward+0xa2>
mov    %rdi,%rbx
movslq 0x8(%rsp),%r13
movslq 0xc(%rsp),%r12
movslq %r8d,%rax
mov    %r9d,%r14d
lea    (%rsi,%r13,8),%rbp
lea    0x8(,%rax,8),%r15
neg    %r13d
shl    $0x3,%r12
jmp    11a6 <_dmvec_trid_dot_forward+0x96>
nopw   0x0(%rax,%rax,1)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%r14,%r13,1),%r9d
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0xc(%rsp),%r8d
movsd  0xe75(%rip),%xmm0
call   1030 <_inner_vec_ddot@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    %r15,%rbp
add    %r12,%rbx
add    $0xffffffffffffffff,%r14
je     11b2 <_dmvec_trid_dot_forward+0xa2>
cmpl   $0x0,0x8(%rsp)
jne    1160 <_dmvec_trid_dot_forward+0x50>
xorps  %xmm0,%xmm0
jmp    1164 <_dmvec_trid_dot_forward+0x54>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_dmvec_trid_dot_forward(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca double
%8 = bitcast double* %7 to i8*
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %35
10: ; preds = %6
%11 = sext i32 %2 to i64
%12 = icmp eq i32 %2, 0
%13 = sext i32 %3 to i64
%14 = sext i32 %4 to i64
%15 = zext i32 %5 to i64
br label %16
16: ; preds = %10, %24
%17 = phi i64 [ 0, %10 ], [ %33, %24 ]
%18 = phi double* [ %1, %10 ], [ %32, %24 ]
%19 = phi double* [ %0, %10 ], [ %31, %24 ]
%20 = getelementptr inbounds double, double* %18, i64 %11
%21 = getelementptr inbounds double, double* %20, i64 %17
br i1 %12, label %24, label %22
22: ; preds = %16
%23 = load double, double* %19
br label %24
24: ; preds = %16, %22
%25 = phi double [ %23, %22 ], [ 0.000000e+00, %16 ]
store double %25, double* %7
%26 = trunc i64 %17 to i32
%27 = add i32 %26, %2
%28 = sub i32 %5, %27
%29 = call i32 @_inner_vec_ddot(double* %7, i32 1, double* %21, double* %19, i32 %3, double 1.000000e+00, i32 %28)
%30 = load double, double* %7
store double %30, double* %19
%31 = getelementptr inbounds double, double* %19, i64 %13
%32 = getelementptr inbounds double, double* %18, i64 %14
%33 = add nuw nsw i64 %17, 1
%34 = icmp eq i64 %33, %15
br i1 %34, label %35, label %16
35: ; preds = %24, %6
ret void
}