// File: /workspace/github_cpp_makefile_star2_O2/riyadparvez[P]louvain-method/graph.cpp
// Function: Graph::Graph(char*, int)
Graph::Graph(char *filename, int type) {
  ifstream finput;
  finput.open(filename,fstream::in);
  set<int> s; 
  int nb_links=0;

  while (!finput.eof()) {
    unsigned int src, dest;
    double weight=1.;

    if (type==WEIGHTED) {
      finput >> src >> dest >> weight;
    } else {
      finput >> src >> dest;
    }
    
    if (finput) {
      if (links.size()<=max(src,dest)+1) {
        links.resize(max(src,dest)+1);
      }
      
      links[src].push_back(make_pair(dest,weight));
      if (src!=dest)
        links[dest].push_back(make_pair(src,weight));
      s.insert(src);
      s.insert(dest);
      nb_links++;
    }
  }
  //copy(s.begin(), s.end(), nodes.begin());
  copy(s.begin(), s.end(), std::back_inserter(nodes));
  sort(nodes.begin(), nodes.end());
  finput.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
leaq 0x50(%rsp), %rdi
callq 0x2170
leaq 0x50(%rsp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x20c0
leaq 0x28(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x50(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rsp, %r14
leaq 0x8(%rsp), %r15
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x70(%rsp,%rax)
jne 0x253c
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
je 0x2451
movq %r12, %rdi
movq %r13, %rsi
callq 0x2230
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
jmp 0x2474
movq %r12, %rdi
movq %r13, %rsi
callq 0x2230
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x20d0
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x70(%rsp,%rax)
jne 0x2412
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
movl 0x4(%rsp), %edi
movl (%rsp), %edx
cmpl %edx, %edi
movl %edx, %esi
cmoval %edi, %esi
incl %esi
cmpq %rsi, %rax
ja 0x24bd
movq %rbx, %rdi
callq 0x2cc4
movl 0x4(%rsp), %edi
movq (%rbx), %rcx
movl (%rsp), %edx
movl %edi, %eax
imulq $0x18, %rax, %rdi
addq %rcx, %rdi
movl %edx, 0x8(%rsp)
cvtsd2ss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rsi
callq 0x32e8
movl 0x4(%rsp), %eax
movl (%rsp), %ecx
cmpl %ecx, %eax
je 0x250c
imulq $0x18, %rcx, %rdi
addq (%rbx), %rdi
movl %eax, 0x8(%rsp)
cvtsd2ss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rsi
callq 0x32e8
movl 0x4(%rsp), %eax
movl %eax, 0x8(%rsp)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x347c
movl (%rsp), %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x347c
leaq 0x50(%rsp), %r12
jmp 0x2412
movq 0x38(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x35ce
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rsi
callq 0x3763
leaq 0x50(%rsp), %rdi
callq 0x2050
leaq 0x20(%rsp), %rdi
callq 0x2f0a
leaq 0x50(%rsp), %rdi
callq 0x2060
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x25ae
movq %rax, %r14
jmp 0x25b8
jmp 0x25a1
jmp 0x25a1
jmp 0x25a1
jmp 0x25a1
jmp 0x25a1
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x2f0a
leaq 0x50(%rsp), %rdi
callq 0x2060
movq 0x18(%rsp), %rdi
callq 0x3074
movq %rbx, %rdi
callq 0x2cfa
movq %r14, %rdi
callq 0x2240