// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movq 0x13882(%rip), %rax     # 0x197a8
leal 0x1(%rsi), %r14d
movq %rsi, -0x40(%rbp)
movslq %esi, %rbx
movl %edi, (%rax,%rbx,4)
movl 0x13862(%rip), %eax     # 0x1979c
cmpl %eax, %r14d
jne 0x5f7b
imull %eax, %eax
movq %rsp, %rbx
addl $0x10, %eax
andl $-0x10, %eax
subq %rax, %rbx
movq %rbx, %rsp
movq 0x13860(%rip), %rdi     # 0x197b8
movq 0x13849(%rip), %rsi     # 0x197a8
movq %rbx, %rdx
callq 0x6da6
movq 0x1385a(%rip), %rdi     # 0x197c8
movq %rbx, %rsi
callq 0xbc4c
jmp 0x60be
movl %edx, %r12d
movl 0x1381c(%rip), %eax     # 0x197a0
movq %rsp, %r15
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
testl %edx, %edx
jle 0x5faf
movl %r12d, %edx
shlq $0x2, %rdx
movq %r15, %rdi
movq %rcx, %rsi
callq 0x21a0
movl %r12d, -0x2c(%rbp)
movq %r15, -0x38(%rbp)
movl %r14d, -0x30(%rbp)
movq 0x137f6(%rip), %rdi     # 0x197b8
movq 0x137df(%rip), %rax     # 0x197a8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %r13
movq 0x137d9(%rip), %rdi     # 0x197b8
movq 0x137c2(%rip), %rax     # 0x197a8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0x70(%rax)
testl %eax, %eax
jle 0x6071
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 0x13794(%rip), %rcx     # 0x197a8
cmpl (%rcx), %eax
jle 0x6069
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x6049
movq 0x13791(%rip), %rdi     # 0x197b8
movl (%r13,%rbx,4), %esi
movq 0x13775(%rip), %rax     # 0x197a8
movl (%rax,%r12,4), %edx
incq %r12
movq (%rdi), %rax
callq *0x58(%rax)
testb %al, %al
je 0x601b
decl %r12d
jmp 0x604c
movl %r14d, %r12d
cmpl -0x40(%rbp), %r12d
jne 0x6069
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 0x6008
movl -0x2c(%rbp), %eax
testl %eax, %eax
movl -0x30(%rbp), %r14d
movq -0x38(%rbp), %r12
jle 0x60be
movslq %r14d, %rbx
movl %eax, %r15d
callq 0xb21a
movq 0x1372e(%rip), %rax     # 0x197c0
movsd (%rax,%rbx,8), %xmm1
ucomisd %xmm0, %xmm1
jb 0x60b1
movl -0x4(%r12,%r15,4), %edi
leal -0x1(%r15), %edx
movl %r14d, %esi
movq %r12, %rcx
callq 0x5f0e
decq %r15
leaq 0x1(%r15), %rax
cmpq $0x1, %rax
jg 0x6086
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop