#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_daxpy(double *, double const *, double *, double,
                                int);
void _dmmat_trid_unb_upper(double *Bc, const double *Ac, double alpha, int unit,
                           int ldB, int ldA, int nRE, int nC) {
  register int i, j;
  register double *b0, *Br;
  register const double *Ar;
  double *Broot = Bc;
  Br = Bc;
  for (i = 0; i < nRE; i++) {
    b0 = Br;
    Bc = Broot;
    for (j = 0; j < nC; j++) {
      _inner_daxpy(Bc, Ac, b0, alpha, i);
      Ar = Ac + i;
      b0[0] = unit ? b0[0] : alpha * b0[0] * Ar[0];
      b0 += ldB;
      Bc += ldB;
    }
    Br++;
    Ac += ldA;
  }
}


x86 assembly (clang, -O0):
<_dmmat_trid_unb_upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1252 <_dmmat_trid_unb_upper+0x142>
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1223 <_dmmat_trid_unb_upper+0x113>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%rdx
movsd  -0x18(%rbp),%xmm0
mov    -0x2c(%rbp),%ecx
call   1030 <_inner_daxpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11c4 <_dmmat_trid_unb_upper+0xb4>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11de <_dmmat_trid_unb_upper+0xce>
movsd  -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1170 <_dmmat_trid_unb_upper+0x60>
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114d <_dmmat_trid_unb_upper+0x3d>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmmat_trid_unb_upper>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,0xc(%rsp)
mov    %rdi,0x18(%rsp)
test   %r9d,%r9d
jle    11da <_dmmat_trid_unb_upper+0xca>
mov    %rsi,%r12
movslq %ecx,%rax
movslq %r8d,%rcx
mov    %rcx,0x28(%rsp)
mov    %r9d,%ecx
mov    %rcx,0x20(%rsp)
shl    $0x3,%rax
mov    %rax,0x30(%rsp)
xor    %r15d,%r15d
xor    %r13d,%r13d
movsd  %xmm0,0x10(%rsp)
jmp    1178 <_dmmat_trid_unb_upper+0x68>
nopl   (%rax)
mov    0x28(%rsp),%rax
lea    (%r12,%rax,8),%r12
add    $0x1,%r13
add    $0x8,%r15
cmp    0x20(%rsp),%r13
je     11da <_dmmat_trid_unb_upper+0xca>
cmpl   $0x0,0x70(%rsp)
jle    1160 <_dmmat_trid_unb_upper+0x50>
mov    0x70(%rsp),%r14d
mov    0x18(%rsp),%rbx
jmp    11b0 <_dmmat_trid_unb_upper+0xa0>
nopl   0x0(%rax,%rax,1)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  (%r12,%r13,8),%xmm1
movsd  %xmm1,0x0(%rbp)
add    0x30(%rsp),%rbx
add    $0xffffffff,%r14d
je     1160 <_dmmat_trid_unb_upper+0x50>
lea    (%rbx,%r15,1),%rbp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
call   1030 <_inner_daxpy@plt>
movsd  (%rbx,%r15,1),%xmm1
cmpl   $0x0,0xc(%rsp)
je     1190 <_dmmat_trid_unb_upper+0x80>
movsd  0x10(%rsp),%xmm0
jmp    11a0 <_dmmat_trid_unb_upper+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_dmmat_trid_unb_upper(double* %0, double* %1, double %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
store double* %0, double** %9
store double* %1, double** %10
store double %2, double* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%23 = load double*, double** %9
store double* %23, double** %22
%24 = load double*, double** %9
store double* %24, double** %20
store i32 0, i32* %17
br label %25
25: ; preds = %85, %8
%26 = load i32, i32* %17
%27 = load i32, i32* %15
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %88
29: ; preds = %25
%30 = load double*, double** %20
store double* %30, double** %19
%31 = load double*, double** %22
store double* %31, double** %9
store i32 0, i32* %18
br label %32
32: ; preds = %75, %29
%33 = load i32, i32* %18
%34 = load i32, i32* %16
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %78
36: ; preds = %32
%37 = load double*, double** %9
%38 = load double*, double** %10
%39 = load double*, double** %19
%40 = load double, double* %11
%41 = load i32, i32* %17
%42 = call i32 @_inner_daxpy(double* %37, double* %38, double* %39, double %40, i32 %41)
%43 = load double*, double** %10
%44 = load i32, i32* %17
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double* %46, double** %21
%47 = load i32, i32* %12
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %36
%50 = load double*, double** %19
%51 = getelementptr inbounds double, double* %50, i64 0
%52 = load double, double* %51
br label %63
53: ; preds = %36
%54 = load double, double* %11
%55 = load double*, double** %19
%56 = getelementptr inbounds double, double* %55, i64 0
%57 = load double, double* %56
%58 = fmul double %54, %57
%59 = load double*, double** %21
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fmul double %58, %61
br label %63
63: ; preds = %53, %49
%64 = phi double [ %52, %49 ], [ %62, %53 ]
%65 = load double*, double** %19
%66 = getelementptr inbounds double, double* %65, i64 0
store double %64, double* %66
%67 = load i32, i32* %13
%68 = load double*, double** %19
%69 = sext i32 %67 to i64
%70 = getelementptr inbounds double, double* %68, i64 %69
store double* %70, double** %19
%71 = load i32, i32* %13
%72 = load double*, double** %9
%73 = sext i32 %71 to i64
%74 = getelementptr inbounds double, double* %72, i64 %73
store double* %74, double** %9
br label %75
75: ; preds = %63
%76 = load i32, i32* %18
%77 = add nsw i32 %76, 1
store i32 %77, i32* %18
br label %32
78: ; preds = %32
%79 = load double*, double** %20
%80 = getelementptr inbounds double, double* %79, i32 1
store double* %80, double** %20
%81 = load i32, i32* %14
%82 = load double*, double** %10
%83 = sext i32 %81 to i64
%84 = getelementptr inbounds double, double* %82, i64 %83
store double* %84, double** %10
br label %85
85: ; preds = %78
%86 = load i32, i32* %17
%87 = add nsw i32 %86, 1
store i32 %87, i32* %17
br label %25
88: ; preds = %25
ret void
}

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