// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/Esu.cpp
// Function: Esu::_goSample(int, int, int, int*)
void Esu::_goSample(int n, int size, int next, int *ext) {

  _current[size++] = n;

  if (size==_motif_size) {
    char s[_motif_size*_motif_size+1];
    Isomorphism::canonicalStrNauty(_g, _current, s);
    _sg->incrementString(s);
  } else {
    int i,j;
    int next2 = next;
    int ext2[_graph_size];

    for (i=0;i<next;i++) ext2[i] = ext[i];

    int *v  = _g->arrayNeighbours(_current[size-1]);
    int num = _g->numNeighbours(_current[size-1]);
    for (i=0;i<num;i++) {
      if (v[i]<=_current[0]) continue;
      for (j=0;j+1<size;j++)
	if (_g->isConnected(v[i],_current[j])) break;
      if (j+1==size) ext2[next2++]=v[i];      
    }
    while (next2>0) {
      next2--;
      if (Random::getDouble()<=_prob[size])
	_goSample(ext2[next2], size, next2, ext2);
    }
  }
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r15d
movq 0x13721(%rip), %rax     # 0x197a8
leal 0x1(%rsi), %edx
movq %rsi, -0x40(%rbp)
movslq %esi, %rbx
movl %edi, (%rax,%rbx,4)
cmpl 0x13702(%rip), %edx     # 0x1979c
jne 0x60de
movq %rsp, %rbx
imull %edx, %edx
movq %rsp, %r14
addl $0x10, %edx
andl $-0x10, %edx
subq %rdx, %r14
movq %r14, %rsp
movq 0x13700(%rip), %rdi     # 0x197b8
movq 0x136e9(%rip), %rsi     # 0x197a8
movq %r14, %rdx
callq 0x6eb6
movq 0x136fa(%rip), %rdi     # 0x197c8
movq %r14, %rsi
callq 0xbda0
movq %rbx, %rsp
jmp 0x6227
movq %rdx, -0x50(%rbp)
movq %rsp, -0x48(%rbp)
movl 0x136b4(%rip), %eax     # 0x197a0
movq %rsp, %r14
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
testl %r15d, %r15d
jle 0x6118
movl %r15d, %edx
shlq $0x2, %rdx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x21a0
movl %r15d, -0x2c(%rbp)
movq %r14, -0x38(%rbp)
movq 0x13691(%rip), %rdi     # 0x197b8
movq 0x1367a(%rip), %rax     # 0x197a8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %r13
movq 0x13674(%rip), %rdi     # 0x197b8
movq 0x1365d(%rip), %rax     # 0x197a8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0x70(%rax)
testl %eax, %eax
jle 0x61d6
xorl %ebx, %ebx
movq -0x40(%rbp), %rcx
testl %ecx, %ecx
movl $0x0, %r14d
cmovgl %ecx, %r14d
movl %eax, %r15d
movl (%r13,%rbx,4), %eax
movq 0x1362f(%rip), %rcx     # 0x197a8
cmpl (%rcx), %eax
jle 0x61ce
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x61ae
movq 0x1362c(%rip), %rdi     # 0x197b8
movl (%r13,%rbx,4), %esi
movq 0x13610(%rip), %rax     # 0x197a8
movl (%rax,%r12,4), %edx
incq %r12
movq (%rdi), %rax
callq *0x58(%rax)
testb %al, %al
je 0x6180
decl %r12d
jmp 0x61b1
movl %r14d, %r12d
cmpl -0x40(%rbp), %r12d
jne 0x61ce
movl (%r13,%rbx,4), %eax
movl -0x2c(%rbp), %edx
movslq %edx, %rcx
incl %edx
movl %edx, -0x2c(%rbp)
movq -0x38(%rbp), %rdx
movl %eax, (%rdx,%rcx,4)
incq %rbx
cmpq %r15, %rbx
jne 0x616d
movl -0x2c(%rbp), %eax
testl %eax, %eax
movq -0x50(%rbp), %r14
movq -0x38(%rbp), %r12
jle 0x6223
movslq %r14d, %rbx
movl %eax, %r15d
callq 0xb396
movq 0x135c9(%rip), %rax     # 0x197c0
movsd (%rax,%rbx,8), %xmm1
ucomisd %xmm0, %xmm1
jb 0x6216
movl -0x4(%r12,%r15,4), %edi
leal -0x1(%r15), %edx
movl %r14d, %esi
movq %r12, %rcx
callq 0x606c
decq %r15
leaq 0x1(%r15), %rax
cmpq $0x1, %rax
ja 0x61eb
movq -0x48(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq