// File: /workspace/github_c_makefile_star2_O2/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
movq 0x13d1e(%rip), %rax     # 0x197c8
leal 0x1(%rsi), %r8d
movq %rsi, -0x40(%rbp)
movslq %esi, %rbx
movl %edi, (%rax,%rbx,4)
cmpl 0x13cfd(%rip), %r8d     # 0x197bc
jne 0x5b06
movq %rsp, %r14
imull %r8d, %r8d
movq %rsp, %rbx
addl $0x10, %r8d
andl $-0x10, %r8d
subq %r8, %rbx
movq %rbx, %rsp
movq 0x13cf8(%rip), %rdi     # 0x197d8
movq 0x13ce1(%rip), %rsi     # 0x197c8
movq %rbx, %rdx
callq 0x692a
movq 0x13cf2(%rip), %rdi     # 0x197e8
movq %rbx, %rsi
callq 0xb4b4
movq %r14, %rsp
jmp 0x5c4a
movq %rsp, -0x48(%rbp)
movl 0x13cb0(%rip), %eax     # 0x197c0
movq %rsp, %r14
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %edi
cmovgl %edx, %edi
cmpq %rax, %rdi
je 0x5b42
movl (%rcx,%rax,4), %esi
movl %esi, (%r14,%rax,4)
incq %rax
jmp 0x5b31
movl %edx, -0x2c(%rbp)
movq %r8, -0x50(%rbp)
movq 0x13c88(%rip), %rdi     # 0x197d8
movq 0x13c71(%rip), %rax     # 0x197c8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %r13
movq 0x13c6b(%rip), %rdi     # 0x197d8
movq 0x13c54(%rip), %rax     # 0x197c8
movl (%rax,%rbx,4), %esi
movq (%rdi), %rax
callq *0x70(%rax)
xorl %r12d, %r12d
testl %ebx, %ebx
movl $0x0, %ebx
cmovgl -0x40(%rbp), %ebx
testl %eax, %eax
cmovlel %r12d, %eax
movq %rax, -0x38(%rbp)
cmpq %rax, %r12
je 0x5c01
movl (%r13,%r12,4), %edx
movq 0x13c22(%rip), %rcx     # 0x197c8
cmpl (%rcx), %edx
jle 0x5bfc
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x5bdb
movq 0x13c1f(%rip), %rdi     # 0x197d8
movl (%r13,%r12,4), %esi
movq 0x13c03(%rip), %rax     # 0x197c8
movl (%rax,%r15,4), %edx
incq %r15
movq (%rdi), %rax
callq *0x58(%rax)
testb %al, %al
je 0x5bad
decl %r15d
jmp 0x5bde
movl %ebx, %r15d
cmpl -0x40(%rbp), %r15d
jne 0x5bf8
movl (%r13,%r12,4), %eax
movl -0x2c(%rbp), %edx
movslq %edx, %rcx
incl %edx
movl %edx, -0x2c(%rbp)
movl %eax, (%r14,%rcx,4)
movq -0x38(%rbp), %rax
incq %r12
jmp 0x5b95
movq -0x50(%rbp), %r13
movslq %r13d, %r15
movl -0x2c(%rbp), %ebx
testl %ebx, %ebx
jle 0x5c46
leaq -0x1(%rbx), %r12
callq 0xab36
movq 0x13bc1(%rip), %rax     # 0x197e0
movsd (%rax,%r15,8), %xmm1
ucomisd %xmm0, %xmm1
jb 0x5c41
decl %ebx
movl %r12d, %eax
movl (%r14,%rax,4), %edi
movl %r13d, %esi
movl %ebx, %edx
movq %r14, %rcx
callq 0x5a92
movq %r12, %rbx
jmp 0x5c0b
movq -0x48(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop