#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_solve_backward(double *Xc, const double *Ac, int unit, int incX,
                           int ldA, int nRE) {
  register int i;
  double *x0, *x1;
  const double *a11, *A01;
  A01 = Ac + (nRE - 1) * ldA;
  x1 = Xc + (nRE - 1) * incX;
  x0 = Xc;
  for (i = nRE - 1; i >= 0; i--) {
    a11 = A01 + i;
    x1[0] = unit ? x1[0] : x1[0] / a11[0];
    _inner_vec_daxpy(x0, incX, A01, x1, incX, -1.0, i);
    x1 -= incX;
    A01 -= ldA;
  }
}


x86 assembly (clang, -O0):
<_dmvec_solve_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,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1238 <_dmvec_solve_backward+0x128>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11b0 <_dmvec_solve_backward+0xa0>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11c5 <_dmvec_solve_backward+0xb5>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    -0x24(%rbp),%r9d
movsd  0xe0f(%rip),%xmm0
call   1030 <_inner_vec_daxpy@plt>
mov    -0x18(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%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    1177 <_dmvec_solve_backward+0x67>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmvec_solve_backward>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,0xc(%rsp)
mov    %rdi,0x10(%rsp)
test   %r9d,%r9d
jle    11e7 <_dmvec_solve_backward+0xd7>
mov    %ecx,%r12d
add    $0xffffffff,%r9d
mov    %r9d,%eax
imul   %ecx,%eax
cltq
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    %r9d,%r13d
imul   %r8d,%r9d
movslq %r9d,%rax
lea    (%rsi,%rax,8),%rbx
movslq %r12d,%r15
movslq %r8d,%rcx
add    %r13,%rax
lea    (%rsi,%rax,8),%r14
shl    $0x3,%rcx
mov    %rcx,%rax
xor    $0xfffffffffffffff8,%rax
mov    %rax,0x18(%rsp)
neg    %rcx
mov    %rcx,0x20(%rsp)
shl    $0x3,%r15
neg    %r15
jmp    11d9 <_dmvec_solve_backward+0xc9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x0(%rbp),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x0(%rbp)
mov    0x10(%rsp),%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r12d,%r8d
movsd  0xe48(%rip),%xmm0
mov    %r13d,%r9d
call   1030 <_inner_vec_daxpy@plt>
lea    -0x1(%r13),%rax
add    0x18(%rsp),%r14
add    0x20(%rsp),%rbx
add    %r15,%rbp
test   %r13,%r13
mov    %rax,%r13
jle    11e7 <_dmvec_solve_backward+0xd7>
cmpl   $0x0,0xc(%rsp)
je     1190 <_dmvec_solve_backward+0x80>
movsd  0x0(%rbp),%xmm0
jmp    119a <_dmvec_solve_backward+0x8a>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_dmvec_solve_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** %15
%32 = load double*, double** %7
store double* %32, double** %14
%33 = load i32, i32* %12
%34 = sub nsw i32 %33, 1
store i32 %34, i32* %13
br label %35
35: ; preds = %78, %6
%36 = load i32, i32* %13
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %81
38: ; preds = %35
%39 = load double*, double** %17
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double* %42, double** %16
%43 = load i32, i32* %9
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %38
%46 = load double*, double** %15
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
br label %57
49: ; preds = %38
%50 = load double*, double** %15
%51 = getelementptr inbounds double, double* %50, i64 0
%52 = load double, double* %51
%53 = load double*, double** %16
%54 = getelementptr inbounds double, double* %53, i64 0
%55 = load double, double* %54
%56 = fdiv double %52, %55
br label %57
57: ; preds = %49, %45
%58 = phi double [ %48, %45 ], [ %56, %49 ]
%59 = load double*, double** %15
%60 = getelementptr inbounds double, double* %59, i64 0
store double %58, double* %60
%61 = load double*, double** %14
%62 = load i32, i32* %10
%63 = load double*, double** %17
%64 = load double*, double** %15
%65 = load i32, i32* %10
%66 = load i32, i32* %13
%67 = call i32 @_inner_vec_daxpy(double* %61, i32 %62, double* %63, double* %64, i32 %65, double -1.000000e+00, i32 %66)
%68 = load i32, i32* %10
%69 = load double*, double** %15
%70 = sext i32 %68 to i64
%71 = sub i64 0, %70
%72 = getelementptr inbounds double, double* %69, i64 %71
store double* %72, double** %15
%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 = %57
%79 = load i32, i32* %13
%80 = add nsw i32 %79, -1
store i32 %80, i32* %13
br label %35
81: ; preds = %35
ret void
}

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