// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/Conditions.cpp
// Function: Conditions::isomorphicExtensions()
void Conditions::isomorphicExtensions() {
  int i, j, cand[_subgraph_size], ncand;
  int *v, num;

  if (pos == _subgraph_size) {

    smallNode *v = new smallNode[_subgraph_size];
    for (i=0; i<fastf->numf; i++) v[i]=fastf->f[i];
    fastvv->push_back(v);

  } else {    

    list<iPair>::iterator ii;
    int n, m;
    int flag;

    int count[_subgraph_size];

    ncand=0;
    for (i=0; i<_subgraph_size; i++) count[i]=0;

    for (i=0; i<_subgraph_size; i++)     // For all nodes of H already mapped
      if (fastf->f[i]!=INVALID) {        // find their not mapped neighbours
	v = fastg->arrayNeighbours(i);    
	num = fastg->numNeighbours(i);
	for (j=0; j<num; j++)
	  if (fastf->f[v[j]]==INVALID) {
	    if (count[v[j]]==0) 
	      cand[ncand++]=v[j];	    
	    count[v[j]]++;
	  }	
      }

   // Find most constrained neighbour 'm' (with more mapped neighbours)
    m = 0;
    for (i=1; i<ncand; i++)    
      if (count[i]>count[m])  // Later: add more restraining conditions??
	m = i;
    m = cand[m];

    ncand=0;
    bool already[_subgraph_size];
    for (i=0; i<_subgraph_size; i++) already[i]=false;

    for (i=0; i<_subgraph_size; i++)  // For all nodes of G already mapped
      if (fastf->f[i]!=INVALID) {         // find their not mapped neighbours 
	v = fastg->arrayNeighbours(fastf->f[i]);    
	num = fastg->numNeighbours(fastf->f[i]);    
	for (j=0; j<num; j++)
	  if (!already[v[j]] && fastf->r[v[j]]==INVALID && fasts[m*_subgraph_size+v[j]])  {
	    cand[ncand++]=v[j];
	    already[v[j]]=true;
	  }
      }
        
    for (i=0; i<ncand; i++) {
      n = cand[i];

      flag = false;

      for (j=0; j<_subgraph_size; j++)
	if (fastf->f[j]!=INVALID) {
	  if      (adj[m][j] != adj[n][fastf->f[j]])      {flag=true; break;}
	  else if (adj[j][m] != adj[fastf->f[j]][n])      {flag=true; break;}
	}

      if (!flag) {	
	fastf->add(m, n);
	pos++;
	isomorphicExtensions();
	pos--;
	fastf->remove(m);
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x13053(%rip), %eax     # 0x197d4
movq %rsp, %rdx
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, %rsp
cmpl %eax, 0x1303c(%rip)     # 0x197d8
jne 0x67f1
movslq %eax, %rdi
callq 0x2030
movq %rax, -0x50(%rbp)
movq 0x1302f(%rip), %rcx     # 0x197e0
cmpl $0x0, (%rcx)
jle 0x67cf
xorl %edx, %edx
movq 0x8(%rcx), %rsi
movb (%rsi,%rdx,4), %sil
movb %sil, (%rax,%rdx)
incq %rdx
movslq (%rcx), %rsi
cmpq %rsi, %rdx
jl 0x67b8
movq 0x1301a(%rip), %rdi     # 0x197f0
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6aad
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6ab6
movq %rdx, -0x38(%rbp)
movq %rsp, -0x48(%rbp)
movq %rsp, %rbx
subq %rcx, %rbx
movq %rbx, %rsp
movslq 0x12fcb(%rip), %rdx     # 0x197d4
testq %rdx, %rdx
jle 0x6aa7
shlq $0x2, %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2120
movq 0x12fb6(%rip), %rcx     # 0x197e0
xorl %r12d, %r12d
movq -0x38(%rbp), %r13
movq 0x8(%rcx), %rax
cmpl $-0x1, (%rax,%r14,4)
je 0x68a5
movq 0x12fa5(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
movl %r14d, %esi
callq *0xa8(%rax)
movq %rax, %r15
movq 0x12f8f(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
movl %r14d, %esi
callq *0x70(%rax)
movq 0x12f77(%rip), %rcx     # 0x197e0
testl %eax, %eax
jle 0x68a5
movq 0x8(%rcx), %rdx
movl %eax, %eax
xorl %esi, %esi
movl (%r15,%rsi,4), %r9d
movslq %r9d, %rdi
cmpl $-0x1, (%rdx,%rdi,4)
jne 0x689d
movl (%rbx,%rdi,4), %r8d
testl %r8d, %r8d
jne 0x6896
movslq %r12d, %r10
incl %r12d
movl %r9d, (%r13,%r10,4)
incl %r8d
movl %r8d, (%rbx,%rdi,4)
incq %rsi
cmpq %rsi, %rax
jne 0x6875
incq %r14
movslq 0x12f25(%rip), %r15     # 0x197d4
cmpq %r15, %r14
jl 0x6831
movl %r15d, %edx
xorl %eax, %eax
cmpl $0x2, %r12d
jl 0x68e9
movl %r12d, %ecx
movl $0x1, %esi
movl (%rbx,%rsi,4), %r8d
movslq %eax, %r9
movl %esi, %edi
cmpl (%rbx,%r9,4), %r8d
jg 0x68dc
movl %eax, %edi
incq %rsi
movl %edi, %eax
cmpq %rsi, %rcx
jne 0x68cb
movslq %edi, %rax
movq %rsp, %rbx
leaq 0xf(%rdx), %rcx
andq $-0x10, %rcx
subq %rcx, %rbx
movq %rbx, %rsp
testl %r15d, %r15d
jle 0x6aa7
movq -0x38(%rbp), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, -0x3c(%rbp)
movslq %eax, %r13
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2120
movq 0x12ebc(%rip), %rcx     # 0x197e0
xorl %r11d, %r11d
movq 0x8(%rcx), %rax
movl (%rax,%r12,4), %esi
cmpl $-0x1, %esi
je 0x69da
movl %r11d, -0x2c(%rbp)
movq 0x12ea5(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %r14
movq 0x12e92(%rip), %rdi     # 0x197e8
movq 0x12e83(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rax
movl (%rax,%r12,4), %esi
movq (%rdi), %rax
callq *0x70(%rax)
movq 0x12e6e(%rip), %rcx     # 0x197e0
movl 0x12e5b(%rip), %r15d    # 0x197d4
testl %eax, %eax
jle 0x69d6
movq 0x12e74(%rip), %rdx     # 0x197f8
movl %r15d, %esi
imull -0x3c(%rbp), %esi
movl %eax, %eax
xorl %edi, %edi
movl -0x2c(%rbp), %r11d
movl (%r14,%rdi,4), %r9d
movslq %r9d, %r8
cmpb $0x0, (%rbx,%r8)
jne 0x69cc
movq 0x10(%rcx), %r10
cmpl $-0x1, (%r10,%r8,4)
jne 0x69cc
addl %esi, %r9d
movslq %r9d, %r9
cmpb $0x1, (%rdx,%r9)
jne 0x69cc
movslq %r11d, %r9
incl %r11d
movq -0x38(%rbp), %r10
movl %r8d, (%r10,%r9,4)
movb $0x1, (%rbx,%r8)
incq %rdi
cmpq %rdi, %rax
jne 0x6993
jmp 0x69da
movl -0x2c(%rbp), %r11d
incq %r12
movslq %r15d, %rax
cmpq %rax, %r12
jl 0x6927
testl %r11d, %r11d
jle 0x6aa7
movl %r11d, %ebx
movq 0x12de4(%rip), %rax     # 0x197e0
xorl %r14d, %r14d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rcx
movl (%rcx,%r14,4), %ecx
movslq %ecx, %rcx
movq 0x8(%rax), %rdx
testl %r15d, %r15d
jle 0x6a5c
movq 0x12de0(%rip), %rsi     # 0x19800
movl %r15d, %edi
xorl %r8d, %r8d
movslq (%rdx,%r8,4), %r9
cmpq $-0x1, %r9
je 0x6a54
movq (%rsi,%r13,8), %r10
movb (%r10,%r8), %r10b
movq (%rsi,%rcx,8), %r11
cmpb (%r11,%r9), %r10b
jne 0x6a9b
movq (%rsi,%r8,8), %r10
movb (%r10,%r13), %r10b
movq (%rsi,%r9,8), %r9
cmpb (%r9,%rcx), %r10b
jne 0x6a9b
incq %r8
cmpq %r8, %rdi
jne 0x6a26
movl %ecx, (%rdx,%r13,4)
movq 0x10(%rax), %rax
movl %r13d, (%rax,%rcx,4)
incl 0x12d6a(%rip)           # 0x197d8
callq 0x676a
decl 0x12d5f(%rip)           # 0x197d8
movq 0x12d60(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
movslq (%rcx,%r13,4), %rsi
movl %r12d, (%rdx,%rsi,4)
movl %r12d, (%rcx,%r13,4)
movl 0x12d39(%rip), %r15d    # 0x197d4
incq %r14
cmpq %rbx, %r14
jne 0x6a05
movq -0x48(%rbp), %rsp
jmp 0x6ab6
leaq -0x50(%rbp), %rdx
callq 0x6d18
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop