#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*/ daxpy_(long *, double *, double *, long *, double *, long *);
int /*<<< orphan*/ dgemv_(char *, long *, long *, double *, double *, long *,
                          double *, long *, double *, double *, long *);
int /*<<< orphan*/ dscal_(long *, double *, double *, long *);
int sqrt(double);
void dmat_chol_l(double **a, double **b, long n) {
  long i;
  long mm;
  long nn;
  long incy = 1;
  double alpha = -1.;
  double beta = 1.;
  double da;
  double db;
  for (i = 0; i < n; ++i) {
    mm = n - i;
    if (i > 0) {
      nn = i;
      dgemv_("t", &nn, &mm, &alpha, &b[i][0], &n, &a[i][0], &incy, &beta,
             &b[i][i], &n);
      dgemv_("t", &nn, &mm, &alpha, &a[i][0], &n, &b[i][0], &incy, &beta,
             &b[i][i], &n);
      dgemv_("t", &nn, &mm, &alpha, &a[i][0], &n, &a[i][0], &incy, &beta,
             &a[i][i], &n);
    }
    da = 1. / sqrt(a[i][i]);
    db = da * -b[i][i] / (2. * a[i][i]);
    dscal_(&mm, &da, &b[i][i], &n);
    daxpy_(&mm, &db, &a[i][i], &n, &b[i][i], &n);
    dscal_(&mm, &da, &a[i][i], &n);
  }
}


x86 assembly (clang, -O0):
<dmat_chol_l>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movq   $0x1,-0x48(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1428 <dmat_chol_l+0x2e8>
mov    -0x28(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jle    12fb <dmat_chol_l+0x1bb>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r14
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r10
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r10
lea    0xe31(%rip),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x28(%rbp),%rax
lea    -0x48(%rbp),%rbx
lea    -0x58(%rbp),%r11
mov    %rax,%r9
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <dgemv_@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r14
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r10
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r10
lea    0xdc3(%rip),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x28(%rbp),%rax
lea    -0x48(%rbp),%rbx
lea    -0x58(%rbp),%r11
mov    %rax,%r9
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <dgemv_@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r14
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r10
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r10
lea    0xd55(%rip),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x28(%rbp),%rax
lea    -0x48(%rbp),%rbx
lea    -0x58(%rbp),%r11
mov    %rax,%r9
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <dgemv_@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <sqrt@plt>
cvtsi2sd %eax,%xmm1
movsd  0xcdf(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  0xc99(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    -0x38(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x28(%rbp),%rcx
call   1030 <dscal_@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
lea    -0x38(%rbp),%rdi
lea    -0x68(%rbp),%rsi
lea    -0x28(%rbp),%r9
mov    %r9,%rcx
call   1050 <daxpy_@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    -0x38(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x28(%rbp),%rcx
call   1030 <dscal_@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1184 <dmat_chol_l+0x44>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmat_chol_l>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x28(%rsp)
movq   $0x1,0x20(%rsp)
movabs $0xbff0000000000000,%rax
mov    %rax,0x8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rsp)
test   %rdx,%rdx
jle    1339 <dmat_chol_l+0x1f9>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %r12d,%r12d
lea    0x40(%rsp),%rbx
lea    0x28(%rsp),%r13
mov    %rsi,0x18(%rsp)
jmp    1267 <dmat_chol_l+0x127>
nop
lea    0x0(,%r12,8),%rbp
mov    (%r14,%r12,8),%rax
movsd  (%rax,%r12,8),%xmm0
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe3a(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
mov    (%r15,%r12,8),%rax
lea    (%rax,%r12,8),%rdx
movsd  (%rax,%r12,8),%xmm0
xorpd  0xe2a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    (%r14,%r12,8),%rax
movsd  (%rax,%r12,8),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %rbx,%rdi
lea    0x38(%rsp),%r15
mov    %r15,%rsi
mov    %r13,%rcx
call   1030 <dscal_@plt>
mov    (%r14,%r12,8),%rdx
add    %rbp,%rdx
mov    0x18(%rsp),%rax
mov    (%rax,%r12,8),%r8
add    %rbp,%r8
mov    %rbx,%rdi
lea    0x30(%rsp),%rsi
mov    %r13,%rcx
mov    %r13,%r9
call   1050 <daxpy_@plt>
add    (%r14,%r12,8),%rbp
mov    %rbx,%rdi
mov    %r15,%rsi
mov    0x18(%rsp),%r15
mov    %rbp,%rdx
mov    %r13,%rcx
call   1030 <dscal_@plt>
add    $0x1,%r12
mov    0x28(%rsp),%rdx
cmp    %r12,%rdx
jle    1339 <dmat_chol_l+0x1f9>
sub    %r12,%rdx
mov    %rdx,0x40(%rsp)
test   %r12,%r12
je     11a0 <dmat_chol_l+0x60>
mov    %r12,0x10(%rsp)
mov    (%r15,%r12,8),%r8
lea    (%r8,%r12,8),%rax
sub    $0x8,%rsp
lea    0xd90(%rip),%rdi
lea    0x18(%rsp),%rsi
mov    %rbx,%rdx
lea    0x10(%rsp),%rcx
mov    %r13,%r9
push   %r13
push   %rax
lea    0x18(%rsp),%rax
push   %rax
lea    0x40(%rsp),%rax
push   %rax
push   (%r14,%r12,8)
call   1040 <dgemv_@plt>
add    $0x30,%rsp
mov    (%r14,%r12,8),%r8
mov    (%r15,%r12,8),%rax
lea    (%rax,%r12,8),%rbp
sub    $0x8,%rsp
lea    0xd4d(%rip),%rdi
lea    0x18(%rsp),%rsi
mov    %rbx,%rdx
lea    0x10(%rsp),%rcx
mov    %r13,%r9
push   %r13
push   %rbp
lea    0x18(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
push   %rax
call   1040 <dgemv_@plt>
add    $0x30,%rsp
mov    (%r14,%r12,8),%r8
lea    (%r8,%r12,8),%rax
sub    $0x8,%rsp
lea    0xd11(%rip),%rdi
lea    0x18(%rsp),%rsi
mov    %rbx,%rdx
lea    0x10(%rsp),%rcx
mov    %r13,%r9
push   %r13
push   %rax
lea    0x18(%rsp),%rax
push   %rax
push   %rbp
push   %r8
call   1040 <dgemv_@plt>
add    $0x30,%rsp
jmp    11a0 <dmat_chol_l+0x60>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"t\00"
define void @dmat_chol_l(double** %0, double** %1, i64 %2) {
%4 = alloca double**
%5 = alloca double**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double** %0, double*** %4
store double** %1, double*** %5
store i64 %2, i64* %6
store i64 1, i64* %10
store double -1.000000e+00, double* %11
store double 1.000000e+00, double* %12
store i64 0, i64* %7
br label %15
15: ; preds = %135, %3
%16 = load i64, i64* %7
%17 = load i64, i64* %6
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %138
19: ; preds = %15
%20 = load i64, i64* %6
%21 = load i64, i64* %7
%22 = sub nsw i64 %20, %21
store i64 %22, i64* %8
%23 = load i64, i64* %7
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %78
25: ; preds = %19
%26 = load i64, i64* %7
store i64 %26, i64* %9
%27 = load double**, double*** %5
%28 = load i64, i64* %7
%29 = getelementptr inbounds double*, double** %27, i64 %28
%30 = load double*, double** %29
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double**, double*** %4
%33 = load i64, i64* %7
%34 = getelementptr inbounds double*, double** %32, i64 %33
%35 = load double*, double** %34
%36 = getelementptr inbounds double, double* %35, i64 0
%37 = load double**, double*** %5
%38 = load i64, i64* %7
%39 = getelementptr inbounds double*, double** %37, i64 %38
%40 = load double*, double** %39
%41 = load i64, i64* %7
%42 = getelementptr inbounds double, double* %40, i64 %41
%43 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %9, i64* %8, double* %11, double* %31, i64* %6, double* %36, i64* %10, double* %12, double* %42, i64* %6)
%44 = load double**, double*** %4
%45 = load i64, i64* %7
%46 = getelementptr inbounds double*, double** %44, i64 %45
%47 = load double*, double** %46
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double**, double*** %5
%50 = load i64, i64* %7
%51 = getelementptr inbounds double*, double** %49, i64 %50
%52 = load double*, double** %51
%53 = getelementptr inbounds double, double* %52, i64 0
%54 = load double**, double*** %5
%55 = load i64, i64* %7
%56 = getelementptr inbounds double*, double** %54, i64 %55
%57 = load double*, double** %56
%58 = load i64, i64* %7
%59 = getelementptr inbounds double, double* %57, i64 %58
%60 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %9, i64* %8, double* %11, double* %48, i64* %6, double* %53, i64* %10, double* %12, double* %59, i64* %6)
%61 = load double**, double*** %4
%62 = load i64, i64* %7
%63 = getelementptr inbounds double*, double** %61, i64 %62
%64 = load double*, double** %63
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double**, double*** %4
%67 = load i64, i64* %7
%68 = getelementptr inbounds double*, double** %66, i64 %67
%69 = load double*, double** %68
%70 = getelementptr inbounds double, double* %69, i64 0
%71 = load double**, double*** %4
%72 = load i64, i64* %7
%73 = getelementptr inbounds double*, double** %71, i64 %72
%74 = load double*, double** %73
%75 = load i64, i64* %7
%76 = getelementptr inbounds double, double* %74, i64 %75
%77 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %9, i64* %8, double* %11, double* %65, i64* %6, double* %70, i64* %10, double* %12, double* %76, i64* %6)
br label %78
78: ; preds = %25, %19
%79 = load double**, double*** %4
%80 = load i64, i64* %7
%81 = getelementptr inbounds double*, double** %79, i64 %80
%82 = load double*, double** %81
%83 = load i64, i64* %7
%84 = getelementptr inbounds double, double* %82, i64 %83
%85 = load double, double* %84
%86 = call i32 @sqrt(double %85)
%87 = sitofp i32 %86 to double
%88 = fdiv double 1.000000e+00, %87
store double %88, double* %13
%89 = load double, double* %13
%90 = load double**, double*** %5
%91 = load i64, i64* %7
%92 = getelementptr inbounds double*, double** %90, i64 %91
%93 = load double*, double** %92
%94 = load i64, i64* %7
%95 = getelementptr inbounds double, double* %93, i64 %94
%96 = load double, double* %95
%97 = fneg double %96
%98 = fmul double %89, %97
%99 = load double**, double*** %4
%100 = load i64, i64* %7
%101 = getelementptr inbounds double*, double** %99, i64 %100
%102 = load double*, double** %101
%103 = load i64, i64* %7
%104 = getelementptr inbounds double, double* %102, i64 %103
%105 = load double, double* %104
%106 = fmul double 2.000000e+00, %105
%107 = fdiv double %98, %106
store double %107, double* %14
%108 = load double**, double*** %5
%109 = load i64, i64* %7
%110 = getelementptr inbounds double*, double** %108, i64 %109
%111 = load double*, double** %110
%112 = load i64, i64* %7
%113 = getelementptr inbounds double, double* %111, i64 %112
%114 = call i32 @dscal_(i64* %8, double* %13, double* %113, i64* %6)
%115 = load double**, double*** %4
%116 = load i64, i64* %7
%117 = getelementptr inbounds double*, double** %115, i64 %116
%118 = load double*, double** %117
%119 = load i64, i64* %7
%120 = getelementptr inbounds double, double* %118, i64 %119
%121 = load double**, double*** %5
%122 = load i64, i64* %7
%123 = getelementptr inbounds double*, double** %121, i64 %122
%124 = load double*, double** %123
%125 = load i64, i64* %7
%126 = getelementptr inbounds double, double* %124, i64 %125
%127 = call i32 @daxpy_(i64* %8, double* %14, double* %120, i64* %6, double* %126, i64* %6)
%128 = load double**, double*** %4
%129 = load i64, i64* %7
%130 = getelementptr inbounds double*, double** %128, i64 %129
%131 = load double*, double** %130
%132 = load i64, i64* %7
%133 = getelementptr inbounds double, double* %131, i64 %132
%134 = call i32 @dscal_(i64* %8, double* %13, double* %133, i64* %6)
br label %135
135: ; preds = %78
%136 = load i64, i64* %7
%137 = add nsw i64 %136, 1
store i64 %137, i64* %7
br label %15
138: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"t\00"
define void @dmat_chol_l(double** nocapture %0, double** nocapture %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i64 %2, i64* %4
%12 = bitcast i64* %5 to i8*
%13 = bitcast i64* %6 to i8*
%14 = bitcast i64* %7 to i8*
store i64 1, i64* %7
%15 = bitcast double* %8 to i8*
store double -1.000000e+00, double* %8
%16 = bitcast double* %9 to i8*
store double 1.000000e+00, double* %9
%17 = bitcast double* %10 to i8*
%18 = bitcast double* %11 to i8*
%19 = icmp sgt i64 %2, 0
br i1 %19, label %20, label %70
20: ; preds = %3, %39
%21 = phi i64 [ %68, %39 ], [ %2, %3 ]
%22 = phi i64 [ %67, %39 ], [ 0, %3 ]
%23 = sub nsw i64 %21, %22
store i64 %23, i64* %5
%24 = icmp eq i64 %22, 0
br i1 %24, label %39, label %25
25: ; preds = %20
store i64 %22, i64* %6
%26 = getelementptr inbounds double*, double** %1, i64 %22
%27 = load double*, double** %26
%28 = getelementptr inbounds double*, double** %0, i64 %22
%29 = load double*, double** %28
%30 = getelementptr inbounds double, double* %27, i64 %22
%31 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %6, i64* %5, double* %8, double* %27, i64* %4, double* %29, i64* %7, double* %9, double* %30, i64* %4)
%32 = load double*, double** %28
%33 = load double*, double** %26
%34 = getelementptr inbounds double, double* %33, i64 %22
%35 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %6, i64* %5, double* %8, double* %32, i64* %4, double* %33, i64* %7, double* %9, double* %34, i64* %4)
%36 = load double*, double** %28
%37 = getelementptr inbounds double, double* %36, i64 %22
%38 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %6, i64* %5, double* %8, double* %36, i64* %4, double* %36, i64* %7, double* %9, double* %37, i64* %4)
br label %39
39: ; preds = %25, %20
%40 = getelementptr inbounds double*, double** %0, i64 %22
%41 = load double*, double** %40
%42 = getelementptr inbounds double, double* %41, i64 %22
%43 = load double, double* %42
%44 = call i32 @sqrt(double %43)
%45 = sitofp i32 %44 to double
%46 = fdiv double 1.000000e+00, %45
store double %46, double* %10
%47 = getelementptr inbounds double*, double** %1, i64 %22
%48 = load double*, double** %47
%49 = getelementptr inbounds double, double* %48, i64 %22
%50 = load double, double* %49
%51 = fneg double %50
%52 = fmul double %46, %51
%53 = load double*, double** %40
%54 = getelementptr inbounds double, double* %53, i64 %22
%55 = load double, double* %54
%56 = fmul double %55, 2.000000e+00
%57 = fdiv double %52, %56
store double %57, double* %11
%58 = call i32 @dscal_(i64* %5, double* %10, double* %49, i64* %4)
%59 = load double*, double** %40
%60 = getelementptr inbounds double, double* %59, i64 %22
%61 = load double*, double** %47
%62 = getelementptr inbounds double, double* %61, i64 %22
%63 = call i32 @daxpy_(i64* %5, double* %11, double* %60, i64* %4, double* %62, i64* %4)
%64 = load double*, double** %40
%65 = getelementptr inbounds double, double* %64, i64 %22
%66 = call i32 @dscal_(i64* %5, double* %10, double* %65, i64* %4)
%67 = add nuw nsw i64 %22, 1
%68 = load i64, i64* %4
%69 = icmp sgt i64 %68, %67
br i1 %69, label %20, label %70
70: ; preds = %39, %3
ret void
}