// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movl 0x13179(%rip), %eax     # 0x197d4
movq %rsp, %r12
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
subq %rcx, %r12
movq %r12, %rsp
cmpl %eax, 0x13162(%rip)     # 0x197d8
jne 0x66d8
movslq %eax, %rdi
callq 0x2030
movq %rax, -0x38(%rbp)
movq 0x13155(%rip), %rcx     # 0x197e0
cmpl $0x0, (%rcx)
jle 0x66b2
xorl %eax, %eax
movq 0x8(%rcx), %rcx
movb (%rcx,%rax,4), %cl
movq -0x38(%rbp), %rdx
movb %cl, (%rdx,%rax)
incq %rax
movq 0x13136(%rip), %rcx     # 0x197e0
movslq (%rcx), %rdx
cmpq %rdx, %rax
jl 0x6692
movq 0x13137(%rip), %rdi     # 0x197f0
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x679e
movq -0x38(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x699d
movq %rsp, -0x40(%rbp)
movq %rsp, %rbx
subq %rcx, %rbx
movq %rbx, %rsp
movslq 0x130e8(%rip), %rdx     # 0x197d4
testq %rdx, %rdx
jle 0x66ff
shlq $0x2, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2120
movl 0x130cf(%rip), %eax     # 0x197d4
testl %eax, %eax
jle 0x67ac
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x130c6(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rax
cmpl $-0x1, (%rax,%r14,4)
je 0x6789
movq 0x130bc(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
movl %r14d, %esi
callq *0xa8(%rax)
movq %rax, %r15
movq 0x130a6(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
movl %r14d, %esi
callq *0x70(%rax)
testl %eax, %eax
jle 0x6789
movq 0x1308a(%rip), %rcx     # 0x197e0
movq 0x8(%rcx), %rcx
movl %eax, %eax
xorl %edx, %edx
movl (%r15,%rdx,4), %r8d
movslq %r8d, %rsi
cmpl $-0x1, (%rcx,%rsi,4)
jne 0x6781
movl (%rbx,%rsi,4), %edi
testl %edi, %edi
jne 0x677c
movslq %r13d, %r9
incl %r13d
movl %r8d, (%r12,%r9,4)
incl %edi
movl %edi, (%rbx,%rsi,4)
incq %rdx
cmpq %rdx, %rax
jne 0x675e
incq %r14
movslq 0x13041(%rip), %rax     # 0x197d4
cmpq %rax, %r14
jl 0x6713
jmp 0x67af
leaq -0x38(%rbp), %rdx
callq 0x6c06
jmp 0x699d
xorl %r13d, %r13d
xorl %ecx, %ecx
cmpl $0x2, %r13d
jl 0x67dd
movl %r13d, %edx
movl $0x1, %esi
movl (%rbx,%rsi,4), %r8d
movslq %ecx, %r9
movl %esi, %edi
cmpl (%rbx,%r9,4), %r8d
jg 0x67d0
movl %ecx, %edi
incq %rsi
movl %edi, %ecx
cmpq %rsi, %rdx
jne 0x67bf
movslq %edi, %rcx
movl (%r12,%rcx,4), %ecx
movl %ecx, -0x2c(%rbp)
movl %eax, %edx
movq %rsp, %rbx
leaq 0xf(%rdx), %rcx
andq $-0x10, %rcx
subq %rcx, %rbx
movq %rbx, %rsp
testl %eax, %eax
jle 0x6805
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2120
cmpl $0x0, 0x12fc8(%rip)     # 0x197d4
jle 0x68d1
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x12fc1(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rax
movl (%rax,%r15,4), %esi
cmpl $-0x1, %esi
je 0x68bc
movq 0x12fb1(%rip), %rdi     # 0x197e8
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %r14
movq 0x12f9e(%rip), %rdi     # 0x197e8
movq 0x12f8f(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rax
movl (%rax,%r15,4), %esi
movq (%rdi), %rax
callq *0x70(%rax)
testl %eax, %eax
jle 0x68bc
movq 0x12f76(%rip), %rcx     # 0x197e0
movq 0x12f87(%rip), %rdx     # 0x197f8
movl 0x12f5d(%rip), %esi     # 0x197d4
imull -0x2c(%rbp), %esi
movl %eax, %eax
xorl %edi, %edi
movl (%r14,%rdi,4), %r9d
movslq %r9d, %r8
cmpb $0x0, (%rbx,%r8)
jne 0x68b4
movq 0x10(%rcx), %r10
cmpl $-0x1, (%r10,%r8,4)
jne 0x68b4
addl %esi, %r9d
movslq %r9d, %r9
cmpb $0x1, (%rdx,%r9)
jne 0x68b4
movslq %r13d, %r9
incl %r13d
movl %r8d, (%r12,%r9,4)
movb $0x1, (%rbx,%r8)
incq %rdi
cmpq %rdi, %rax
jne 0x687f
incq %r15
movslq 0x12f0e(%rip), %rax     # 0x197d4
cmpq %rax, %r15
jl 0x6818
jmp 0x68d4
xorl %r13d, %r13d
testl %r13d, %r13d
jle 0x6999
movslq -0x2c(%rbp), %rbx
movl %r13d, %r14d
xorl %r15d, %r15d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl (%r12,%r15,4), %eax
cltq
movslq 0x12eda(%rip), %rcx     # 0x197d4
testq %rcx, %rcx
jle 0x6949
movq 0x12eda(%rip), %rdx     # 0x197e0
movq 0x8(%rdx), %rdx
movq 0x12eef(%rip), %rsi     # 0x19800
xorl %edi, %edi
movslq (%rdx,%rdi,4), %r8
cmpq $-0x1, %r8
je 0x6941
movq (%rsi,%rbx,8), %r9
movb (%r9,%rdi), %r9b
movq (%rsi,%rax,8), %r10
cmpb (%r10,%r8), %r9b
jne 0x698d
movq (%rsi,%rdi,8), %r9
movb (%r9,%rbx), %r9b
movq (%rsi,%r8,8), %r8
cmpb (%r8,%rax), %r9b
jne 0x698d
incq %rdi
cmpq %rdi, %rcx
jne 0x6913
movq 0x12e90(%rip), %rcx     # 0x197e0
movq 0x8(%rcx), %rdx
movl %eax, (%rdx,%rbx,4)
movq 0x10(%rcx), %rcx
movl -0x2c(%rbp), %edx
movl %edx, (%rcx,%rax,4)
incl 0x12e71(%rip)           # 0x197d8
callq 0x6644
decl 0x12e66(%rip)           # 0x197d8
movq 0x12e67(%rip), %rax     # 0x197e0
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movslq (%rcx,%rbx,4), %rdx
movl %r13d, (%rax,%rdx,4)
movl %r13d, (%rcx,%rbx,4)
incq %r15
cmpq %r14, %r15
jne 0x68ed
movq -0x40(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq