// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]gtrieScanner/GTrie.cpp
// Function: GTrieNode::writeToFile(_IO_FILE*)
void GTrieNode::writeToFile(FILE *f) {
  int i, bits, aux, nbytes;

  int nchild       = child.size();
  nbytes=0;
  while (nchild>0) {
    nbytes++;
    nchild/=BASE_FORMAT;
  }

  int first_byte   = nbytes<<1;

  // first bit: isgraph ?
  if (is_graph) BIT_SET(first_byte,0);
  else          BIT_CLEAR(first_byte,0);
  fputc(BASE_FIRST+first_byte,f);

  nchild       = child.size();
  while (nchild>0) {
    fputc(BASE_FIRST+(nchild%BASE_FORMAT),f);
    nchild/=BASE_FORMAT;
  }

  // Connections: outgoing
  for (i=0, bits=0, aux=0; i<depth; i++, bits++) {
    if (bits==BASE_BITS) {
      fputc(BASE_FIRST+aux, f);
      aux=0;
      bits=0;
    }
    if (out[i]) BIT_SET(aux, bits);
  }
  fputc(BASE_FIRST+aux, f);


  // Connections: ingoing
  for (i=0, bits=0, aux=0; i<depth; i++, bits++) {
    if (bits==BASE_BITS) {
      fputc(BASE_FIRST+aux, f);
      aux=0;
      bits=0;
    }
    if (in[i]) BIT_SET(aux, bits);
  }
  fputc(BASE_FIRST+aux, f);

  // Previous Conditions
  if (cond_ok) aux = 0;
  else         aux = cond.size();
  fputc(BASE_FIRST+aux, f);

  if (aux>0) {
    list< list<iPair> >::const_iterator jj, jjend;
    list<iPair>::const_iterator kk, kkend;
    for (jj=cond.begin(), jjend=cond.end(); jj!=jjend; ++jj) {      
      for (kk=(*jj).begin(), kkend=(*jj).end(); kk!=kkend; ++kk) {
	fputc(BASE_FIRST+1+(kk->first),f);
	fputc(BASE_FIRST+1+(kk->second),f);
      }
      fputc(BASE_FIRST, f);
    }
  }
  
  fputc('\n', f);

  list<GTrieNode *>::iterator ii;
  for(ii=child.begin(); ii!=child.end(); ii++)
    (*ii)->writeToFile(f);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x30, %rdi
callq 0x15f70
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x12840
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
movl $0x5f, %ecx
cltd
idivl %ecx
movl %eax, -0x24(%rbp)
jmp 0x12821
movq -0xa0(%rbp), %rax
movl -0x20(%rbp), %ecx
shll %ecx
movl %ecx, -0x28(%rbp)
testb $0x1, 0x50(%rax)
je 0x12860
movl -0x28(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x12869
movl -0x28(%rbp), %eax
andl $-0x2, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movq -0xa0(%rbp), %rdi
addq $0x30, %rdi
callq 0x15f70
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x128ba
movl -0x24(%rbp), %eax
movl $0x5f, %ecx
cltd
idivl %ecx
movl %edx, %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movl -0x24(%rbp), %eax
movl $0x5f, %ecx
cltd
idivl %ecx
movl %eax, -0x24(%rbp)
jmp 0x1288b
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x4c(%rcx), %eax
jge 0x1293c
cmpl $0x6, -0x18(%rbp)
jne 0x12901
movl -0x1c(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movq -0xa0(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x14(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x12926
movl -0x18(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x12928
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x128cf
movl -0x1c(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x4c(%rcx), %eax
jge 0x129cd
cmpl $0x6, -0x18(%rbp)
jne 0x12992
movl -0x1c(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movq -0xa0(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x14(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x129b7
movl -0x18(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x129b9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x12960
movl -0x1c(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
movq -0xa0(%rbp), %rax
testb $0x1, 0x48(%rax)
je 0x129f2
movl $0x0, -0x1c(%rbp)
jmp 0x12a05
movq -0xa0(%rbp), %rdi
addq $0x18, %rdi
callq 0x15fa0
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
addl $0x20, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
cmpl $0x0, -0x1c(%rbp)
jle 0x12b4f
leaq -0x30(%rbp), %rdi
callq 0x15200
leaq -0x38(%rbp), %rdi
callq 0x15200
leaq -0x40(%rbp), %rdi
callq 0x15220
leaq -0x48(%rbp), %rdi
callq 0x15220
movq -0xa0(%rbp), %rdi
addq $0x18, %rdi
callq 0x154b0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x15c80
movq -0xa0(%rbp), %rdi
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x18, %rdi
callq 0x15510
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x15c80
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x15d30
testb $0x1, %al
jne 0x12aaa
jmp 0x12b4d
leaq -0x30(%rbp), %rdi
callq 0x15d60
movq %rax, %rdi
callq 0x15d90
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x15d60
movq %rax, %rdi
callq 0x15dc0
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x15df0
testb $0x1, %al
jne 0x12af7
jmp 0x12b31
leaq -0x40(%rbp), %rdi
callq 0x15e20
movl (%rax), %edi
addl $0x21, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
leaq -0x40(%rbp), %rdi
callq 0x15e20
movl 0x4(%rax), %edi
addl $0x21, %edi
movq -0x10(%rbp), %rsi
callq 0x3350
leaq -0x40(%rbp), %rdi
callq 0x15e40
jmp 0x12ae4
movq -0x10(%rbp), %rsi
movl $0x20, %edi
callq 0x3350
leaq -0x30(%rbp), %rdi
callq 0x15e90
jmp 0x12a94
jmp 0x12b4f
movq -0x10(%rbp), %rsi
movl $0xa, %edi
callq 0x3350
leaq -0x80(%rbp), %rdi
callq 0x15390
movq -0xa0(%rbp), %rdi
addq $0x30, %rdi
callq 0x153b0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xa0(%rbp), %rdi
addq $0x30, %rdi
callq 0x15410
movq %rax, -0x90(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x153e0
testb $0x1, %al
jne 0x12bb5
jmp 0x12bde
leaq -0x80(%rbp), %rdi
callq 0x15440
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x127f0
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x15460
movq %rax, -0x98(%rbp)
jmp 0x12b88
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)