// File: 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
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x4(%rbp), %edi
movl -0x4(%rbp), %esi
callq 0x8c500
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x4(%rbp), %rdx
shlq $0x3, %rdx
movslq -0x4(%rbp), %rax
imulq %rax, %rdx
callq 0x9610
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x616ce
movq -0x40(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x24(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd %xmm1, (%rax,%rcx,8)
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x61557
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
jmp 0x616ce
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x95e0
movsd %xmm0, -0x38(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x615bd
movq -0x40(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
divsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x61575
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x6166b
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0x6165b
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x2c(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x40(%rbp), %rax
movl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x615dc
jmp 0x6165d
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x615c4
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x616be
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x24(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %edx
imull -0x4(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x61672
jmp 0x616c0
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x61513
movq -0x40(%rbp), %rdi
callq 0x9900
cmpl $0x0, -0x30(%rbp)
je 0x616fc
movq 0x958e4(%rip), %rax     # 0xf6fc8
movq (%rax), %rdi
leaq 0x5d6fd(%rip), %rsi     # 0xbedeb
leaq 0x5d713(%rip), %rdx     # 0xbee08
movb $0x0, %al
callq 0x9a90
movl -0x30(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)