// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/lambda.cpp
// Function: bamboo::LD(int, double const*, double*, double*)
static int LD(int n, const double *Q, double *L, double *D)
{
    int i,j,k,info=0;
    double a,*A=mat(n,n);
    
    memcpy(A,Q,sizeof(double)*n*n);
    for (i=n-1;i>=0;i--) {
        if ((D[i]=A[i+i*n])<=0.0) {info=-1; break;}
        a=sqrt(D[i]);
        for (j=0;j<=i;j++) L[i+j*n]=A[i+j*n]/a;
        for (j=0;j<=i-1;j++) for (k=0;k<=j;k++) A[j+k*n]-=L[i+k*n]*L[i+j*n];
        for (j=0;j<=i;j++) L[i+j*n]/=L[i+i*n];
    }
    free(A);
    if (info) fprintf(stderr,"%s : LD factorization error\n",__FILE__);
    return info;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, -0x30(%rbp)
movq %rdx, %r15
movq %rsi, %r13
movl %edi, %r12d
movl %edi, %esi
callq 0x4e5e2
movq %rax, %rbx
movl %r12d, %r14d
movq %r14, %rdx
imulq %r14, %rdx
shlq $0x3, %rdx
movq %rax, %rdi
movq %r13, %rsi
callq 0x84f0
movq %r12, %r8
testl %r8d, %r8d
setle %cl
jle 0x3309d
leal 0x1(%r8), %eax
leaq -0x1(%r14), %rsi
movl %esi, %r13d
movl %eax, -0x34(%rbp)
imull %eax, %r13d
movsd (%rbx,%r13,8), %xmm0
movq -0x30(%rbp), %rdx
movsd %xmm0, -0x8(%rdx,%r14,8)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
movq %rbx, %rdi
jae 0x330a8
movq %r14, %r9
decl %r8d
leaq (,%r14,8), %rbx
leaq (%rdi,%r14,8), %r14
addq $-0x8, %r14
leaq (%r15,%r9,8), %r12
addq $-0x8, %r12
movq %r9, %r10
movq %r9, -0x50(%rbp)
movq %rdi, -0x58(%rbp)
ucomisd %xmm2, %xmm0
movq %rsi, -0x48(%rbp)
movq %r10, -0x40(%rbp)
jb 0x32f85
sqrtsd %xmm0, %xmm0
jmp 0x32faa
movq %r8, -0x60(%rbp)
callq 0x84e0
movq -0x40(%rbp), %r10
movq -0x48(%rbp), %rsi
xorpd %xmm2, %xmm2
movq -0x50(%rbp), %r9
movq -0x60(%rbp), %r8
movq -0x30(%rbp), %rdx
movq -0x58(%rbp), %rdi
movq %r10, %rax
xorl %ecx, %ecx
movsd (%r14,%rcx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r12,%rcx)
addq %rbx, %rcx
decq %rax
jne 0x32faf
movq %r10, %rax
movq %r12, %rcx
cmpq $0x2, %r10
jl 0x3303d
leaq (%r15,%rsi,8), %rax
movl $0x1, %ecx
movq %rdi, %rdx
xorl %esi, %esi
movq %r8, %r11
movq %rsi, %r10
imulq %r9, %r10
movq %rcx, %r8
xorl %r9d, %r9d
movsd (%r12,%r9), %xmm0
movsd (%rdx,%r9), %xmm1
mulsd (%rax,%r10,8), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%r9)
addq %rbx, %r9
decq %r8
jne 0x32ff1
incq %rsi
incq %rcx
addq $0x8, %rdx
movq %r11, %r8
cmpq %r11, %rsi
movq -0x50(%rbp), %r9
jne 0x32fe1
movq -0x40(%rbp), %r10
movq %r10, %rax
movq %r12, %rcx
movq -0x30(%rbp), %rdx
movq -0x48(%rbp), %rsi
movsd (%rcx), %xmm0
divsd (%r15,%r13,8), %xmm0
movsd %xmm0, (%rcx)
addq %rbx, %rcx
decq %rax
jne 0x3303d
cmpq $0x2, %r10
setl %r11b
jl 0x330ad
decq %r8
leaq -0x1(%rsi), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %r13d
imull %eax, %r13d
movsd (%rdi,%r13,8), %xmm0
movsd %xmm0, -0x8(%rdx,%rsi,8)
addq $-0x8, %r14
addq $-0x8, %r12
decq %r10
ucomisd %xmm0, %xmm2
movq %rax, %rsi
jb 0x32f71
movl %r11d, %r14d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x330b3
movl %ecx, %r14d
xorl %r12d, %r12d
movq %rbx, %rdi
jmp 0x330b3
movl %ecx, %r14d
jmp 0x330b3
movl %r11d, %r14d
xorl %r12d, %r12d
callq 0x87b0
testb %r14b, %r14b
je 0x330cf
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8e84
jmp 0x330bd