// File: /workspace/github_c_makefile_star2_O2/ComplexNetworks-DCC-FCUP[P]gtrieScanner/Conditions.cpp
// Function: Conditions::findAutomorphisms(Graph*, std::vector<char*, std::allocator<char*>>*)
void Conditions::findAutomorphisms(Graph *G, VVsmallNode *vv) {
  int i,j,k;
  int g;

  _subgraph_size = G->numNodes();
  GMap *f = new GMap(_subgraph_size, _subgraph_size);

  int sequence[_subgraph_size][_subgraph_size];

  for (i=0; i<_subgraph_size; i++)
    for (j=0; j<_subgraph_size; j++)
      if (G->isConnected(i,j))
	sequence[i][j] = G->numNeighbours(j);
      else
	sequence[i][j] = 0;

  for (i=0; i<_subgraph_size; i++)
    qsort(sequence[i], _subgraph_size, sizeof(int), int_compare);

  bool support[_subgraph_size*_subgraph_size];
  for (i=0; i<_subgraph_size; i++)
    for (j=0; j<_subgraph_size; j++) {
      for (k=0; k<_subgraph_size; k++)
	if (sequence[i][k] != sequence[j][k]) break;      
      if (k<_subgraph_size) support[i*_subgraph_size+j]=false;
      else support[i*_subgraph_size+j]=true;
    }

  vv->clear();
  fastf  = f;
  fastg  = G;
  fastvv = vv;
  fasts  = support;
  adj = G->adjacencyMatrix();
  for (g=0; g<_subgraph_size; g++)
    if (support[g*_subgraph_size]) {
      f->add(0,g);
      pos = 1;
      isomorphicExtensions();
      f->remove(0);
    }

  delete f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x40(%rbp)
movq %rdi, %r14
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, %r15d
movl %eax, 0x138f9(%rip)     # 0x197f4
pushq $0x18
popq %rdi
callq 0x2200
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r15d, %esi
movl %r15d, %edx
callq 0x5e2e
movl 0x138d9(%rip), %eax     # 0x197f4
movq %rax, %rcx
imulq %rax, %rcx
movq %rsp, %r15
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
subq %rcx, %r15
movq %r15, %rsp
leaq (,%rax,4), %rbx
xorl %r12d, %r12d
movq %r15, -0x38(%rbp)
movslq %eax, %rcx
cmpq %rcx, %r12
jge 0x5f93
xorl %r13d, %r13d
movslq %eax, %rcx
cmpq %rcx, %r13
jge 0x5f8b
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq *0x58(%rax)
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0x5f7c
movq (%r14), %rax
movq %r14, %rdi
movl %r13d, %esi
callq *0x70(%rax)
movl %eax, (%r15,%r13,4)
incq %r13
movl 0x1386b(%rip), %eax     # 0x197f4
jmp 0x5f51
incq %r12
addq %rbx, %r15
jmp 0x5f46
xorl %r12d, %r12d
pushq $0x4
popq %r13
movq -0x38(%rbp), %r15
movslq %eax, %rsi
cmpq %rsi, %r12
jge 0x5fc6
movq %r15, %rdi
movq %r13, %rdx
leaq -0x18b(%rip), %rcx      # 0x5e28
callq 0x2400
incq %r12
movl 0x13833(%rip), %eax     # 0x197f4
addq %rbx, %r15
jmp 0x5f9e
movl %eax, %ecx
imull %ecx, %ecx
movq %rsp, %r15
addl $0xf, %ecx
andl $-0x10, %ecx
subq %rcx, %r15
movq %r15, %rsp
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movl %eax, %eax
movq -0x38(%rbp), %rdi
cmpq %rdx, %rcx
je 0x603c
movq %rcx, %r8
imulq %rsi, %r8
addq %r15, %r8
movq -0x38(%rbp), %r9
xorl %r10d, %r10d
cmpq %rax, %r10
je 0x6034
xorl %r11d, %r11d
cmpq %r11, %rax
je 0x6025
movl (%rdi,%r11,4), %r12d
leaq 0x1(%r11), %r13
cmpl (%r9,%r11,4), %r12d
movq %r13, %r11
je 0x600a
xorl %r11d, %r11d
jmp 0x6028
movb $0x1, %r11b
movb %r11b, (%r8,%r10)
incq %r10
addq %rbx, %r9
jmp 0x6002
incq %rcx
addq %rbx, %rdi
jmp 0x5fec
movq -0x40(%rbp), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x604d
movq %rax, 0x8(%rcx)
movq -0x30(%rbp), %rax
movq %rax, 0x137a8(%rip)     # 0x19800
movq %r14, 0x137a9(%rip)     # 0x19808
movq %rcx, 0x137aa(%rip)     # 0x19810
movq %r15, 0x137ab(%rip)     # 0x19818
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movq %rax, 0x137a4(%rip)     # 0x19820
xorl %ebx, %ebx
movl 0x13770(%rip), %eax     # 0x197f4
movq -0x30(%rbp), %r14
movslq %eax, %rcx
cmpq %rcx, %rbx
jge 0x60d9
movl %eax, %ecx
imull %ebx, %ecx
movslq %ecx, %rcx
cmpb $0x1, (%r15,%rcx)
jne 0x60d4
movq 0x8(%r14), %rax
movl %ebx, (%rax)
movq 0x10(%r14), %rax
andl $0x0, (%rax,%rbx,4)
movl $0x1, 0x13741(%rip)     # 0x197f8
callq 0x6116
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movslq (%rax), %rdx
orl $-0x1, (%rcx,%rdx,4)
orl $-0x1, (%rax)
movl 0x13720(%rip), %eax     # 0x197f4
incq %rbx
jmp 0x6088
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x5eb0
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x2210
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
pushq $0x18
popq %rsi
movq -0x30(%rbp), %rdi
callq 0x2210
movq %r14, %rdi
callq 0x23b0