// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/choldc.c
// Function: choldc
int choldc(double **L, double **a, int N)
{
  int i, j, k, ik, jk;
  double sum, diag[N];
  for(i=0; i<N; i++){
    for(j=i; j<N; j++){
      sum=a[i][j];
      for(k=i-1; k>=0; k--)sum-=L[i][k]*L[j][k];
      if(j==i){
	if(sum<EPS){
	  printf("WARNING, Choldc failed L_ii^2= %.2g i=%d\n", sum, i);
	  if(L==a){
	    // Ugo: Same matrix, restore lower diagonal
	    for(ik=0; ik<i; ik++){
	      a[ik][ik]=diag[ik];
	      for(jk=ik+1; jk<N; jk++)a[jk][ik]=a[ik][jk];
	    }
	  }
	  //exit(8);
	  return(-1);
	}
	diag[i]=a[i][i]; L[i][i]=sqrt(sum);
      }else{
	L[j][i]=sum/L[i][i]; // j<=i 
      }
    }
  }
  return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x40(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x69794
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x69784
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jl 0x69626
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x38(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x695c2
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x69745
movsd 0x19d5e(%rip), %xmm0    # 0x83398
ucomisd -0x38(%rbp), %xmm0
jbe 0x69702
movsd -0x38(%rbp), %xmm0
movl -0x20(%rbp), %esi
leaq 0x19d4c(%rip), %rdi     # 0x833a0
movb $0x1, %al
callq 0x10d0
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x696ef
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x696ed
movq -0x58(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x696e0
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x696a3
jmp 0x696e2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x69670
jmp 0x696ef
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x4c(%rbp)
jmp 0x697a2
movq -0x58(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x20(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x38(%rbp), %xmm0
callq 0x1220
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x69774
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
divsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x69776
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x69593
jmp 0x69786
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x69581
movl $0x0, -0x4(%rbp)
movl $0x1, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)