#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_ddot_trans(double *, double const *, double *, double,
                                     int, int);
void _dmmat_trid_unb_r_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, *Bcl;
  register const double *Ar, *Acl;
  double btmp;
  Acl = Ac + (nC - 1) * ldA;
  Bcl = Bc + (nC - 1) * ldB;
  for (j = nC; j > 0; j--) {
    Br = Bc;
    b0 = Bcl;
    for (i = 0; i < nRE; i++) {
      Ar = Acl;
      btmp = unit ? alpha * b0[0] : 0.0;
      _inner_ddot_trans(&btmp, Ar, Br, alpha, j - unit, ldB);
      b0[0] = btmp;
      b0++;
      Br++;
    }
    Bcl -= ldB;
    Acl -= ldA;
  }
}


x86 assembly (clang, -O0):
<_dmmat_trid_unb_r_upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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    -0x10(%rbp),%rax
mov    0x10(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    1276 <_dmmat_trid_unb_r_upper+0x166>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1234 <_dmmat_trid_unb_r_upper+0x124>
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11ca <_dmmat_trid_unb_r_upper+0xba>
movsd  -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    11d7 <_dmmat_trid_unb_r_upper+0xc7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    11d7 <_dmmat_trid_unb_r_upper+0xc7>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x50(%rbp),%rsi
mov    -0x40(%rbp),%rdx
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    -0x60(%rbp),%rdi
call   1030 <_inner_ddot_trans@plt>
movsd  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1195 <_dmmat_trid_unb_r_upper+0x85>
mov    -0x20(%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),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1174 <_dmmat_trid_unb_r_upper+0x64>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dmmat_trid_unb_r_upper>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9d,(%rsp)
mov    %ecx,0x4(%rsp)
mov    %rdi,0x18(%rsp)
mov    0x70(%rsp),%eax
mov    %rax,0x8(%rsp)
test   %eax,%eax
jle    1212 <_dmmat_trid_unb_r_upper+0x102>
mov    %edx,%ebx
mov    0x70(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    0x4(%rsp),%edx
imul   %edx,%ecx
movslq %ecx,%r13
imul   %r8d,%eax
cltq
lea    (%rsi,%rax,8),%rbp
movslq %edx,%rax
movslq %r8d,%rcx
neg    %rcx
mov    %rcx,0x20(%rsp)
shl    $0x3,%r13
shl    $0x3,%rax
mov    %rax,0x28(%rsp)
movsd  %xmm0,0x30(%rsp)
jmp    11a1 <_dmmat_trid_unb_r_upper+0x91>
xchg   %ax,%ax
mov    0x20(%rsp),%rax
lea    0x0(%rbp,%rax,8),%rbp
mov    0x8(%rsp),%rcx
lea    -0x1(%rcx),%eax
sub    0x28(%rsp),%r13
cmp    $0x1,%ecx
mov    %rax,0x8(%rsp)
jle    1212 <_dmmat_trid_unb_r_upper+0x102>
cmpl   $0x0,(%rsp)
jle    1180 <_dmmat_trid_unb_r_upper+0x70>
mov    0x8(%rsp),%rax
mov    %eax,%r15d
sub    %ebx,%r15d
mov    (%rsp),%r12d
mov    0x18(%rsp),%r14
jmp    1208 <_dmmat_trid_unb_r_upper+0xf8>
nopl   (%rax)
movsd  (%r14,%r13,1),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    0x4(%rsp),%r8d
call   1030 <_inner_ddot_trans@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%r14,%r13,1)
add    $0x8,%r14
add    $0xffffffff,%r12d
je     1180 <_dmmat_trid_unb_r_upper+0x70>
test   %ebx,%ebx
jne    11c0 <_dmmat_trid_unb_r_upper+0xb0>
xorpd  %xmm1,%xmm1
jmp    11ca <_dmmat_trid_unb_r_upper+0xba>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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