// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/GTrie.cpp
// Function: GTrie::census(Graph*)
void GTrie::census(Graph *g) {
  int i;
  int subgraph_size = maxDepth();
  int num_nodes = g->numNodes();

  _root->zeroFrequency();
  
  GTrieNode::mymap = new int[subgraph_size];
  GTrieNode::used  = new bool[num_nodes];
  GTrieNode::numNodes = num_nodes;
  GTrieNode::fastnei  = g->matrixNeighbours();
  GTrieNode::adjM     = g->adjacencyMatrix();
  GTrieNode::numnei   = g->arrayNumNeighbours(); 
  
  if (g->type() == DIRECTED) GTrieNode::isdir = true;
  else                       GTrieNode::isdir = false;
  for (i=0; i<num_nodes; i++)
    GTrieNode::used[i]=false;

  GTrieNode *c = *(_root->child.begin());
  list<GTrieNode *>::iterator ii;
  GTrieNode::glk=1;

  for (i = 0; i<num_nodes; i++) {
    GTrieNode::mymap[0] = i;
    GTrieNode::used[i]=true;
    if (g->type() == DIRECTED)
      for(ii=c->child.begin(); ii!=c->child.end(); ii++)
	(*ii)->goCondDir();
    else
      for(ii=c->child.begin(); ii!=c->child.end(); ii++)
	(*ii)->goCondUndir();
    GTrieNode::used[i]=false;
  }
        
  delete [] GTrieNode::mymap;
  delete [] GTrieNode::used;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x9132
movl %eax, %r15d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movl %eax, %ebp
movq (%r14), %rdi
callq 0x90be
movl %r15d, %eax
shlq $0x2, %rax
testl %r15d, %r15d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, 0x1769c(%rip)     # 0x21b40
movslq %ebp, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x17692(%rip)     # 0x21b48
movl %r15d, 0x176af(%rip)    # 0x21b6c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
movq %rax, 0x17688(%rip)     # 0x21b58
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq %rax, 0x17671(%rip)     # 0x21b50
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xb0(%rax)
movq %rax, 0x1766e(%rip)     # 0x21b60
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
sete 0x1766c(%rip)           # 0x21b70
testl %r15d, %r15d
jle 0xa59f
movq 0x17634(%rip), %rdi     # 0x21b48
movl %ebp, %r15d
xorl %r12d, %r12d
xorl %esi, %esi
movq %r15, %rdx
callq 0x2120
movq (%r14), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %r14
movl $0x1, 0x1762f(%rip)     # 0x21b68
addq $0x30, %r14
movq 0x17604(%rip), %rax     # 0x21b48
movq 0x175f5(%rip), %rcx     # 0x21b40
movl %r12d, (%rcx)
movb $0x1, (%rax,%r12)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq (%r14), %r13
testl %eax, %eax
jne 0xa584
cmpq %r14, %r13
je 0xa589
movq 0x10(%r13), %rdi
callq 0x9486
movq (%r13), %r13
jmp 0xa563
movq 0x10(%r13), %rdi
callq 0x9164
movq (%r13), %r13
cmpq %r14, %r13
jne 0xa577
movq 0x175b8(%rip), %rax     # 0x21b48
movb $0x0, (%rax,%r12)
incq %r12
cmpq %r15, %r12
jne 0xa544
jmp 0xa5a9
movl $0x1, 0x175bf(%rip)     # 0x21b68
movq 0x17590(%rip), %rdi     # 0x21b40
testq %rdi, %rdi
je 0xa5ba
callq 0x2290
movq 0x17587(%rip), %rdi     # 0x21b48
addq $0x8, %rsp
testq %rdi, %rdi
je 0xa5d9
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2290
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq