// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]fase/DynamicGraph.cpp
// Function: DynamicGraph::prepareGraph()
void DynamicGraph::prepareGraph() {
  _deleteAux();
  ready = true;

  hybrid_ch = new int[_num_nodes];

  int i, j;
  long long int total = 0;
  for (i = 0; i < _num_nodes; i++) {
    sort(_adjOut[i].begin(), _adjOut[i].end());
    sort(_adjIn[i].begin(), _adjIn[i].end());

    total += _out[i];
  }

  int tmp_log = 2 * total / _num_nodes;
  _sqrt_nodes = 1;
  while (_sqrt_nodes < tmp_log)
    _sqrt_nodes *= 2;
  _sqrt_nodes--;

  _adjM = new bool*[_num_nodes];

  vector<pair<int, int> > vs;
  for (i = 0; i < _num_nodes; i++) {
    hybrid_ch[i] = 1;
    vs.push_back(pair<int, int>(_out[i], i));
  }

  sort(vs.begin(), vs.end());
  reverse(vs.begin(), vs.end());

  for (i = 0; i < min(5 * _sqrt_nodes / 2, _num_nodes); i++) {
    int cur_node = vs[i].second;
    hybrid_ch[cur_node] = 0;
    _adjM[cur_node] = new bool[_num_nodes];
    for (j = 0; j < _num_nodes; j++)
      _adjM[cur_node][j] = false;

    for (j = 0; j < _out[cur_node]; j++)
      _adjM[cur_node][_adjOut[cur_node][j]] = true;
  }

  _hashM = new l_list**[_num_nodes];

  for (i = 0; i < _num_nodes; i++) {
    if (!hybrid_ch[i])
      continue;

    int tmp_log = 5 * _out[i] / 2;
    _hash_out[i] = 1;
    while (_hash_out[i] < tmp_log)
      _hash_out[i] *= 2;
    _hash_out[i]--;

    _hashM[i] = new l_list*[_hash_out[i] + 1];

    for (j = 0; j <= _hash_out[i]; j++)
      _hashM[i][j] = NULL;
  }

  for (i = 0; i < _num_nodes; i++) {
    if (!hybrid_ch[i])
      continue;

    for (j = 0; j < _out[i]; j++) {
      l_list* n_node = new l_list();
      n_node->value = _adjOut[i][j];
      n_node->next = _hashM[i][_adjOut[i][j] & _hash_out[i]];
      _hashM[i][_adjOut[i][j] & _hash_out[i]] = n_node;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0xa8b0
movq -0xb0(%rbp), %rax
movb $0x1, 0x78(%rax)
movslq 0xc(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0xafa4
movq -0xb0(%rbp), %rax
movq 0x58(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xbf10
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq 0x58(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xbf40
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xbed0
movq -0xb0(%rbp), %rax
movq 0x60(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xbf10
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq 0x60(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xbf40
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xbed0
movq -0xb0(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0xc(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xaecc
movq -0xb0(%rbp), %rcx
movq -0x18(%rbp), %rax
shlq %rax
movslq 0xc(%rcx), %rcx
cqto
idivq %rcx
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movl %ecx, -0x3c(%rbp)
movl $0x1, 0x14(%rax)
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0x3c(%rbp), %eax
jge 0xafef
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %ecx
shll %ecx
movl %ecx, 0x14(%rax)
jmp 0xafcf
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x14(%rax)
movslq 0xc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x48(%rax)
leaq -0x58(%rbp), %rdi
callq 0xbf70
movl $0x0, -0xc(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0xb0b8
movq -0xb0(%rbp), %rax
movq 0x40(%rax), %rcx
movslq -0xc(%rbp), %rdx
movl $0x1, (%rcx,%rdx,4)
movq 0x28(%rax), %rax
movslq -0xc(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0x60(%rbp), %rdi
leaq -0xc(%rbp), %rdx
callq 0xbfc0
jmp 0xb082
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xbf90
jmp 0xb091
jmp 0xb093
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb042
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xc150
jmp 0xb5f6
leaq -0x58(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0xc030
movq -0xb8(%rbp), %rdi
movq %rax, -0x78(%rbp)
callq 0xc060
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xbff0
jmp 0xb0eb
leaq -0x58(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0xc030
movq -0xc0(%rbp), %rdi
movq %rax, -0x88(%rbp)
callq 0xc060
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0xc090
jmp 0xb12a
movl $0x0, -0xc(%rbp)
movq -0xb0(%rbp), %rsi
movl -0xc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl 0x14(%rsi), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %ecx, %eax
sarl %eax
movl %eax, -0x94(%rbp)
addq $0xc, %rsi
leaq -0x94(%rbp), %rdi
callq 0xc0d0
movq %rax, -0xc8(%rbp)
jmp 0xb171
movl -0xcc(%rbp), %eax
movq -0xc8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xb2ab
movslq -0xc(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xc110
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movl 0x4(%rcx), %ecx
movl %ecx, -0x98(%rbp)
movq 0x40(%rax), %rcx
movslq -0x98(%rbp), %rdx
movl $0x0, (%rcx,%rdx,4)
movslq 0xc(%rax), %rdi
callq 0x3030
movq %rax, -0xd8(%rbp)
jmp 0xb1ca
movq -0xd8(%rbp), %rdx
movq -0xb0(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x98(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x10(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0xb226
movq -0xb0(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb1ee
movl $0x0, -0x10(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x10(%rbp), %eax
movq 0x28(%rcx), %rcx
movslq -0x98(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xb29b
movq -0xb0(%rbp), %rax
movq 0x48(%rax), %rcx
movslq -0x98(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0xe0(%rbp)
movq 0x58(%rax), %rdi
movslq -0x98(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc130
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movslq (%rcx), %rcx
movb $0x1, (%rax,%rcx)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb22d
jmp 0xb29d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb131
movq -0xb0(%rbp), %rax
movslq 0xc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, -0xe8(%rbp)
jmp 0xb2da
movq -0xb0(%rbp), %rax
movq -0xe8(%rbp), %rcx
movq %rcx, 0x70(%rax)
movl $0x0, -0xc(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0xb448
movq -0xb0(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0xb320
jmp 0xb43a
movq -0xb0(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0xc(%rbp), %rcx
imull $0x5, (%rax,%rcx,4), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, -0x9c(%rbp)
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0xb0(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x9c(%rbp), %eax
jge 0xb38c
movq -0xb0(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %edx
shll %edx
movl %edx, (%rax,%rcx,4)
jmp 0xb359
movq -0xb0(%rbp), %rax
movq 0x30(%rax), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
decl %esi
movl %esi, (%rcx,%rdx,4)
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
incl %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, -0xf0(%rbp)
jmp 0xb3d6
movq -0xf0(%rbp), %rdx
movq -0xb0(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x10(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x10(%rbp), %eax
movq 0x30(%rcx), %rcx
movslq -0xc(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jg 0xb438
movq -0xb0(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb3f7
jmp 0xb43a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb2f3
movl $0x0, -0xc(%rbp)
movq -0xb0(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0xb5e4
movq -0xb0(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0xb47c
jmp 0xb5d6
movl $0x0, -0x10(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x10(%rbp), %eax
movq 0x28(%rcx), %rcx
movslq -0xc(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xb5d4
movl $0x10, %edi
callq 0x3210
movq %rax, -0xf8(%rbp)
jmp 0xb4b1
movq -0xf8(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3100
movq -0xf8(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0xa8(%rbp)
movq 0x58(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc130
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movl (%rcx), %edx
movq -0xa8(%rbp), %rcx
movl %edx, (%rcx)
movq 0x70(%rax), %rcx
movslq -0xc(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x110(%rbp)
movq 0x58(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc130
movq -0x110(%rbp), %rcx
movq %rax, %rdx
movq -0xb0(%rbp), %rax
movl (%rdx), %edx
movq 0x30(%rax), %rsi
movslq -0xc(%rbp), %rdi
andl (%rsi,%rdi,4), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rdx
movq -0xa8(%rbp), %rcx
movq %rdx, 0x8(%rcx)
movq -0xa8(%rbp), %rcx
movq %rcx, -0x108(%rbp)
movq 0x70(%rax), %rcx
movslq -0xc(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x100(%rbp)
movq 0x58(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc130
movq -0xb0(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq %rax, %rcx
movq -0x100(%rbp), %rax
movl (%rcx), %ecx
movq 0x30(%rsi), %rsi
movslq -0xc(%rbp), %rdi
andl (%rsi,%rdi,4), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb483
jmp 0xb5d6
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb44f
leaq -0x58(%rbp), %rdi
callq 0xc150
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3380
nop