// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]gtrieScanner/nauty/nautil.c
// Function: doref
void
doref(graph *g, int *lab, int *ptn, int level, int *numcells,
     int *qinvar, permutation *invar, set *active, int *code,
     void (*refproc)(graph*,int*,int*,int,int*,permutation*,set*,int*,int,int),
     void (*invarproc)(graph*,int*,int*,int,int,int,permutation*,
                                                     int,boolean,int,int),
     int mininvarlev, int maxinvarlev, int invararg,
     boolean digraph, int m, int n)
{
	int j,h;
	permutation pw;
	int iw;
	int i,cell1,cell2,nc,tvpos,minlev,maxlev;
	long longcode;
	boolean same;

#if !MAXN 
	DYNALLOC1(permutation,workperm,workperm_sz,n,"doref"); 
#endif

	if ((tvpos = nextelement(active,M,-1)) < 0) tvpos = 0;

	(*refproc)(g,lab,ptn,level,numcells,invar,active,code,M,n);

	minlev = (mininvarlev < 0 ? -mininvarlev : mininvarlev);
	maxlev = (maxinvarlev < 0 ? -maxinvarlev : maxinvarlev);
	if (invarproc != NULL && *numcells < n
	                    && level >= minlev && level <= maxlev)
	{
	    (*invarproc)(g,lab,ptn,level,*numcells,tvpos,invar,invararg,
	                                                         digraph,M,n);
	    EMPTYSET(active,m);
	    for (i = n; --i >= 0;) workperm[i] = invar[lab[i]];
	    nc = *numcells;
	    for (cell1 = 0; cell1 < n; cell1 = cell2 + 1)
	    {
	        pw = workperm[cell1];
	        same = TRUE;
	        for (cell2 = cell1; ptn[cell2] > level; ++cell2)
	            if (workperm[cell2+1] != pw) same = FALSE;

	        if (same) continue;

	        j = (cell2 - cell1 + 1) / 3;
	        h = 1;
	        do
	            h = 3 * h + 1;
	        while (h < j);

	        do                      /* shell sort */
	        {
	            for (i = cell1 + h; i <= cell2; ++i)
	            {
	                iw = lab[i];
	                pw = workperm[i];
	                for (j = i; workperm[j-h] > pw; )
	                {
	                    workperm[j] = workperm[j-h];
	                    lab[j] = lab[j-h];
	                    if ((j -= h) < cell1 + h) break;
	                }
	                workperm[j] = pw;
	                lab[j] = iw;
	            }
	            h /= 3;
	        }
	        while (h > 0);

	        for (i = cell1 + 1; i <= cell2; ++i)
	            if (workperm[i] != workperm[i-1])
	            {
	                ptn[i-1] = level;
	                ++*numcells;
	                ADDELEMENT(active,i);
	            }
	    }

	    if (*numcells > nc)
	    {
	        *qinvar = 2;
	        longcode = *code;
	        (*refproc)(g,lab,ptn,level,numcells,invar,active,code,M,n);
	        longcode = MASH(longcode,*code);
	        *code = CLEANUP(longcode);
	    }
	    else
	        *qinvar = 1;
	}
	else
	    *qinvar = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movl 0x60(%rbp), %eax
movl 0x58(%rbp), %eax
movl 0x50(%rbp), %eax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
movq %r8, -0x40(%rbp)
movq %r9, -0x48(%rbp)
movslq 0x60(%rbp), %rax
cmpq 0x1feb8(%rip), %rax     # 0x3d530
jbe 0x1d6c3
cmpq $0x0, 0x1feae(%rip)     # 0x3d530
je 0x1d690
movq 0x1fead(%rip), %rdi     # 0x3d538
callq 0x3320
movslq 0x60(%rbp), %rax
movq %rax, 0x1fe95(%rip)     # 0x3d530
movslq 0x60(%rbp), %rdi
shlq $0x2, %rdi
callq 0x3370
movq %rax, 0x1fe89(%rip)     # 0x3d538
cmpq $0x0, %rax
jne 0x1d6c1
leaq 0x378b(%rip), %rdi      # 0x20e47
callq 0x1d260
jmp 0x1d6c3
movq 0x18(%rbp), %rdi
movl 0x58(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1ca70
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
jge 0x1d6e3
movl $0x0, -0x6c(%rbp)
movq 0x28(%rbp), %rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %r8
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %r14
movq 0x20(%rbp), %rbx
movl 0x58(%rbp), %r11d
movl 0x60(%rbp), %r10d
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
callq *%rax
cmpl $0x0, 0x38(%rbp)
jge 0x1d736
xorl %eax, %eax
subl 0x38(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x1d73f
movl 0x38(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, 0x40(%rbp)
jge 0x1d75b
xorl %eax, %eax
subl 0x40(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x1d764
movl 0x40(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x74(%rbp)
cmpq $0x0, 0x30(%rbp)
je 0x1db3d
movq -0x40(%rbp), %rax
movl (%rax), %eax
cmpl 0x60(%rbp), %eax
jge 0x1db3d
movl -0x34(%rbp), %eax
cmpl -0x70(%rbp), %eax
jl 0x1db3d
movl -0x34(%rbp), %eax
cmpl -0x74(%rbp), %eax
jg 0x1db3d
movq 0x30(%rbp), %rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %r8
movl (%r8), %r8d
movl -0x6c(%rbp), %r9d
movq 0x10(%rbp), %r15
movl 0x48(%rbp), %r14d
movl 0x50(%rbp), %ebx
movl 0x58(%rbp), %r11d
movl 0x60(%rbp), %r10d
movq %r15, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movl %r10d, 0x20(%rsp)
callq *%rax
movq 0x18(%rbp), %rax
movslq 0x58(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x90(%rbp)
cmpq 0x18(%rbp), %rax
jb 0x1d826
movq -0x90(%rbp), %rax
movl $0x0, (%rax)
jmp 0x1d7ff
movl 0x60(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, %eax
jl 0x1d85d
movq 0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x5c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %edx
movq 0x1fce4(%rip), %rax     # 0x3d538
movslq -0x5c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1d82c
movq -0x40(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x68(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl 0x60(%rbp), %eax
jge 0x1da97
movq 0x1fcb8(%rip), %rax     # 0x3d538
movslq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movl $0x1, -0x84(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x34(%rbp), %eax
jle 0x1d8d9
movq 0x1fc87(%rip), %rax     # 0x3d538
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x54(%rbp), %eax
je 0x1d8cc
movl $0x0, -0x84(%rbp)
jmp 0x1d8ce
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x1d89a
cmpl $0x0, -0x84(%rbp)
je 0x1d8e7
jmp 0x1da89
movl -0x64(%rbp), %eax
subl -0x60(%rbp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x4c(%rbp)
movl $0x1, -0x50(%rbp)
imull $0x3, -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x1d902
jmp 0x1d916
movl -0x60(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jg 0x1d9ea
movq -0x28(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
movq 0x1fbf8(%rip), %rax     # 0x3d538
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq 0x1fbe1(%rip), %rax     # 0x3d538
movl -0x4c(%rbp), %ecx
subl -0x50(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x54(%rbp), %eax
jle 0x1d9bd
movq 0x1fbc9(%rip), %rax     # 0x3d538
movl -0x4c(%rbp), %ecx
subl -0x50(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x1fbb6(%rip), %rax     # 0x3d538
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl -0x50(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x50(%rbp), %ecx
movl -0x4c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4c(%rbp)
movl -0x60(%rbp), %ecx
addl -0x50(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1d9bb
jmp 0x1d9bd
jmp 0x1d950
movl -0x54(%rbp), %edx
movq 0x1fb71(%rip), %rax     # 0x3d538
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x58(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x1d91f
movl -0x50(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jg 0x1d916
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jg 0x1da87
movq 0x1fb1e(%rip), %rax     # 0x3d538
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x1fb10(%rip), %rcx     # 0x3d538
movl -0x5c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x1da7a
movl -0x34(%rbp), %edx
movq -0x30(%rbp), %rax
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x40(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x5c(%rbp), %eax
andl $0x1f, %eax
movslq %eax, %rcx
leaq 0xd9ac(%rip), %rax      # 0x2b410
movl (%rax,%rcx,4), %edx
movq 0x18(%rbp), %rax
movl -0x5c(%rbp), %ecx
sarl $0x5, %ecx
movslq %ecx, %rcx
orl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
jmp 0x1da7c
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x1da0b
jmp 0x1da89
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x1d86d
movq -0x40(%rbp), %rax
movl (%rax), %eax
cmpl -0x68(%rbp), %eax
jle 0x1db31
movq -0x48(%rbp), %rax
movl $0x2, (%rax)
movq 0x20(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x80(%rbp)
movq 0x28(%rbp), %rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %r8
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %r14
movq 0x20(%rbp), %rbx
movl 0x58(%rbp), %r11d
movl 0x60(%rbp), %r10d
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
callq *%rax
movq -0x80(%rbp), %rax
xorq $0x6b1d, %rax           # imm = 0x6B1D
movq 0x20(%rbp), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
andq $0x7fff, %rax           # imm = 0x7FFF
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl $0x7fff, %ecx           # imm = 0x7FFF
cqto
idivq %rcx
movl %edx, %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1db3b
movq -0x48(%rbp), %rax
movl $0x1, (%rax)
jmp 0x1db47
movq -0x48(%rbp), %rax
movl $0x0, (%rax)
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)