// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::ludcmp(double*, int, int*, double*)
static int ludcmp(double *A, int n, int *indx, double *d)
{
    double big,s,tmp,*vv=mat(n,1);
    int i,imax=0,j,k;
    
    *d=1.0;
    for (i=0;i<n;i++) {
        big=0.0; for (j=0;j<n;j++) if ((tmp=fabs(A[i+j*n]))>big) big=tmp;
        if (big>0.0) vv[i]=1.0/big; else {free(vv); return -1;}
    }
    for (j=0;j<n;j++) {
        for (i=0;i<j;i++) {
            s=A[i+j*n]; for (k=0;k<i;k++) s-=A[i+k*n]*A[k+j*n]; A[i+j*n]=s;
        }
        big=0.0;
        for (i=j;i<n;i++) {
            s=A[i+j*n]; for (k=0;k<j;k++) s-=A[i+k*n]*A[k+j*n]; A[i+j*n]=s;
            if ((tmp=vv[i]*fabs(s))>=big) {big=tmp; imax=i;}
        }
        if (j!=imax) {
            for (k=0;k<n;k++) {
                tmp=A[imax+k*n]; A[imax+k*n]=A[j+k*n]; A[j+k*n]=tmp;
            }
            *d=-(*d); vv[imax]=vv[j];
        }
        indx[j]=imax;
        if (A[j+j*n]==0.0) {free(vv); return -1;}
        if (j!=n-1) {
            tmp=1.0/A[j+j*n]; for (i=j+1;i<n;i++) A[i+j*n]*=tmp;
        }
    }
    free(vv);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl -0x14(%rbp), %edi
movl $0x1, %esi
callq 0x8c500
movq %rax, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x28(%rbp), %rax
movsd 0x2efd5(%rip), %xmm0    # 0xbbe60
movsd %xmm0, (%rax)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8cf4e
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8ceff
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x30348(%rip), %xmm1    # 0xbd220
pand %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
ucomisd -0x30(%rbp), %xmm0
jbe 0x8cef2
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x8cef4
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x8ceb1
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8cf29
movsd 0x2ef4b(%rip), %xmm0    # 0xbbe60
divsd -0x30(%rbp), %xmm0
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x8cf3e
movq -0x48(%rbp), %rdi
callq 0x9900
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8d2ec
jmp 0x8cf40
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8ce96
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8d2dc
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x8d02f
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x8d004
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movl -0x58(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %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 -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x8cf98
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8cf68
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8d143
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x8d0d9
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movl -0x58(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %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 -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x8d06d
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd -0x38(%rbp), %xmm1
movaps 0x30111(%rip), %xmm2    # 0xbd220
pand %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
ucomisd -0x30(%rbp), %xmm0
jb 0x8d133
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x8d135
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8d03d
movl -0x54(%rbp), %eax
cmpl -0x50(%rbp), %eax
je 0x8d214
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8d1d3
movq -0x10(%rbp), %rax
movl -0x50(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl -0x54(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movl -0x50(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x40(%rbp), %xmm0
movq -0x10(%rbp), %rax
movl -0x54(%rbp), %ecx
movl -0x58(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x8d156
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movl -0x54(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8d25a
jp 0x8d25a
movq -0x48(%rbp), %rdi
callq 0x9900
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8d2ec
movl -0x54(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x8d2cc
movq -0x10(%rbp), %rax
movl -0x54(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd 0x2ebde(%rip), %xmm0    # 0xbbe60
divsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8d2ca
movsd -0x40(%rbp), %xmm0
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8d295
jmp 0x8d2cc
jmp 0x8d2ce
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x8cf55
movq -0x48(%rbp), %rdi
callq 0x9900
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)