// File: /workspace/github_c_makefile_star2_O3/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, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movl (%rsi), %r15d
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rax
movq 0x10(%rcx), %r12
movq 0x10(%rax), %rdx
movq %rdx, 0x18(%rsp)
testl %r15d, %r15d
jle 0xbce1
movq %rdi, %r8
movq 0x38(%rdi), %rdx
movq %rdx, 0x70(%rsp)
movq 0x18(%rcx), %rdx
movq %rdx, 0x68(%rsp)
movq 0x20(%rcx), %rcx
movq %rcx, 0x28(%rsp)
movq 0x18(%rax), %rbp
movq 0x20(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x48(%rdi), %r13
movq 0x28(%rdi), %r14
movq 0x30(%rdi), %rax
movq %rax, 0x50(%rsp)
leaq (,%r15,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
movq %r8, %rbx
callq 0x8200
leaq (,%r15,4), %rdx
movq %r14, %rdi
movl $0xff, %esi
callq 0x8200
leaq 0x4(,%r15,4), %rdx
movq %r12, 0x30(%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
xorl %ecx, %ecx
movq %rbp, %r11
movq %rbx, %r10
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %r11, 0x60(%rsp)
movq %rbx, 0x38(%rsp)
movq 0x30(%rsp), %rax
movl %r12d, (%rax,%rcx,4)
movq 0x18(%rsp), %rax
movl %ebp, (%rax,%rcx,4)
movl %ecx, %edx
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0xbad2
movl (%rax,%rcx,4), %edx
movq 0x8(%r10), %rdi
movq 0x18(%r10), %rax
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %rcx
movq 0x40(%rsp), %rsi
movl %edx, 0xc(%rsp)
movq %r14, %r8
callq 0xb783
movl %eax, %ebx
movq 0x38(%rsp), %rdx
movq 0x20(%rdx), %rax
movq 0x10(%rsp), %rcx
movl %ebx, (%rax,%rcx,4)
movq 0x8(%rdx), %rdi
movq 0x18(%rdx), %rax
movq (%rax,%rcx,8), %rcx
movq %r14, (%rsp)
movq 0x40(%rsp), %rsi
movl 0xc(%rsp), %edx
movl %ebx, %r8d
movq %r13, %r9
callq 0xb900
movl $0x1, %eax
cmpl %r15d, %ebx
jge 0xbd09
movq 0x38(%rsp), %r10
movq 0x18(%r10), %rcx
movq 0x10(%rsp), %rdx
movq (%rcx,%rdx,8), %rdx
movl %ebx, 0x24(%rsp)
movslq %ebx, %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movsd 0xe2c89(%rip), %xmm0    # 0xee7e8
movq 0x60(%rsp), %r11
movq 0x58(%rsp), %rbx
movapd 0xe26cf(%rip), %xmm2    # 0xee240
movl (%rdx,%rsi,4), %edi
movslq %edi, %r8
movl (%r14,%r8,4), %r9d
testl %r9d, %r9d
js 0xbb97
movslq %ebp, %rbp
movl %r9d, (%r11,%rbp,4)
movsd (%r13,%r8,8), %xmm1
movsd %xmm1, (%rbx,%rbp,8)
incl %ebp
jmp 0xbbae
movsd (%r13,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbbae
movl %edi, %ecx
movapd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %r15
jne 0xbb71
cmpl $-0x1, %ecx
movq 0x68(%rsp), %rdi
je 0xbd09
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0xbd09
movl 0xc(%rsp), %edx
movslq %edx, %rax
cmpl $0x0, (%r14,%rax,4)
js 0xbbe7
movq 0x28(%rsp), %rsi
jmp 0xbc05
movsd (%r13,%rax,8), %xmm1
andpd %xmm2, %xmm1
mulsd 0x48(%rsp), %xmm0
ucomisd %xmm0, %xmm1
movq 0x28(%rsp), %rsi
jb 0xbc05
movl %edx, %ecx
movslq %ecx, %rax
movsd (%r13,%rax,8), %xmm0
movslq %ebp, %rcx
movq 0x10(%rsp), %r8
movl %r8d, (%r11,%rcx,4)
movsd %xmm0, (%rbx,%rcx,8)
movl %r8d, (%r14,%rax,4)
movq 0x50(%rsp), %rcx
movl %eax, (%rcx,%r8,4)
movslq %r12d, %rcx
movl %eax, (%rdi,%rcx,4)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rsi,%rcx,8)
leal 0x1(%r12), %edx
movl 0x24(%rsp), %ecx
cmpl %r15d, %ecx
jge 0xbc98
movq 0x18(%r10), %rax
movq (%rax,%r8,8), %rax
movslq %ecx, %rcx
movl %edx, %r12d
movl (%rax,%rcx,4), %edx
movslq %edx, %rdx
cmpl $0x0, (%r14,%rdx,4)
jns 0xbc85
movslq %r12d, %r12
movl %edx, (%rdi,%r12,4)
movsd (%r13,%rdx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsi,%r12,8)
incl %r12d
movq $0x0, (%r13,%rdx,8)
incq %rcx
cmpq %rcx, %r15
jne 0xbc5d
jmp 0xbc9b
movl %edx, %r12d
incl %ebp
movq 0x10(%rsp), %rcx
incq %rcx
cmpq %r15, %rcx
jne 0xbab2
movq 0x30(%rsp), %rax
movl %r12d, (%rax,%r15,4)
movq 0x18(%rsp), %rax
movl %ebp, (%rax,%r15,4)
testl %r12d, %r12d
jle 0xbd18
movl %r12d, %ecx
xorl %eax, %eax
xorl %edx, %edx
movslq (%rdi,%rdx,4), %rsi
movl (%r14,%rsi,4), %esi
movl %esi, (%rdi,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xbccc
jmp 0xbd09
testl %r15d, %r15d
js 0xbcf8
leaq 0x4(,%r15,4), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movslq %r15d, %rcx
xorl %eax, %eax
movl %eax, (%r12,%rcx,4)
movq 0x18(%rsp), %rdx
movl %eax, (%rdx,%rcx,4)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0xbd09