#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_daxpy(double *, int, double const *, double *,
                                    int, double, int);
void _dmvec_trid_axpy_backward(double *Xc, const double *Ac, int unit, int incX,
                               int ldA, int nRE) {
  register int i;
  register double *xr, xtmp;
  register const double *Ar, *Acl;
  Acl = Ac + (nRE - 1) * ldA;
  xr = Xc + (nRE - 1) * incX;
  for (i = nRE; i > 0; i--) {
    Ar = Acl + i - 1;
    _inner_vec_daxpy(xr + incX, incX, Ar + 1, xr, incX, 1.0, nRE - i);
    xr[0] *= unit ? 1.0 : Ar[0];
    xr -= incX;
    Acl -= ldA;
  }
}


x86 assembly (clang, -O0):
<_dmvec_trid_axpy_backward>:
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    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1240 <_dmvec_trid_axpy_backward+0x130>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%esi
mov    -0x40(%rbp),%rdx
add    $0x8,%rdx
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    -0x20(%rbp),%r9d
sub    -0x24(%rbp),%r9d
movsd  0xe41(%rip),%xmm0
call   1030 <_inner_vec_daxpy@plt>
cmpl   $0x0,-0x14(%rbp)
je     11e0 <_dmvec_trid_axpy_backward+0xd0>
movsd  0xe2a(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11ed <_dmvec_trid_axpy_backward+0xdd>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    116c <_dmvec_trid_axpy_backward+0x5c>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmvec_trid_axpy_backward>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0x4(%rsp)
test   %r9d,%r9d
jle    11dc <_dmvec_trid_axpy_backward+0xcc>
mov    %ecx,%r15d
lea    -0x1(%r9),%eax
mov    %eax,%ecx
imul   %r15d,%ecx
movslq %ecx,%rcx
lea    (%rdi,%rcx,8),%rbp
imul   %r8d,%eax
cltq
movslq %r15d,%r14
movslq %r8d,%rcx
mov    %r9d,%r13d
add    %r13,%rax
lea    (%rsi,%rax,8),%r12
shl    $0x3,%rcx
xor    $0xfffffffffffffff8,%rcx
mov    %rcx,0x8(%rsp)
add    $0x1,%r13
shl    $0x3,%r14
mov    %r14,%rax
mov    %r14,0x10(%rsp)
neg    %r14
xor    %ebx,%ebx
jmp    119f <_dmvec_trid_axpy_backward+0x8f>
nopl   0x0(%rax)
mulsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x0(%rbp)
add    $0x1,%ebx
add    0x8(%rsp),%r12
add    $0xffffffffffffffff,%r13
add    %r14,%rbp
cmp    $0x1,%r13
jle    11dc <_dmvec_trid_axpy_backward+0xcc>
mov    0x10(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
mov    %r15d,%esi
mov    %r12,%rdx
mov    %rbp,%rcx
mov    %r15d,%r8d
movsd  0xe44(%rip),%xmm0
mov    %ebx,%r9d
call   1030 <_inner_vec_daxpy@plt>
movsd  0xe34(%rip),%xmm0
cmpl   $0x0,0x4(%rsp)
jne    1180 <_dmvec_trid_axpy_backward+0x70>
movsd  -0x8(%r12),%xmm0
jmp    1180 <_dmvec_trid_axpy_backward+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_dmvec_trid_axpy_backward(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*
%17 = 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
%18 = load double*, double** %8
%19 = load i32, i32* %12
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %11
%22 = mul nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %18, i64 %23
store double* %24, double** %17
%25 = load double*, double** %7
%26 = load i32, i32* %12
%27 = sub nsw i32 %26, 1
%28 = load i32, i32* %10
%29 = mul nsw i32 %27, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %25, i64 %30
store double* %31, double** %14
%32 = load i32, i32* %12
store i32 %32, i32* %13
br label %33
33: ; preds = %78, %6
%34 = load i32, i32* %13
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %81
36: ; preds = %33
%37 = load double*, double** %17
%38 = load i32, i32* %13
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = getelementptr inbounds double, double* %40, i64 -1
store double* %41, double** %16
%42 = load double*, double** %14
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load i32, i32* %10
%47 = load double*, double** %16
%48 = getelementptr inbounds double, double* %47, i64 1
%49 = load double*, double** %14
%50 = load i32, i32* %10
%51 = load i32, i32* %12
%52 = load i32, i32* %13
%53 = sub nsw i32 %51, %52
%54 = call i32 @_inner_vec_daxpy(double* %45, i32 %46, double* %48, double* %49, i32 %50, double 1.000000e+00, i32 %53)
%55 = load i32, i32* %9
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %36
br label %62
58: ; preds = %36
%59 = load double*, double** %16
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
br label %62
62: ; preds = %58, %57
%63 = phi double [ 1.000000e+00, %57 ], [ %61, %58 ]
%64 = load double*, double** %14
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double, double* %65
%67 = fmul double %66, %63
store double %67, double* %65
%68 = load i32, i32* %10
%69 = load double*, double** %14
%70 = sext i32 %68 to i64
%71 = sub i64 0, %70
%72 = getelementptr inbounds double, double* %69, i64 %71
store double* %72, double** %14
%73 = load i32, i32* %11
%74 = load double*, double** %17
%75 = sext i32 %73 to i64
%76 = sub i64 0, %75
%77 = getelementptr inbounds double, double* %74, i64 %76
store double* %77, double** %17
br label %78
78: ; preds = %62
%79 = load i32, i32* %13
%80 = add nsw i32 %79, -1
store i32 %80, i32* %13
br label %33
81: ; preds = %33
ret void
}

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