// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq (%rdi), %rdi
callq 0x8fa0
movl %eax, %r14d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movl %eax, %ebp
movq (%r15), %rdi
callq 0x8f2c
movslq %r14d, %rax
leaq (,%rax,4), %rcx
testl %eax, %eax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x2030
movq %rax, 0x1780d(%rip)     # 0x21b40
movslq %ebp, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, 0x17803(%rip)     # 0x21b48
movl %r12d, 0x17820(%rip)    # 0x21b6c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
movq %rax, 0x177f9(%rip)     # 0x21b58
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq %rax, 0x177e2(%rip)     # 0x21b50
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xb0(%rax)
movq %rax, 0x177df(%rip)     # 0x21b60
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
sete 0x177dd(%rip)           # 0x21b70
movl %r12d, %r14d
testl %r12d, %r12d
jle 0xa3ac
movq 0x177a6(%rip), %rdi     # 0x21b48
xorl %esi, %esi
movq %r14, %rdx
callq 0x2120
movq (%r15), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %r15
movl $0x1, 0x177a7(%rip)     # 0x21b68
testl %ebp, %ebp
jle 0xa431
addq $0x30, %r15
xorl %r12d, %r12d
movq 0x1776d(%rip), %rax     # 0x21b40
movl %r12d, (%rax)
movq 0x1776b(%rip), %rax     # 0x21b48
movb $0x1, (%rax,%r12)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
je 0xa406
movq (%r15), %r13
cmpq %r15, %r13
je 0xa41d
movq 0x10(%r13), %rdi
callq 0x8fd2
movq (%r13), %r13
jmp 0xa3f2
movq (%r15), %r13
cmpq %r15, %r13
je 0xa41d
movq 0x10(%r13), %rdi
callq 0x92fa
movq (%r13), %r13
jmp 0xa409
movq 0x17724(%rip), %rax     # 0x21b48
movb $0x0, (%rax,%r12)
incq %r12
cmpq %r14, %r12
jne 0xa3cc
movq 0x17708(%rip), %rdi     # 0x21b40
testq %rdi, %rdi
je 0xa442
callq 0x2290
movq 0x176ff(%rip), %rdi     # 0x21b48
addq $0x8, %rsp
testq %rdi, %rdi
je 0xa461
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