// File: siolag161[P]louvain-original/graph.cpp
// Function: Graph::Graph(char*, int)
Graph::Graph(char *filename, int type) {
  ifstream finput;
  finput.open(filename,fstream::in);

  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));

      nb_links++;
    }
  }

  finput.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x280(%rbp)
movq %rdi, %rax
movq %rax, -0x278(%rbp)
callq 0x33a0
leaq -0x220(%rbp), %rdi
callq 0x2180
jmp 0x241e
movq -0x10(%rbp), %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x20d0
jmp 0x2435
movl $0x0, -0x230(%rbp)
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x2250
movb %al, -0x281(%rbp)
jmp 0x245f
movb -0x281(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2470
jmp 0x2735
movsd 0x5b90(%rip), %xmm0     # 0x8008
movsd %xmm0, -0x240(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2513
leaq -0x220(%rbp), %rdi
leaq -0x234(%rbp), %rsi
callq 0x2040
movq %rax, -0x290(%rbp)
jmp 0x24a6
movq -0x290(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x2040
movq %rax, -0x298(%rbp)
jmp 0x24c2
movq -0x298(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2110
jmp 0x24d7
jmp 0x2546
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x2758
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x2070
jmp 0x2758
leaq -0x220(%rbp), %rdi
leaq -0x234(%rbp), %rsi
callq 0x2040
movq %rax, -0x2a0(%rbp)
jmp 0x252f
movq -0x2a0(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x2040
jmp 0x2544
jmp 0x2546
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x21a0
movb %al, -0x2a1(%rbp)
jmp 0x2566
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x2575
jmp 0x2730
movq -0x278(%rbp), %rdi
callq 0x33c0
movq %rax, -0x2b8(%rbp)
leaq -0x234(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x33f0
movq %rax, -0x2b0(%rbp)
jmp 0x25a4
movq -0x2b8(%rbp), %rax
movq -0x2b0(%rbp), %rcx
movl (%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
ja 0x2605
movq -0x278(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x234(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x33f0
movq %rax, -0x2c0(%rbp)
jmp 0x25e8
movq -0x2c8(%rbp), %rdi
movq -0x2c0(%rbp), %rax
movl (%rax), %eax
incl %eax
movl %eax, %esi
callq 0x3430
jmp 0x2603
jmp 0x2605
movq -0x278(%rbp), %rdi
movl -0x234(%rbp), %eax
movl %eax, %esi
callq 0x34c0
movq %rax, -0x2e0(%rbp)
leaq -0x238(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3510
movsd %xmm0, -0x2d8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0x2643
movsd -0x2d8(%rbp), %xmm0
movl -0x2cc(%rbp), %eax
movl %eax, -0x258(%rbp)
movsd %xmm0, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3540
jmp 0x2674
movq -0x2e0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x34e0
jmp 0x2689
movl -0x234(%rbp), %eax
cmpl -0x238(%rbp), %eax
je 0x2721
movq -0x278(%rbp), %rdi
movl -0x238(%rbp), %eax
movl %eax, %esi
callq 0x34c0
movq %rax, -0x2f8(%rbp)
leaq -0x234(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3510
movsd %xmm0, -0x2f0(%rbp)
movl %eax, -0x2e4(%rbp)
jmp 0x26d9
movsd -0x2f0(%rbp), %xmm0
movl -0x2e4(%rbp), %eax
movl %eax, -0x270(%rbp)
movsd %xmm0, -0x268(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x3540
jmp 0x270a
movq -0x2f8(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x34e0
jmp 0x271f
jmp 0x2721
movl -0x230(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0x243f
leaq -0x220(%rbp), %rdi
callq 0x2060
jmp 0x2743
leaq -0x220(%rbp), %rdi
callq 0x2070
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x280(%rbp), %rdi
callq 0x3570
movq -0x228(%rbp), %rdi
callq 0x2240