// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/sparse.c
// Function: sp_ludcmp
int sp_ludcmp(sp_num *N, sp_mat *A, double pivtol){
	double pivot, *Lx, *Ux, *x, a, t;
	int *Lp, *Li, *Up, *Ui, *pinv, *pvec, *q;
	int n, ipiv, k, top, p, i, col, lnz, unz;
	n = A->ncols; q = N->q;
	Li = N->L->Ai; Lp = N->L->Ap; Lx = N->L->Ax;
	Ui = N->U->Ai; Up = N->U->Ap; Ux = N->U->Ax;
	lnz = 0; unz = 0;
	x = N->w; pinv = N->pinv; pvec = N->p;
	for (i=0; i<n; i++) x[i]=0;
	for (i=0; i<n; i++) pinv[i] = -1;
	for (k=0; k<=n; k++) Lp[k] = 0;

	for(k=0; k<n; k++){
		/* Triangular solve: */
		Lp[k] = lnz;
		Up[k] = unz;
		col = q ? (q[k]) : k;

		top = reachr(N->L, A, col, N->xi[k], pinv);
		N->topvec[k] = top;
		sp_splsolve(N->L, A, col, N->xi[k], top, x, pinv);
		/* Find pivot: */
		ipiv = -1;
		a = -1;
		for(p=top; p<n; p++){
			i = N->xi[k][p];
			if (pinv[i]<0){
				t = fabs(x[i]);
				if (t>a){
					a = t;
					ipiv = i;
				}
			}
			else{
				Ui[unz] = pinv[i];
				Ux[unz] = x[i];
				unz++;
			}
		}
		if ((ipiv == -1)||(a<=0)) return _FAILURE_;
		if ((pinv[col]<0) && (fabs(x[col])>=a*pivtol)) ipiv = col;
		/* Divide by pivot: */
		pivot = x[ipiv];
		Ui[unz] = k;
		Ux[unz] = pivot;
		unz++;
		pinv[ipiv] = k;
		pvec[k] = ipiv;
		Li[lnz] = ipiv;
		Lx[lnz] = 1.0;
		lnz++;
		for (p=top; p<n; p++){
			i = N->xi[k][p];
			if (pinv[i]<0){
				Li[lnz] = i;
				Lx[lnz] = x[i]/pivot;
				lnz++;
			}
			x[i] = 0;
		}
	}
	/* Finalize: */
	Lp[n] = lnz;
	Up[n] = unz;
	for(p=0; p<lnz; p++) Li[p] = pinv[Li[p]];
	return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movsd %xmm0, 0x40(%rsp)
movq %rdi, %r15
movq %rsi, 0x28(%rsp)
movslq (%rsi), %r10
movq 0x38(%rdi), %r8
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
movq 0x10(%rax), %rdi
movq 0x18(%rax), %rsi
movq 0x20(%rax), %r11
movq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rcx), %rax
movq %rax, 0x38(%rsp)
movq 0x20(%rcx), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%r15), %r12
movq 0x28(%r15), %rbx
movq 0x30(%r15), %rax
movq %rax, 0x50(%rsp)
xorl %eax, %eax
testl %r10d, %r10d
movl $0x0, %ecx
cmovgl %r10d, %ecx
cmpq %rax, %rcx
je 0xa49d
andq $0x0, (%r12,%rax,8)
incq %rax
jmp 0xa48e
xorl %eax, %eax
cmpq %rax, %rcx
je 0xa4ad
orl $-0x1, (%rbx,%rax,4)
incq %rax
jmp 0xa49f
xorl %eax, %eax
cmpq %r10, %rax
jg 0xa4bd
andl $0x0, (%rdi,%rax,4)
incq %rax
jmp 0xa4af
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %ebp, %ebp
movq %rsi, 0x60(%rsp)
movq %r10, 0x70(%rsp)
movq %r8, 0x58(%rsp)
movq %rdi, 0x18(%rsp)
movq %r11, 0x68(%rsp)
movq %rcx, 0x48(%rsp)
cmpq %rcx, %r13
je 0xa6b0
movl %r14d, (%rdi,%r13,4)
movq 0x20(%rsp), %rax
movl %ebp, (%rax,%r13,4)
movl %r13d, %edx
testq %r8, %r8
je 0xa505
movl (%r8,%r13,4), %edx
movl %edx, 0x10(%rsp)
movq 0x8(%r15), %rdi
movq 0x18(%r15), %rax
movq (%rax,%r13,8), %rcx
movq 0x28(%rsp), %rsi
movq %rbx, %r8
callq 0xa1f3
movq 0x20(%r15), %rcx
movl %eax, (%rcx,%r13,4)
movl %eax, %r8d
movl %eax, 0x14(%rsp)
movq 0x8(%r15), %rdi
movq 0x18(%r15), %rax
movq (%rax,%r13,8), %rcx
movq %rbx, (%rsp)
movq 0x28(%rsp), %rsi
movl 0x10(%rsp), %edx
movq %r12, %r9
callq 0xa34f
movslq 0x14(%rsp), %rax
movq %rax, %rdx
pushq $-0x1
popq %rcx
movsd 0xdb283(%rip), %xmm0    # 0xe57e8
movq 0x70(%rsp), %r10
movq 0x68(%rsp), %r11
movapd 0xdacc9(%rip), %xmm2    # 0xe5240
movslq %ebp, %rsi
cmpq %r10, %rdx
jge 0xa5d2
movq 0x18(%r15), %rdi
movq (%rdi,%r13,8), %rdi
movl (%rdi,%rdx,4), %edi
movslq %edi, %r8
movl (%rbx,%r8,4), %r9d
testl %r9d, %r9d
js 0xa5b3
movq 0x38(%rsp), %rdi
movl %r9d, (%rdi,%rsi,4)
movsd (%r12,%r8,8), %xmm1
movq 0x30(%rsp), %rdi
movsd %xmm1, (%rdi,%rsi,8)
incl %ebp
jmp 0xa5c9
movsd (%r12,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0xa5c9
movapd %xmm1, %xmm0
jmp 0xa5cb
movl %ecx, %edi
incq %rdx
movl %edi, %ecx
jmp 0xa577
cmpl $-0x1, %ecx
je 0xa6dc
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0xa6dc
movslq 0x10(%rsp), %rdx
cmpl $0x0, (%rbx,%rdx,4)
js 0xa5fb
movq 0x18(%rsp), %rdi
jmp 0xa61a
movsd (%r12,%rdx,8), %xmm1
andpd %xmm2, %xmm1
mulsd 0x40(%rsp), %xmm0
ucomisd %xmm0, %xmm1
movq 0x18(%rsp), %rdi
jb 0xa61a
movl 0x10(%rsp), %ecx
movslq %ecx, %rcx
movsd (%r12,%rcx,8), %xmm0
movq 0x38(%rsp), %rdx
movl %r13d, (%rdx,%rsi,4)
movq 0x30(%rsp), %rdx
movsd %xmm0, (%rdx,%rsi,8)
movl %r13d, (%rbx,%rcx,4)
movq 0x50(%rsp), %rdx
movl %ecx, (%rdx,%r13,4)
movslq %r14d, %rdx
movq 0x60(%rsp), %rsi
movl %ecx, (%rsi,%rdx,4)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%r11,%rdx,8)
incl %r14d
movq 0x58(%rsp), %r8
cmpq %r10, %rax
jge 0xa6a1
movq 0x18(%r15), %rcx
movq (%rcx,%r13,8), %rcx
movl (%rcx,%rax,4), %ecx
movslq %ecx, %rcx
cmpl $0x0, (%rbx,%rcx,4)
jns 0xa697
movslq %r14d, %r14
movl %ecx, (%rsi,%r14,4)
movsd (%r12,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r11,%r14,8)
incl %r14d
andq $0x0, (%r12,%rcx,8)
incq %rax
jmp 0xa664
incl %ebp
incq %r13
movq 0x48(%rsp), %rcx
jmp 0xa4e3
movl %r14d, (%rdi,%r10,4)
movq 0x20(%rsp), %rax
movl %ebp, (%rax,%r10,4)
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
xorl %edx, %edx
cmpq %rdx, %r14
je 0xa6df
movslq (%rsi,%rdx,4), %rcx
movl (%rbx,%rcx,4), %ecx
movl %ecx, (%rsi,%rdx,4)
incq %rdx
jmp 0xa6c8
pushq $0x1
popq %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq