// File: siolag161[P]louvain-original/main_hierarchy.cpp
// Function: main
int
main(int argc, char **argv) {
  parse_args(argc, argv);

  vector<vector<int> >levels;

  ifstream finput;
  finput.open(filename,fstream::in);

  int l=-1;
  while (!finput.eof()) {
    int node, nodecomm;
    finput >> node >> nodecomm;

    if (finput) {
      if (node==0) {
	l++;
	levels.resize(l+1);
      }
      levels[l].push_back(nodecomm);
    }
  }

  if (display_level==-1) {
    cout << "Number of levels: " << levels.size() << endl;
    for (unsigned int i=0 ; i<levels.size();i++)
      cout << "level " << i << ": " << levels[i].size() << " nodes" << endl;
  } else if (display_level<0 || (unsigned)display_level>=levels.size()) {
    cerr << "Incorrect level\n";
  } else {
    vector<int> n2c(levels[0].size());

    for (unsigned int i=0 ; i<levels[0].size() ; i++)
      n2c[i]=i;
    
    for (l=0 ; l<display_level ; l++)
      for (unsigned int node=0 ; node<levels[0].size() ; node++)
	n2c[node] = levels[l][n2c[node]];
    
    for (unsigned int node=0 ; node<levels[0].size() ; node++)
      cout << node << " " << n2c[node] << endl;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1490
leaq -0x28(%rbp), %rdi
callq 0x1bf0
leaq -0x230(%rbp), %rdi
callq 0x1120
jmp 0x15fc
movq 0x5b1d(%rip), %rsi      # 0x7120
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x10b0
jmp 0x1616
movl $0xffffffff, -0x240(%rbp) # imm = 0xFFFFFFFF
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x230(%rbp,%rax), %rdi
callq 0x11d0
movb %al, -0x279(%rbp)
jmp 0x1640
movb -0x279(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1651
jmp 0x1736
leaq -0x230(%rbp), %rdi
leaq -0x244(%rbp), %rsi
callq 0x10a0
movq %rax, -0x288(%rbp)
jmp 0x166d
movq -0x288(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x10a0
jmp 0x1682
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x230(%rbp,%rax), %rdi
callq 0x1140
movb %al, -0x289(%rbp)
jmp 0x16a2
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x16b1
jmp 0x1731
cmpl $0x0, -0x244(%rbp)
jne 0x170e
movl -0x240(%rbp), %eax
incl %eax
movl %eax, -0x240(%rbp)
movl -0x240(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x1c10
jmp 0x16de
jmp 0x170e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1bd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1bc8
movslq -0x240(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x1ca0
movq %rax, %rdi
leaq -0x248(%rbp), %rsi
callq 0x1cc0
jmp 0x172f
jmp 0x1731
jmp 0x1620
cmpl $-0x1, 0x59c3(%rip)     # 0x7100
jne 0x1898
movq 0x5886(%rip), %rdi      # 0x6fd0
leaq 0x2a6f(%rip), %rsi      # 0x41c0
callq 0x10e0
movq %rax, -0x298(%rbp)
jmp 0x175f
leaq -0x28(%rbp), %rdi
callq 0x1d30
movq -0x298(%rbp), %rdi
movq %rax, %rsi
callq 0x1030
movq %rax, -0x2a0(%rbp)
jmp 0x1780
movq -0x2a0(%rbp), %rdi
movq 0x5832(%rip), %rsi      # 0x6fc0
callq 0x1110
jmp 0x1795
movl $0x0, -0x24c(%rbp)
movl -0x24c(%rbp), %eax
movq %rax, -0x2a8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x1d30
movq %rax, %rcx
movq -0x2a8(%rbp), %rax
cmpq %rcx, %rax
jae 0x1893
movq 0x5801(%rip), %rdi      # 0x6fd0
leaq 0x29fd(%rip), %rsi      # 0x41d3
callq 0x10e0
movq %rax, -0x2b0(%rbp)
jmp 0x17e4
movq -0x2b0(%rbp), %rdi
movl -0x24c(%rbp), %esi
callq 0x1150
movq %rax, -0x2b8(%rbp)
jmp 0x17ff
movq -0x2b8(%rbp), %rdi
leaq 0x27fc(%rip), %rsi      # 0x4009
callq 0x10e0
movq %rax, -0x2c0(%rbp)
jmp 0x181b
movl -0x24c(%rbp), %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x1ca0
movq %rax, %rdi
callq 0x1d60
movq -0x2c0(%rbp), %rdi
movq %rax, %rsi
callq 0x1030
movq %rax, -0x2c8(%rbp)
jmp 0x184c
movq -0x2c8(%rbp), %rdi
leaq 0x2980(%rip), %rsi      # 0x41da
callq 0x10e0
movq %rax, -0x2d0(%rbp)
jmp 0x1868
movq -0x2d0(%rbp), %rdi
movq 0x574a(%rip), %rsi      # 0x6fc0
callq 0x1110
jmp 0x187d
jmp 0x187f
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
jmp 0x179f
jmp 0x1ba7
cmpl $0x0, 0x5861(%rip)      # 0x7100
jl 0x18c6
movl 0x5859(%rip), %eax      # 0x7100
movq %rax, -0x2d8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x1d30
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
cmpq %rcx, %rax
jb 0x18e0
movq 0x5723(%rip), %rdi      # 0x6ff0
leaq 0x290d(%rip), %rsi      # 0x41e1
callq 0x10e0
jmp 0x18db
jmp 0x1ba5
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x1ca0
movq %rax, %rdi
callq 0x1d60
movq %rax, -0x2e8(%rbp)
leaq -0x269(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x1d80
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
leaq -0x268(%rbp), %rdi
callq 0x1da0
jmp 0x192b
leaq -0x269(%rbp), %rdi
callq 0x1e10
movl $0x0, -0x270(%rbp)
movl -0x270(%rbp), %eax
movq %rax, -0x2f0(%rbp)
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1ca0
movq %rax, %rdi
callq 0x1d60
movq %rax, %rcx
movq -0x2f0(%rbp), %rax
cmpq %rcx, %rax
jae 0x19ce
movl -0x270(%rbp), %eax
movl %eax, -0x2f4(%rbp)
movl -0x270(%rbp), %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
callq 0x1e30
movl -0x2f4(%rbp), %ecx
movl %ecx, (%rax)
movl -0x270(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x270(%rbp)
jmp 0x1941
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x269(%rbp), %rdi
callq 0x1e10
jmp 0x1bc8
movl $0x0, -0x240(%rbp)
movl -0x240(%rbp), %eax
cmpl 0x571c(%rip), %eax      # 0x7100
jge 0x1aad
movl $0x0, -0x274(%rbp)
movl -0x274(%rbp), %eax
movq %rax, -0x300(%rbp)
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1ca0
movq %rax, %rdi
callq 0x1d60
movq %rax, %rcx
movq -0x300(%rbp), %rax
cmpq %rcx, %rax
jae 0x1a97
movslq -0x240(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x1ca0
movq %rax, -0x310(%rbp)
movl -0x274(%rbp), %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
callq 0x1e30
movq -0x310(%rbp), %rdi
movslq (%rax), %rsi
callq 0x1e30
movl (%rax), %eax
movl %eax, -0x304(%rbp)
movl -0x274(%rbp), %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
callq 0x1e30
movl -0x304(%rbp), %ecx
movl %ecx, (%rax)
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
jmp 0x19f4
jmp 0x1a99
movl -0x240(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x240(%rbp)
jmp 0x19d8
movl $0x0, -0x278(%rbp)
movl -0x278(%rbp), %eax
movq %rax, -0x318(%rbp)
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1ca0
movq %rax, %rdi
callq 0x1d60
movq %rax, %rcx
movq -0x318(%rbp), %rax
cmpq %rcx, %rax
jae 0x1b99
movl -0x278(%rbp), %esi
movq 0x54d7(%rip), %rdi      # 0x6fd0
callq 0x1150
movq %rax, -0x320(%rbp)
jmp 0x1b07
movq -0x320(%rbp), %rdi
leaq 0x24f5(%rip), %rsi      # 0x400a
callq 0x10e0
movq %rax, -0x328(%rbp)
jmp 0x1b23
movl -0x278(%rbp), %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
callq 0x1e30
movq -0x328(%rbp), %rdi
movl (%rax), %esi
callq 0x11b0
movq %rax, -0x330(%rbp)
jmp 0x1b4e
movq -0x330(%rbp), %rdi
movq 0x5464(%rip), %rsi      # 0x6fc0
callq 0x1110
jmp 0x1b63
jmp 0x1b65
movl -0x278(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x278(%rbp)
jmp 0x1ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x1e50
jmp 0x1bc8
leaq -0x268(%rbp), %rdi
callq 0x1e50
jmp 0x1ba7
leaq -0x230(%rbp), %rdi
callq 0x1040
leaq -0x28(%rbp), %rdi
callq 0x1eb0
movl -0x4(%rbp), %eax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x230(%rbp), %rdi
callq 0x1040
leaq -0x28(%rbp), %rdi
callq 0x1eb0
movq -0x238(%rbp), %rdi
callq 0x11c0
nopl (%rax)