// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]gtrieScanner/Isomorphism.cpp
// Function: Isomorphism::_goCan(int, int, char const*, char*, char*, char*, char*, int)
void Isomorphism::_goCan(int x, int pos, const char *in, 
	   char *perm, char *used,
	   char *current, char *best, int size) {
  int i, j;

  if (strcmp(current, best)<0) return;

  if (pos == size) {
    strcpy(best, current);
  } else {

    int nedges[size], max=-1;
    for (i=0; i<size; i++)
      if (!used[i]) {
	nedges[i]=0;
	for (j=0; j<size; j++)
	  if (!used[j] && in[i*size+j]=='1')
	    nedges[i]++;
	if (nedges[i]>max) max=nedges[i];
      }
    

    for (i=0; i<size; i++)
      if (!used[i] /*&& nedges[i]==max*/) {
	used[i]=1;
	perm[pos]=i;
	current[pos*size+pos] = in[i*size+i];
	for (j=0; j<pos; j++) {
	  current[pos*size+j] = in[i*size+perm[j]]; 
	  current[j*size+pos] = in[perm[j]*size+i]; 
	}
	_goCan(i, pos+1, in, perm, used, current, best, size);
	current[pos*size+pos] = '2';
	for (j=0; j<pos; j++) {
	  current[pos*size+j] = '2';
	  current[j*size+pos] = '2';
	}
	used[i]=0;
      }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x3390
cmpl $0x0, %eax
jge 0xdd7c
jmp 0xe015
movl -0x8(%rbp), %eax
cmpl 0x18(%rbp), %eax
jne 0xdd96
movq 0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3250
jmp 0xe015
movl 0x18(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0xde7d
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0xde6d
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0xde4d
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0xde40
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x30(%rbp), %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x31, %eax
jne 0xde40
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xde42
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xddff
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x44(%rbp), %eax
jle 0xde6b
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
jmp 0xde6d
jmp 0xde6f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xddcb
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0xe00e
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0xdffe
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x1, (%rax,%rcx)
movl -0x2c(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x8(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0xdf64
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
imull 0x18(%rbp), %ecx
movq -0x18(%rbp), %rdx
movslq -0x30(%rbp), %rsi
movsbl (%rdx,%rsi), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x8(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x30(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
imull 0x18(%rbp), %ecx
addl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xdeed
movl -0x2c(%rbp), %edi
movl -0x8(%rbp), %esi
addl $0x1, %esi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
movq 0x10(%rbp), %r10
movl 0x18(%rbp), %eax
subq $0x10, %rsp
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xdd40
addq $0x10, %rsp
movq -0x28(%rbp), %rax
movl -0x8(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movb $0x32, (%rax,%rcx)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0xdff2
movq -0x28(%rbp), %rax
movl -0x8(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x30(%rbp), %ecx
movslq %ecx, %rcx
movb $0x32, (%rax,%rcx)
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
imull 0x18(%rbp), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movb $0x32, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xdfb5
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0xe000
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xde84
movq -0x38(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)