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


x86 assembly (clang, -O0):
<_dmvec_solve_forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1238 <_dmvec_solve_forward+0x128>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119f <_dmvec_solve_forward+0x8f>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11b4 <_dmvec_solve_forward+0xa4>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    -0x20(%rbp),%r9d
sub    $0x1,%r9d
sub    -0x24(%rbp),%r9d
movsd  0xe18(%rip),%xmm0
call   1030 <_inner_vec_daxpy@plt>
mov    -0x18(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%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    1158 <_dmvec_solve_forward+0x48>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmvec_solve_forward>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
test   %r9d,%r9d
jle    1195 <_dmvec_solve_forward+0x85>
mov    %ecx,%r15d
mov    %rsi,%rbp
mov    %rdi,%rcx
movslq %r15d,%r13
movslq %r8d,%rax
mov    %r9d,%ebx
add    $0x8,%rbp
lea    0x8(,%rax,8),%r14
shl    $0x3,%r13
jmp    117f <_dmvec_solve_forward+0x6f>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rcx)
add    $0xffffffffffffffff,%rbx
mov    %r12,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
mov    %r15d,%r8d
movsd  0xe94(%rip),%xmm0
mov    %ebx,%r9d
call   1030 <_inner_vec_daxpy@plt>
add    %r14,%rbp
mov    %r12,%rcx
test   %rbx,%rbx
je     1195 <_dmvec_solve_forward+0x85>
lea    (%rcx,%r13,1),%r12
movsd  (%rcx),%xmm0
cmpl   $0x0,0x4(%rsp)
jne    1150 <_dmvec_solve_forward+0x40>
divsd  -0x8(%rbp),%xmm0
jmp    1150 <_dmvec_solve_forward+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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