// File: /workspace/github_c_makefile_star2_O0/Alessandro-Barbieri[P]SpaceLib/src/LINEAR2.c
// Function: minvers
int minvers(MAT A, MAT Ai, int dim)
{

	real *H;                /* matrix where A and I must be copied */
	int *ivet;              /* vector filled with reordering info. */
	int vpr = -1;
	int irank;
	real arm;
	int i,j;

	H = (real *) calloc (2*dim*dim,sizeof(real));
	ivet = (int *) calloc (dim,sizeof(int));

	for (i=0;i<dim;i++)     /* copies matrix A into matrix H */
		for (j=0;j<dim;j++)
			H[i*dim*2+j] = *(A+i*dim+j);
	for (i=0;i<dim;i++)     /* copies identity matrix I into matrix H */
		for (j=dim;j<2*dim;j++)
			if (i!=(j-dim))
				H[i*dim*2+j] = 0;
			else
				H[i*dim*2+j] = 1;
	linear(H,dim,2*dim,dim,dim,dim,ivet,&irank,&arm,&vpr);
	for (j=dim;j<2*dim;j++) /* extracts solution x reordering matrix H */
		for (i=0;i<dim;i++)
			*(Ai+ivet[i]*dim+j-dim) = *(H+i*2*dim+j);

	free (H); free (ivet);

	return irank;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x68, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x1c(%rbp), %eax
shll %eax
imull -0x1c(%rbp), %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x2160
movq %rax, -0x28(%rbp)
movslq -0x1c(%rbp), %rdi
movl $0x4, %esi
callq 0x2160
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x3b33
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x3b26
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x1c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x1c(%rbp), %ecx
shll %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3add
jmp 0x3b28
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3ace
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x3bb8
movl -0x1c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x3bab
movl -0x44(%rbp), %eax
movl -0x48(%rbp), %ecx
subl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
je 0x3b7e
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x1c(%rbp), %ecx
shll %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3b9e
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x1c(%rbp), %ecx
shll %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movsd 0xb4c7(%rip), %xmm0     # 0xf060
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3ba0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3b48
jmp 0x3bad
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3b3a
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x1c(%rbp), %edx
shll %edx
movl -0x1c(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movl -0x1c(%rbp), %r9d
movq -0x30(%rbp), %rbx
leaq -0x38(%rbp), %r11
leaq -0x40(%rbp), %r10
leaq -0x34(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x21e0
movl -0x1c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x3c8d
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x3c7d
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
shll %ecx
imull -0x1c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x44(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
imull -0x1c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3c14
jmp 0x3c7f
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3bfd
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x30(%rbp), %rdi
callq 0x2040
movl -0x38(%rbp), %eax
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)