// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
movslq %edx, %r8
movl %esi, %r9d
movl %esi, 0x14(%rsp)
testl %esi, %esi
jle 0x1a70b
movl %r8d, %r10d
leaq (,%r8,8), %r11
leaq 0x8(,%r8,8), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movapd 0x2188f(%rip), %xmm0    # 0x3be40
movsd 0x2185f(%rip), %xmm1    # 0x3be18
movsd 0x19a47(%rip), %xmm2    # 0x34008
movapd 0x19af7(%rip), %xmm3    # 0x340c0
movq 0x8(%rsp), %r12
movq %r12, %r15
xorl %eax, %eax
movl %edx, 0x10(%rsp)
movl %r14d, %edi
movq 0x8(%rsp), %rsi
leaq (%rsi,%rdi,8), %r13
xorpd %xmm4, %xmm4
movq %r12, %rsi
movq %rax, %rdi
movsd (%rsi), %xmm5
andpd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
jbe 0x1a602
movl %edi, (%rcx,%rax,4)
movapd %xmm5, %xmm4
incq %rdi
addq %r11, %rsi
cmpq %rdi, %r9
jne 0x1a5ed
ucomisd %xmm4, %xmm1
ja 0x1a776
testl %edx, %edx
setle %sil
movl (%rcx,%rax,4), %ebx
cmpq %rbx, %rax
sete %dil
orb %sil, %dil
jne 0x1a65b
imull %edx, %ebx
movslq %ebx, %rdi
movq 0x8(%rsp), %rsi
leaq (%rsi,%rdi,8), %rdi
xorl %esi, %esi
movsd (%r15,%rsi,8), %xmm4
movsd (%rdi,%rsi,8), %xmm5
movsd %xmm5, (%r15,%rsi,8)
movsd %xmm4, (%rdi,%rsi,8)
incq %rsi
cmpq %rsi, %r10
jne 0x1a63d
movl %eax, %esi
imull %edx, %esi
movslq %esi, %rdx
movq 0x8(%rsp), %rdi
leaq (%rdi,%rax,8), %rbx
movapd %xmm2, %xmm4
movq %rdx, 0x20(%rsp)
divsd (%rbx,%rdx,8), %xmm4
xorl %esi, %esi
cmpq %rax, %rsi
je 0x1a6b8
movq %rsi, %rbp
imulq %r8, %rbp
movsd (%rbx,%rbp,8), %xmm5
mulsd %xmm4, %xmm5
xorpd %xmm3, %xmm5
xorl %edx, %edx
movsd (%r15,%rdx,8), %xmm6
mulsd %xmm5, %xmm6
addsd (%rdi,%rdx,8), %xmm6
movsd %xmm6, (%rdi,%rdx,8)
incq %rdx
cmpq %rdx, %r9
jne 0x1a697
movlpd %xmm5, (%rbx,%rbp,8)
incq %rsi
addq %r11, %rdi
cmpq %r9, %rsi
jne 0x1a67c
cmpl $0x0, 0x10(%rsp)
jle 0x1a6e6
xorl %edx, %edx
movsd (%r13,%rdx,8), %xmm5
mulsd %xmm4, %xmm5
movsd %xmm5, (%r13,%rdx,8)
incq %rdx
cmpq %rdx, %r10
jne 0x1a6cc
movq 0x20(%rsp), %rdx
movsd %xmm4, (%rbx,%rdx,8)
incq %rax
addq 0x18(%rsp), %r12
addq %r11, %r15
movl 0x10(%rsp), %edx
addl %edx, %r14d
cmpq %r9, %rax
jne 0x1a5d7
xorl %eax, %eax
cmpl $0x0, 0x14(%rsp)
jle 0x1a767
shlq $0x3, %r8
leaq -0x8(,%r9,8), %rdx
movq %r9, %rsi
leaq -0x1(%rsi), %rdi
movl -0x4(%rcx,%rsi,4), %r10d
cmpq %r10, %rdi
je 0x1a75a
movslq %r10d, %r10
movq %r9, %r11
movq 0x8(%rsp), %rbx
movsd (%rbx,%rdx), %xmm0
movsd (%rbx,%r10,8), %xmm1
movsd %xmm1, (%rbx,%rdx)
movsd %xmm0, (%rbx,%r10,8)
addq %r8, %rbx
decq %r11
jne 0x1a73c
addq $-0x8, %rdx
cmpq $0x1, %rsi
movq %rdi, %rsi
jg 0x1a723
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x5675
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1a767