// File: /workspace/github_c_makefile_star2_O1/dapogon[P]cellcoal/src/eigen.c
// Function: unbalance
void unbalance(int n,double vr[],double vi[], int low, int hi, double scale[])
{
    int i,j,k;
    double tmp;

    for (i = low; i <= hi; i++) {
        for (j = 0; j < n; j++) {
            vr[pos(i,j,n)] *= scale[i];
            vi[pos(i,j,n)] *= scale[i];
        }
    }

    for (i = low - 1; i >= 0; i--) {
        if ((k = (int)scale[i]) != i) {
            for (j = 0; j < n; j++) {
                tmp = vr[pos(i,j,n)];
                vr[pos(i,j,n)] = vr[pos(k,j,n)];
                vr[pos(k,j,n)] = tmp;

                tmp = vi[pos(i,j,n)];
                vi[pos(i,j,n)] = vi[pos(k,j,n)];
                vi[pos(k,j,n)] = tmp;
            }
        }
    }

    for (i = hi + 1; i < n; i++) {
        if ((k = (int)scale[i]) != i) {
            for (j = 0; j < n; j++) {
                tmp = vr[pos(i,j,n)];
                vr[pos(i,j,n)] = vr[pos(k,j,n)];
                vr[pos(k,j,n)] = tmp;

                tmp = vi[pos(i,j,n)];
                vi[pos(i,j,n)] = vi[pos(k,j,n)];
                vi[pos(k,j,n)] = tmp;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %edi, %rax
movl %edi, %r10d
cmpl %r8d, %ecx
jg 0x1ce47
movslq %ecx, %r11
leal 0x1(%r8), %ebx
movq %r11, %r12
imulq %rax, %r12
leaq (%rsi,%r12,8), %r14
leaq (,%rax,8), %r15
leaq (%rdx,%r12,8), %r12
testl %edi, %edi
jle 0x1ce39
xorl %r13d, %r13d
movsd (%r9,%r11,8), %xmm0
mulsd (%r14,%r13,8), %xmm0
movsd %xmm0, (%r14,%r13,8)
movsd (%r9,%r11,8), %xmm0
mulsd (%r12,%r13,8), %xmm0
movsd %xmm0, (%r12,%r13,8)
incq %r13
cmpq %r13, %r10
jne 0x1ce0d
incq %r11
addq %r15, %r14
addq %r15, %r12
cmpl %r11d, %ebx
jne 0x1ce06
testl %ecx, %ecx
jle 0x1cee3
movl %ecx, %ecx
leaq -0x1(%rcx), %r14
imulq %rax, %r14
leaq (%rsi,%r14,8), %r11
leaq (,%rax,8), %rbx
negq %rbx
leaq (%rdx,%r14,8), %r14
testl %edi, %edi
setle %bpl
cvttsd2si -0x8(%r9,%rcx,8), %r12d
leaq -0x1(%rcx), %r15
cmpq %r12, %r15
sete %r13b
orb %bpl, %r13b
jne 0x1ced4
imull %edi, %r12d
movslq %r12d, %r13
leaq (%rsi,%r13,8), %r12
leaq (%rdx,%r13,8), %r13
xorl %ebp, %ebp
movsd (%r11,%rbp,8), %xmm0
movsd (%r12,%rbp,8), %xmm1
movsd %xmm1, (%r11,%rbp,8)
movsd %xmm0, (%r12,%rbp,8)
movsd (%r14,%rbp,8), %xmm0
movsd (%r13,%rbp,8), %xmm1
movsd %xmm1, (%r14,%rbp,8)
movsd %xmm0, (%r13,%rbp,8)
incq %rbp
cmpq %rbp, %r10
jne 0x1ce9a
addq %rbx, %r11
addq %rbx, %r14
cmpq $0x1, %rcx
movq %r15, %rcx
jg 0x1ce6c
incl %r8d
cmpl %edi, %r8d
jge 0x1cf72
movslq %r8d, %rcx
movq %rax, %r11
imulq %rcx, %r11
leaq (%rsi,%r11,8), %r8
shlq $0x3, %rax
leaq (%rdx,%r11,8), %r11
testl %edi, %edi
cvttsd2si (%r9,%rcx,8), %ebx
setle %bpl
cmpl %ebx, %ecx
sete %r14b
orb %bpl, %r14b
jne 0x1cf65
imull %edi, %ebx
movslq %ebx, %r14
leaq (%rsi,%r14,8), %rbx
leaq (%rdx,%r14,8), %r14
xorl %r15d, %r15d
movsd (%r8,%r15,8), %xmm0
movsd (%rbx,%r15,8), %xmm1
movsd %xmm1, (%r8,%r15,8)
movsd %xmm0, (%rbx,%r15,8)
movsd (%r11,%r15,8), %xmm0
movsd (%r14,%r15,8), %xmm1
movsd %xmm1, (%r11,%r15,8)
movsd %xmm0, (%r14,%r15,8)
incq %r15
cmpq %r15, %r10
jne 0x1cf2d
incq %rcx
addq %rax, %r8
addq %rax, %r11
cmpl %edi, %ecx
jne 0x1cf05
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq