// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movl %edx, 0xc(%rsp)
movslq %edx, %r10
xorl %edx, %edx
testl %r10d, %r10d
movl $0x0, %r11d
cmovgl %r10d, %r11d
testl %esi, %esi
movl $0x0, %r8d
cmovgl %esi, %r8d
movl %esi, 0x8(%rsp)
movl %esi, %ebx
leaq (,%r10,8), %r9
leaq 0x8(,%r10,8), %rax
movq %rax, 0x10(%rsp)
movsd 0x10088(%rip), %xmm0    # 0x26e38
movsd 0x82f8(%rip), %xmm1     # 0x1f0b0
movapd 0x8290(%rip), %xmm2     # 0x1f050
movapd 0x10098(%rip), %xmm3    # 0x26e60
movq %rdi, %r15
movq %rdi, (%rsp)
movq %rdi, %r12
cmpq %r8, %rdx
je 0x16ef8
xorpd %xmm4, %xmm4
movq %r12, %rdi
movq %rdx, %r14
cmpq %r14, %rbx
je 0x16e08
movsd (%rdi), %xmm5
andpd %xmm3, %xmm5
ucomisd %xmm4, %xmm5
jbe 0x16e00
movl %r14d, (%rcx,%rdx,4)
movapd %xmm5, %xmm4
incq %r14
addq %r9, %rdi
jmp 0x16de5
ucomisd %xmm4, %xmm0
ja 0x16f56
movl (%rcx,%rdx,4), %eax
cmpq %rax, %rdx
jne 0x16ec3
movq %rdx, %rax
imulq %r10, %rax
movq (%rsp), %rdi
leaq (%rdi,%rax,8), %r13
movapd %xmm1, %xmm4
divsd (%r13,%rdx,8), %xmm4
leaq (%rdi,%rdx,8), %rbp
movapd %xmm4, %xmm5
xorpd %xmm2, %xmm5
xorl %r14d, %r14d
cmpq %r8, %r14
je 0x16e90
cmpq %rdx, %r14
je 0x16e88
movq %r14, %rsi
imulq %r10, %rsi
movsd (%rbp,%rsi,8), %xmm6
mulsd %xmm5, %xmm6
xorl %eax, %eax
cmpq %rax, %rbx
je 0x16e82
movsd (%r15,%rax,8), %xmm7
mulsd %xmm6, %xmm7
addsd (%rdi,%rax,8), %xmm7
movsd %xmm7, (%rdi,%rax,8)
incq %rax
jmp 0x16e64
movsd %xmm6, (%rbp,%rsi,8)
incq %r14
addq %r9, %rdi
jmp 0x16e47
xorl %eax, %eax
cmpq %rax, %r11
je 0x16eac
movsd (%r15,%rax,8), %xmm5
mulsd %xmm4, %xmm5
movsd %xmm5, (%r15,%rax,8)
incq %rax
jmp 0x16e92
movsd %xmm4, (%r13,%rdx,8)
incq %rdx
addq 0x10(%rsp), %r12
addq %r9, %r15
jmp 0x16dd2
imull 0xc(%rsp), %eax
cltq
movq (%rsp), %rsi
leaq (%rsi,%rax,8), %rsi
xorl %eax, %eax
cmpq %rax, %r11
je 0x16e1e
movsd (%r15,%rax,8), %xmm4
movsd (%rsi,%rax,8), %xmm5
movsd %xmm5, (%r15,%rax,8)
movsd %xmm4, (%rsi,%rax,8)
incq %rax
jmp 0x16ed4
movslq 0x8(%rsp), %rdx
leaq -0x8(,%rdx,8), %rsi
testq %rdx, %rdx
jle 0x16f45
decq %rdx
movslq (%rcx,%rdx,4), %rdi
cmpl %edx, %edi
jne 0x16f1b
addq $-0x8, %rsi
jmp 0x16f05
movq (%rsp), %r10
movq %r8, %r11
subq $0x1, %r11
jb 0x16f15
movsd (%r10,%rsi), %xmm0
movsd (%r10,%rdi,8), %xmm1
movsd %xmm1, (%r10,%rsi)
movsd %xmm0, (%r10,%rdi,8)
addq %r9, %r10
jmp 0x16f22
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1909b(%rip), %rax     # 0x2fff8
movq (%rax), %rdi
incl %edx
leaq 0xff42(%rip), %rsi      # 0x26eab
xorl %eax, %eax
callq 0x21c0
pushq $-0x1
popq %rax
jmp 0x16f47