// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movsd %xmm0, 0x70(%rsp)
movq %rdi, %rbp
movq %rsi, 0x68(%rsp)
movslq (%rsi), %rdx
movl %edx, %r15d
movq 0x38(%rdi), %rax
movq %rax, 0x88(%rsp)
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
movq 0x10(%rax), %rsi
movq %rsi, 0x20(%rsp)
movq 0x18(%rax), %r9
movq 0x20(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x10(%rcx), %rax
movq %rax, 0x60(%rsp)
movq 0x18(%rcx), %rax
movq %rax, 0x58(%rsp)
movq 0x20(%rcx), %rax
movq %rax, 0x50(%rsp)
movq 0x48(%rdi), %r13
movq 0x28(%rdi), %rbx
movq 0x30(%rdi), %rax
movq %rax, 0x80(%rsp)
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
movq %r9, 0x10(%rsp)
jle 0xba96
leaq (,%r15,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x8200
movq 0x10(%rsp), %r9
testl %r15d, %r15d
jle 0xbab5
leaq (,%r15,4), %rdx
movq %rbx, %rdi
movl $0xff, %esi
callq 0x8200
movq 0x10(%rsp), %r9
testl %r15d, %r15d
js 0xbad3
leaq 0x4(,%r15,4), %rdx
movq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x8200
movq 0x10(%rsp), %r9
movl $0x0, %r12d
movl $0x0, %r14d
testl %r15d, %r15d
jle 0xbd41
xorl %r10d, %r10d
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %r15, 0x38(%rsp)
movq %rbp, 0x40(%rsp)
movq %rbx, 0x78(%rsp)
movq 0x20(%rsp), %rax
movl %r12d, (%rax,%r10,4)
movq 0x60(%rsp), %rax
movl %r14d, (%rax,%r10,4)
movq 0x88(%rsp), %rax
testq %rax, %rax
je 0xbb25
movl (%rax,%r10,4), %edx
jmp 0xbb28
movl %r10d, %edx
movq 0x8(%rbp), %rdi
movq 0x18(%rbp), %rax
movq (%rax,%r10,8), %rcx
movq 0x68(%rsp), %rsi
movl %edx, 0x1c(%rsp)
movq %rbx, %r8
movq %r10, %rbx
callq 0xb7a1
movl %eax, %r15d
movq 0x20(%rbp), %rax
movl %r15d, (%rax,%rbx,4)
movq 0x8(%rbp), %rdi
movq 0x18(%rbp), %rax
movq %rbx, %rbp
movq (%rax,%rbx,8), %rcx
movq 0x78(%rsp), %rbx
movq %rbx, (%rsp)
movq 0x68(%rsp), %rsi
movl 0x1c(%rsp), %edx
movl %r15d, %r8d
movq %r13, %r9
callq 0xb90e
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl 0x28(%rsp), %r15d
movq %rbp, 0x90(%rsp)
movl %r15d, 0x34(%rsp)
jge 0xbc25
movq 0x40(%rsp), %rcx
movq 0x18(%rcx), %rax
movq (%rax,%rbp,8), %rax
movslq %r15d, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movsd 0xe5c2f(%rip), %xmm0    # 0xf17e8
movq 0x10(%rsp), %r9
movq %rcx, %rbp
movq 0x58(%rsp), %r10
movq 0x50(%rsp), %r11
movapd 0xe566d(%rip), %xmm2    # 0xf1240
movq 0x38(%rsp), %r15
movl (%rax,%rdx,4), %ecx
movslq %ecx, %rdi
movl (%rbx,%rdi,4), %r8d
testl %r8d, %r8d
js 0xbc00
movslq %r14d, %r14
movl %r8d, (%r10,%r14,4)
movsd (%r13,%rdi,8), %xmm1
movsd %xmm1, (%r11,%r14,8)
incl %r14d
jmp 0xbc17
movsd (%r13,%rdi,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbc17
movapd %xmm1, %xmm0
jmp 0xbc19
movl %esi, %ecx
incq %rdx
movl %ecx, %esi
cmpq %rdx, %r15
jne 0xbbd8
jmp 0xbc4e
movsd 0xe5bbb(%rip), %xmm0    # 0xf17e8
movq 0x10(%rsp), %r9
movq 0x40(%rsp), %rbp
movq 0x58(%rsp), %r10
movq 0x50(%rsp), %r11
movapd 0xe55f7(%rip), %xmm2    # 0xf1240
movq 0x38(%rsp), %r15
movl $0x1, %eax
cmpl $-0x1, %ecx
je 0xbd7c
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0xbd7c
movl 0x1c(%rsp), %edx
movslq %edx, %rax
cmpl $0x0, (%rbx,%rax,4)
js 0xbc7e
movq 0x48(%rsp), %rsi
jmp 0xbc9c
movsd (%r13,%rax,8), %xmm1
andpd %xmm2, %xmm1
mulsd 0x70(%rsp), %xmm0
ucomisd %xmm0, %xmm1
movq 0x48(%rsp), %rsi
jb 0xbc9c
movl %edx, %ecx
movslq %ecx, %rax
movsd (%r13,%rax,8), %xmm0
movslq %r14d, %rcx
movq 0x90(%rsp), %rdx
movl %edx, (%r10,%rcx,4)
movq %rdx, %r10
movsd %xmm0, (%r11,%rcx,8)
movl %r10d, (%rbx,%rax,4)
movq 0x80(%rsp), %rcx
movl %eax, (%rcx,%rdx,4)
movslq %r12d, %rcx
movl %eax, (%r9,%rcx,4)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rsi,%rcx,8)
incl %r12d
movl 0x34(%rsp), %ecx
cmpl 0x28(%rsp), %ecx
jge 0xbd32
movq 0x18(%rbp), %rax
movq (%rax,%r10,8), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movslq %edx, %rdx
cmpl $0x0, (%rbx,%rdx,4)
jns 0xbd21
movslq %r12d, %r12
movl %edx, (%r9,%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 0xbcfa
incl %r14d
incq %r10
cmpq %r15, %r10
jne 0xbb00
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movl %r12d, (%rcx,%rax,4)
movq 0x60(%rsp), %rcx
movl %r14d, (%rcx,%rax,4)
movl $0x0, %eax
testl %r12d, %r12d
jle 0xbd7c
movl %r12d, %ecx
xorl %eax, %eax
xorl %edx, %edx
movslq (%r9,%rdx,4), %rsi
movl (%rbx,%rsi,4), %esi
movl %esi, (%r9,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xbd69
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq