// File: /workspace/github_cpp_makefile_star2_O1/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 $0x268, %rsp            # imm = 0x268
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
leaq 0x60(%rsp), %rdi
movq %rbx, 0x28(%rsp)
callq 0x21c0
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x20f0
leaq 0x38(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x80(%rsp,%rax)
jne 0x263d
leaq 0x60(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rsp, %r14
leaq 0x8(%rsp), %r15
movl %ebp, 0x1c(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
je 0x2512
movq %r12, %rdi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
movq %r14, %rsi
callq 0x22a0
jmp 0x2535
movq %r12, %rdi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
movq %r14, %rsi
callq 0x22a0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2100
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x80(%rsp,%rax)
jne 0x2626
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movl 0x4(%rsp), %ecx
movl (%rsp), %esi
cmpl %esi, %ecx
cmoval %ecx, %esi
incl %esi
cmpq %rsi, %rax
ja 0x2580
movq %rbx, %rdi
callq 0x2fba
movl 0x4(%rsp), %eax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
addq (%rbx), %rdi
movl (%rsp), %eax
movl %eax, 0x8(%rsp)
cvtsd2ss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rsi
callq 0x35d8
movl 0x4(%rsp), %eax
movl (%rsp), %ecx
cmpl %ecx, %eax
je 0x25db
leaq (%rcx,%rcx,2), %rdi
shlq $0x3, %rdi
addq (%rbx), %rdi
movl %eax, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsd2ss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rsi
callq 0x35d8
movq %r14, %rbp
movq %r13, %r14
movq %r12, %r13
movl 0x4(%rsp), %eax
movl %eax, 0x8(%rsp)
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x374e
movl (%rsp), %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
movq %r15, %rbx
movq %r15, %rsi
callq 0x374e
movq %r13, %r12
movq %r14, %r13
movq %rbp, %r14
movq %rbx, %r15
movq 0x28(%rsp), %rbx
movl 0x1c(%rsp), %ebp
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x80(%rsp,%rax)
je 0x24e7
movq 0x48(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x385e
movq 0x18(%rbx), %r14
movq 0x20(%rbx), %r15
cmpq %r15, %r14
je 0x268b
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x39e9
movq %r14, %rdi
movq %r15, %rsi
callq 0x3acc
leaq 0x60(%rsp), %rdi
callq 0x2060
leaq 0x30(%rsp), %rdi
callq 0x32e4
leaq 0x60(%rsp), %rdi
callq 0x2070
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x26dc
movq %rax, %r14
jmp 0x26e6
jmp 0x26cf
jmp 0x26cf
jmp 0x26cf
jmp 0x26cf
jmp 0x26cf
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x32e4
leaq 0x60(%rsp), %rdi
callq 0x2070
movq 0x20(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
movq 0x28(%rsp), %rbx
je 0x2704
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2ff6
movq %r14, %rdi
callq 0x22b0