// File: /workspace/github_c_makefile_star2_O2/dapogon[P]cellcoal/src/eigen.c
// Function: elemhess
void elemhess(int job,double mat[],int n,int low,int hi, double vr[],
              double vi[], int work[])
{
/* work[n] */
    int i,j,m;
    double x,y;

    for (m = low + 1; m < hi; m++) {
        for (x = 0,i = m,j = m; j <= hi; j++) {
            if (fabs(mat[pos(j,m-1,n)]) > fabs(x)) {
                x = mat[pos(j,m-1,n)];
                i = j;
            }
        }

        if ((work[m] = i) != m) {
            for (j = m - 1; j < n; j++) {
               y = mat[pos(i,j,n)];
               mat[pos(i,j,n)] = mat[pos(m,j,n)];
               mat[pos(m,j,n)] = y;
            }

            for (j = 0; j <= hi; j++) {
               y = mat[pos(j,i,n)];
               mat[pos(j,i,n)] = mat[pos(j,m,n)];
               mat[pos(j,m,n)] = y;
            }
        }

        if (x != 0) {
            for (i = m + 1; i <= hi; i++) {
                if ((y = mat[pos(i,m-1,n)]) != 0) {
                    y = mat[pos(i,m-1,n)] = y / x;

                    for (j = m; j < n; j++) {
                        mat[pos(i,j,n)] -= y * mat[pos(m,j,n)];
                    }

                    for (j = 0; j <= hi; j++) {
                        mat[pos(j,m,n)] += y * mat[pos(j,i,n)];
                    }
                }
            }
        }
    }
    if (job) {
       for (i=0; i<n; i++) {
          for (j=0; j<n; j++) {
             vr[pos(i,j,n)] = 0.0; vi[pos(i,j,n)] = 0.0;
          }
          vr[pos(i,i,n)] = 1.0;
       }

       for (m = hi - 1; m > low; m--) {
          for (i = m + 1; i <= hi; i++) {
             vr[pos(i,m,n)] = mat[pos(i,m-1,n)];
          }

         if ((i = work[m]) != m) {
            for (j = m; j <= hi; j++) {
               vr[pos(m,j,n)] = vr[pos(i,j,n)];
               vr[pos(i,j,n)] = 0.0;
            }
            vr[pos(i,m,n)] = 1.0;
         }
      }
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x20(%rsp)
movl %edi, -0x28(%rsp)
movslq %ecx, %rdi
movslq %r8d, %r8
movq %rdx, -0x30(%rsp)
movslq %edx, %r11
leal 0x2(%rdi), %ebx
leaq 0x1(%rdi), %r15
movq %r15, %rax
imulq %r11, %rax
leaq (,%rdi,8), %rcx
leaq (%rcx,%rax,8), %r12
addq %rsi, %r12
leaq (,%r11,8), %rdx
leaq 0x8(,%r11,8), %rax
movq %rax, -0x18(%rsp)
leaq (%rsi,%rdi,8), %r13
xorpd %xmm0, %xmm0
movapd 0x7b92(%rip), %xmm1     # 0x1f050
movapd 0xf99a(%rip), %xmm2     # 0x26e60
movq %rsi, -0x38(%rsp)
leaq (%rsi,%rdi,8), %rax
addq $0x8, %rax
movq %rdi, -0x8(%rsp)
leaq 0x1(%rdi), %rbp
cmpq %r8, %rbp
jge 0x1769f
movslq %ebx, %rcx
movq -0x38(%rsp), %rsi
leaq (%rsi,%rcx,8), %r14
movq %rdx, %r10
imulq %rcx, %r10
addq %rax, %r10
xorpd %xmm3, %xmm3
movq %r12, %rsi
movq %rbp, %r9
movq %rbp, -0x10(%rsp)
cmpq %r8, %r9
jg 0x17548
movsd (%rsi), %xmm4
movapd %xmm4, %xmm5
andpd %xmm2, %xmm5
movapd %xmm3, %xmm6
andpd %xmm2, %xmm6
ucomisd %xmm6, %xmm5
cmoval %r9d, %ebp
cmpltsd %xmm5, %xmm6
andpd %xmm6, %xmm4
andnpd %xmm3, %xmm6
orpd %xmm4, %xmm6
incq %r9
addq %rdx, %rsi
movapd %xmm6, %xmm3
jmp 0x1750a
movq 0x40(%rsp), %rsi
movq -0x10(%rsp), %r9
movl %ebp, (%rsi,%r9,4)
cmpl %r9d, %ebp
jne 0x1761d
ucomisd %xmm0, %xmm3
movq -0x10(%rsp), %rbp
jne 0x17570
jnp 0x17603
movq -0x38(%rsp), %rsi
leaq (%rsi,%rdi,8), %rdi
cmpq %r8, %rcx
jg 0x17603
movq %rcx, %rsi
imulq %r11, %rsi
movsd (%rdi,%rsi,8), %xmm4
ucomisd %xmm0, %xmm4
jne 0x17596
jnp 0x175f4
divsd %xmm3, %xmm4
movsd %xmm4, (%rdi,%rsi,8)
movapd %xmm4, %xmm5
xorpd %xmm1, %xmm5
xorl %esi, %esi
leaq (%r15,%rsi), %r9
cmpq %r11, %r9
jge 0x175ce
movsd 0x8(%r12,%rsi,8), %xmm6
mulsd %xmm5, %xmm6
addsd (%r10,%rsi,8), %xmm6
movsd %xmm6, (%r10,%rsi,8)
incq %rsi
jmp 0x175a9
xorl %esi, %esi
xorl %r9d, %r9d
cmpq %r8, %r9
jg 0x175f4
movsd (%r14,%rsi), %xmm5
mulsd %xmm4, %xmm5
addsd (%rax,%rsi), %xmm5
movsd %xmm5, (%rax,%rsi)
incq %r9
addq %rdx, %rsi
jmp 0x175d3
incq %rcx
addq %rdx, %r10
addq $0x8, %r14
jmp 0x17579
incl %ebx
addq -0x18(%rsp), %r12
addq $0x8, %r13
addq $0x8, %rax
incq %r15
movq %rbp, %rdi
jmp 0x174d8
movl %ebx, -0x24(%rsp)
movl %ebp, %esi
imull -0x30(%rsp), %esi
movslq %esi, %rsi
leaq (,%rsi,8), %rsi
addq %r13, %rsi
xorl %r9d, %r9d
leaq (%rdi,%r9), %rbx
cmpq %r11, %rbx
jge 0x1765f
movsd (%rsi,%r9,8), %xmm4
movsd (%r12,%r9,8), %xmm5
movsd %xmm5, (%rsi,%r9,8)
movsd %xmm4, (%r12,%r9,8)
incq %r9
jmp 0x17639
movslq %ebp, %rsi
movq -0x38(%rsp), %r9
leaq (%r9,%rsi,8), %rsi
xorl %r9d, %r9d
xorl %ebp, %ebp
movl -0x24(%rsp), %ebx
cmpq %r8, %rbp
jg 0x1755f
movsd (%rsi,%r9), %xmm4
movsd 0x8(%r13,%r9), %xmm5
movsd %xmm5, (%rsi,%r9)
movsd %xmm4, 0x8(%r13,%r9)
incq %rbp
addq %rdx, %r9
jmp 0x17674
cmpl $0x0, -0x28(%rsp)
movq -0x20(%rsp), %r15
je 0x177db
xorl %ecx, %ecx
movq -0x30(%rsp), %rax
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
leal 0x1(%rax), %edi
movl %eax, %r9d
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %r15, %r10
movq 0x38(%rsp), %r12
cmpq %rsi, %rcx
je 0x1770b
xorl %r14d, %r14d
cmpq %r14, %r9
je 0x176f4
andq $0x0, (%r10,%r14,8)
andq $0x0, (%r12,%r14,8)
incq %r14
jmp 0x176e0
movl %edi, %ebx
imull %ecx, %ebx
movslq %ebx, %rbx
movq %rax, (%r15,%rbx,8)
incq %rcx
addq %rdx, %r10
addq %rdx, %r12
jmp 0x176d8
leal -0x1(%r8), %ecx
movslq %ecx, %rcx
movq -0x18(%rsp), %r10
imulq %r8, %r10
leaq (%r10,%r15), %rdi
addq $-0x8, %rdi
movq %rdx, %r9
xorq $-0x8, %r9
movq -0x38(%rsp), %rsi
addq %r10, %rsi
addq $-0x10, %rsi
leaq -0x1(%r8), %r10
imulq %r11, %r10
leaq (,%rcx,8), %r11
leaq (%r11,%r10,8), %r10
addq %r15, %r10
leaq (%r15,%rcx,8), %r11
movq %r8, %r14
leaq -0x1(%r14), %rbx
cmpq -0x8(%rsp), %rbx
jle 0x177db
xorl %r15d, %r15d
cmpq %r8, %r14
jg 0x1777b
movsd (%rsi,%r15), %xmm0
movsd %xmm0, (%rdi,%r15)
incq %r14
addq %rdx, %r15
jmp 0x17762
movq 0x40(%rsp), %r14
movl (%r14,%rbx,4), %ebp
cmpl %ebx, %ebp
je 0x177c3
imull -0x30(%rsp), %ebp
movslq %ebp, %r14
leaq (%r11,%r14,8), %r15
xorl %r12d, %r12d
leaq (%rcx,%r12), %r13
cmpq %r8, %r13
jg 0x177b6
movsd (%r15,%r12,8), %xmm0
movsd %xmm0, (%r10,%r12,8)
andq $0x0, (%r15,%r12,8)
incq %r12
jmp 0x17797
movq -0x20(%rsp), %r15
leaq (%r15,%rbx,8), %r15
movq %rax, (%r15,%r14,8)
decq %rcx
addq %r9, %rdi
addq %r9, %rsi
addq %r9, %r10
addq $-0x8, %r11
movq %rbx, %r14
jmp 0x17754
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq