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

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


  for (i=0; i<size*size; i++)
    best[i] = in[size*size-1-i];    
  best[size*size]=0;

  for (i=0; i<size; i++) used[i]=0;
  for (i=0; i<size*size; i++) current[i]='2';

  current[size*size]='\0';
  for (i=0; i<size; i++)
    if (nedges[i]==nedges[max]) {
      used[i]=1;
      perm[0]=i;
      current[0]=in[i*size+i];
      _goCan(i, 1, in, perm, used, current, best, size);
      current[0]=i;
      used[i]=0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x28(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movq %rcx, %rsp
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %ecx
imull %ecx, %ecx
movl %ecx, %eax
incl %eax
addl $0x10, %ecx
andl $-0x10, %ecx
movl %ecx, %edx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
movl -0x14(%rbp), %eax
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
movq %rax, -0x50(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xeb87
movq -0x70(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xeb60
movq -0x70(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x18(%rbp), %edx
imull -0x14(%rbp), %edx
addl -0x1c(%rbp), %edx
movslq %edx, %rdx
movsbl (%rcx,%rdx), %edx
subl $0x30, %edx
movslq -0x18(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xeb27
movq -0x70(%rbp), %rcx
movslq -0x18(%rbp), %rax
movl (%rcx,%rax,4), %eax
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0xeb7a
movl -0x18(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xeb7c
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xeb09
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0xebc9
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
subl $0x1, %ecx
subl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xeb8e
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xec01
movq -0x58(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xebe2
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0xec2d
movq -0x60(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb $0x32, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xec08
movq -0x60(%rbp), %rax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xece4
movq -0x70(%rbp), %rcx
movslq -0x18(%rbp), %rax
movl (%rcx,%rax,4), %eax
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xecd4
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %r9
movq -0x68(%rbp), %rcx
movslq -0x18(%rbp), %rax
movb $0x1, (%r8,%rax)
movl -0x18(%rbp), %eax
movb %al, (%rcx)
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %edx
imull -0x14(%rbp), %edx
addl -0x18(%rbp), %edx
movslq %edx, %rdx
movb (%rax,%rdx), %al
movb %al, (%r9)
movl -0x18(%rbp), %edi
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %r10
movl -0x14(%rbp), %eax
movl $0x1, %esi
subq $0x10, %rsp
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xdd40
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %rax
addq $0x10, %rsp
movl -0x18(%rbp), %edx
movb %dl, (%rcx)
movslq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0xecd6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xec46
movq -0x28(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq