// File: /workspace/github_c_makefile_star2_O3/dapogon[P]cellcoal/src/eigen.c
// Function: matinv
int matinv( double x[], int n, int m, double space[])
{
/* x[n*m]  ... m>=n
*/
   register int i,j,k;
   int *irow=(int*) space;
   double ee=1.0e-20, t,t1,xmax;
   double det=1.0;

   for (i=0; i<n; i++)  {
      xmax = 0.;
      for (j=i; j<n; j++) {
	 if (xmax < fabs(x[j*m+i]))  {
	    xmax = fabs( x[j*m+i] );
	    irow[i] = j;
	 }
      }
      det *= xmax;
      if (xmax < ee)   {
	 fprintf(stderr,"\nDet becomes zero at %3d!\t\n", i+1);
	 return(-1);
      }
      if (irow[i] != i) {
	 for (j=0; j<m; j++) {
	    t = x[i*m+j];
	    x[i*m+j] = x[irow[i] * m + j];
	    x[ irow[i] * m + j] = t;
	 }
      }
      t = 1./x[i*m+i];
      for (j=0; j<n; j++) {
	 if (j == i) continue;
	 t1 = t*x[j*m+i];
	 for (k=0; k<n; k++)  x[j*m+k] -= t1*x[i*m+k];
	 x[j*m+i] = -t1;
      }
      for (j=0; j<m; j++)   x[i*m+j] *= t;
      x[i*m+i] = t;
   }                            /* i  */
   for (i=n-1; i>=0; i--) {
      if (irow[i] == i) continue;
      for (j=0; j<n; j++)  {
	 t = x[j*m+i];
	 x[j*m+i] = x[ j*m + irow[i] ];
	 x[ j*m + irow[i] ] = t;
      }
   }
   return (0);
}

// Assembly:
testl %esi, %esi
jle 0x1aa8e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movslq %edx, %r10
movl %esi, 0xc(%rsp)
movl %esi, %r8d
movl %r10d, %r11d
leaq (,%r10,8), %r9
leaq 0x8(,%r10,8), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movapd 0x10633(%rip), %xmm0    # 0x2af00
movsd 0x10603(%rip), %xmm1    # 0x2aed8
movsd 0x8823(%rip), %xmm2     # 0x23100
movapd 0x875b(%rip), %xmm3     # 0x23040
movq %rdi, %r15
movq %rdi, %r12
xorl %eax, %eax
movq %rdi, 0x10(%rsp)
movl %edx, 0x8(%rsp)
movl %r14d, %esi
leaq (%rdi,%rsi,8), %r13
xorpd %xmm4, %xmm4
movq %r12, %rsi
movq %rax, %rbx
movsd (%rsi), %xmm5
andpd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
jbe 0x1a91c
movl %ebx, (%rcx,%rax,4)
movapd %xmm5, %xmm4
incq %rbx
addq %r9, %rsi
cmpq %rbx, %r8
jne 0x1a907
ucomisd %xmm4, %xmm1
ja 0x1aa91
testl %edx, %edx
setle %sil
movl (%rcx,%rax,4), %ebp
cmpq %rbp, %rax
sete %bl
orb %sil, %bl
movl 0x8(%rsp), %ebx
jne 0x1a973
imull %ebx, %ebp
movslq %ebp, %rdx
leaq (%rdi,%rdx,8), %rdx
xorl %esi, %esi
movsd (%r15,%rsi,8), %xmm4
movsd (%rdx,%rsi,8), %xmm5
movsd %xmm5, (%r15,%rsi,8)
movsd %xmm4, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %r11
jne 0x1a955
movl %eax, %edx
imull %ebx, %edx
movslq %edx, %rdx
leaq (%rdi,%rax,8), %rbx
movapd %xmm2, %xmm4
movq %rdx, 0x20(%rsp)
divsd (%rbx,%rdx,8), %xmm4
movapd %xmm4, %xmm5
xorpd %xmm3, %xmm5
xorl %esi, %esi
cmpq %rax, %rsi
je 0x1a9cf
movq %rsi, %rbp
imulq %r10, %rbp
movsd (%rbx,%rbp,8), %xmm6
mulsd %xmm5, %xmm6
xorl %edx, %edx
movsd (%r15,%rdx,8), %xmm7
mulsd %xmm6, %xmm7
addsd (%rdi,%rdx,8), %xmm7
movsd %xmm7, (%rdi,%rdx,8)
incq %rdx
cmpq %rdx, %r8
jne 0x1a9ae
movsd %xmm6, (%rbx,%rbp,8)
incq %rsi
addq %r9, %rdi
cmpq %r8, %rsi
jne 0x1a997
cmpl $0x0, 0x8(%rsp)
jle 0x1a9fd
xorl %edx, %edx
movsd (%r13,%rdx,8), %xmm5
mulsd %xmm4, %xmm5
movsd %xmm5, (%r13,%rdx,8)
incq %rdx
cmpq %rdx, %r11
jne 0x1a9e3
movq 0x20(%rsp), %rdx
movsd %xmm4, (%rbx,%rdx,8)
incq %rax
addq 0x18(%rsp), %r12
addq %r9, %r15
movl 0x8(%rsp), %edx
addl %edx, %r14d
cmpq %r8, %rax
movq 0x10(%rsp), %rdi
jne 0x1a8f6
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
jle 0x1aa7f
leaq -0x8(,%r8,8), %rdx
movq %r8, %rsi
leaq -0x1(%rsi), %rdi
movl -0x4(%rcx,%rsi,4), %r10d
cmpq %r10, %rdi
je 0x1aa72
movslq %r10d, %r10
movq %r8, %r11
movq 0x10(%rsp), %rbx
movsd (%rbx,%rdx), %xmm0
movsd (%rbx,%r10,8), %xmm1
movsd %xmm1, (%rbx,%rdx)
movsd %xmm0, (%rbx,%r10,8)
addq %r9, %rbx
decq %r11
jne 0x1aa54
addq $-0x8, %rdx
cmpq $0x1, %rsi
movq %rdi, %rsi
jg 0x1aa3b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
movl %eax, %edi
callq 0x567e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1aa7f