// File: /workspace/github_c_makefile_star2_O1/Alessandro-Barbieri[P]SpaceLib/src/LINEAR.c
// Function: linear
void   linear(MAT H, int idim,int jdim, int imax, int jmax, int nsol,
	      int ivet[],int *irank, real *arm, int vpr[])

{
	static real eps=0.,toll=5;
	real rm,rmin;
	int i,j,k, im,jm, jmax1,j2max;

	if (eps == 0.)
		eps=toll*zerom();

	/* submatrix area where the pivoting step is performed */
	*irank=0;
	for(j=0;j<jmax;j++)
		ivet[j]=j;
	j2max=jmax+nsol;
	jmax1=jmax;
	for(i=0;vpr[i]!=-1;i++)
	{
		swabc(H,idim,jdim,imax,jmax1-1,vpr[i],ivet);
		jmax1=jmax1-1;
	}
	k=min(imax,jmax);
	for(i=0;i<k;i++)
	{
		rm=rmax(H,idim,jdim,i,imax,i,jmax1,&im,&jm);
		*arm=aabs(rm);
		if (i==0)
			rmin=eps*(*arm)*imax;
		if (rm == 0. || *arm < rmin)
			return;
		*irank=i+1;
		swabr(H,idim,jdim,j2max,i,im);
		swabc(H,idim,jdim,imax,i,jm,ivet);
		elimin(H,idim,jdim,imax,j2max,i);
		normalr(H,idim,jdim,j2max,i,rm);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r9d, %ebp
movl %r8d, %r13d
movl %ecx, %ebx
movl %edx, 0x4(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdi, 0x8(%rsp)
movsd 0xb26e(%rip), %xmm0     # 0xe250
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3003
jp 0x3003
callq 0x2360
mulsd 0x7015(%rip), %xmm0     # 0xa010
movsd %xmm0, 0xb24d(%rip)     # 0xe250
movq 0xc8(%rsp), %rax
movq 0xb0(%rsp), %r10
movq 0xb8(%rsp), %rcx
movl $0x0, (%rcx)
testl %r13d, %r13d
jle 0x3037
movl %r13d, %ecx
xorl %edx, %edx
movl %edx, (%r10,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x302b
movl (%rax), %edi
movl %ebx, %r11d
movslq 0x4(%rsp), %r14
movl %r13d, %r15d
cmpl $-0x1, %edi
je 0x30b5
movslq %r13d, %r15
leaq (,%r14,8), %rcx
leaq -0x8(,%r15,8), %rdx
xorl %esi, %esi
decq %r15
cmpl %r15d, %edi
je 0x30a5
movslq %edi, %rdi
testl %ebx, %ebx
jle 0x3095
movq 0x8(%rsp), %r8
movq %r11, %r9
movsd (%r8,%rdx), %xmm0
movsd (%r8,%rdi,8), %xmm1
movsd %xmm1, (%r8,%rdx)
movsd %xmm0, (%r8,%rdi,8)
addq %rcx, %r8
decq %r9
jne 0x3075
movl (%r10,%r15,4), %r8d
movl (%r10,%rdi,4), %r9d
movl %r9d, (%r10,%r15,4)
movl %r8d, (%r10,%rdi,4)
movl 0x4(%rax,%rsi,4), %edi
incq %rsi
addq $-0x8, %rdx
cmpl $-0x1, %edi
jne 0x305e
movq %r15, 0x48(%rsp)
movq %r11, 0x38(%rsp)
cmpl %r13d, %ebx
movl %r13d, %eax
cmovll %ebx, %eax
testl %eax, %eax
jle 0x329c
addl %r13d, %ebp
movsd 0xb175(%rip), %xmm0     # 0xe250
movsd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x28(%rsp)
movl %ebp, 0x14(%rsp)
movl %ebp, %ebp
movl %eax, %eax
movq %rax, 0x40(%rsp)
shlq $0x3, %r14
xorl %r12d, %r12d
movq 0x8(%rsp), %r15
xorl %r13d, %r13d
movl %ebx, 0x18(%rsp)
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0xc(%rsp), %edx
movl %r13d, %ecx
movl %ebx, %r8d
movl %r13d, %r9d
leaq 0x28(%rsp), %rax
pushq %rax
leaq 0x34(%rsp), %rax
pushq %rax
pushq 0x60(%rsp)
callq 0x2350
addq $0x20, %rsp
movapd %xmm0, %xmm1
xorpd 0x6eb3(%rip), %xmm1     # 0xa000
movapd %xmm0, %xmm3
maxsd %xmm1, %xmm3
movq 0xc0(%rsp), %rax
movsd %xmm3, (%rax)
testq %r13, %r13
jne 0x317c
movsd 0x30(%rsp), %xmm2
mulsd %xmm3, %xmm2
mulsd 0x28(%rsp), %xmm2
movsd %xmm2, 0x50(%rsp)
ucomisd %xmm1, %xmm0
jne 0x3188
jnp 0x329c
movsd 0x50(%rsp), %xmm1
ucomisd %xmm3, %xmm1
ja 0x329c
cmpl $0x0, 0x14(%rsp)
setle %cl
leaq 0x1(%r13), %rdx
movq 0xb8(%rsp), %rax
movq %rdx, 0x58(%rsp)
movl %edx, (%rax)
movl 0x24(%rsp), %eax
cmpq %rax, %r13
sete %dl
orb %cl, %dl
jne 0x31f1
imull 0x4(%rsp), %eax
cltq
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
xorl %ecx, %ecx
movsd (%r15,%rcx,8), %xmm2
movsd (%rax,%rcx,8), %xmm1
movsd %xmm1, (%r15,%rcx,8)
movsd %xmm2, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %rbp
jne 0x31d3
movapd %xmm0, 0x60(%rsp)
movl 0x20(%rsp), %eax
cmpq %rax, %r13
je 0x3240
cltq
movq 0x8(%rsp), %rcx
movq 0x38(%rsp), %rdx
movsd (%rcx,%r12), %xmm0
movsd (%rcx,%rax,8), %xmm1
movsd %xmm1, (%rcx,%r12)
movsd %xmm0, (%rcx,%rax,8)
addq %r14, %rcx
decq %rdx
jne 0x320c
movq 0xb0(%rsp), %rsi
movl (%rsi,%r13,4), %ecx
movl (%rsi,%rax,4), %edx
movl %edx, (%rsi,%r13,4)
movl %ecx, (%rsi,%rax,4)
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %edx
movl %ebx, %ecx
movl 0x14(%rsp), %ebx
movl %ebx, %r8d
movl %r13d, %r9d
callq 0x2270
testl %ebx, %ebx
movapd 0x60(%rsp), %xmm1
jle 0x327e
xorl %eax, %eax
movsd (%r15,%rax,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
cmpq %rax, %rbp
jne 0x3266
addq %r14, %r15
addq $0x8, %r12
movq 0x58(%rsp), %rax
movq %rax, %r13
cmpq 0x40(%rsp), %rax
movl 0x18(%rsp), %ebx
jne 0x310e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq