// File: /workspace/github_cpp_makefile_star2_O2/siolag161[P]louvain-original/graph_binary.cpp
// Function: Graph::Graph(char*, char*, int)
Graph::Graph(char *filename, char *filename_w, int type) {
  ifstream finput;
  finput.open(filename,fstream::in | fstream::binary);

  // Read number of nodes on 4 bytes
  finput.read((char *)&nb_nodes, 4);
  assert(finput.rdstate() == ios::goodbit);

  // Read cumulative degree sequence: 8 bytes for each node
  // cum_degree[0]=degree(0); cum_degree[1]=degree(0)+degree(1), etc.
  degrees.resize(nb_nodes);
  finput.read((char *)&degrees[0], nb_nodes*8);

  // Read links: 4 bytes for each link (each link is counted twice)
  nb_links=degrees[nb_nodes-1];
  links.resize(nb_links);
  finput.read((char *)(&links[0]), (long)nb_links*8);  

  // IF WEIGHTED : read weights: 4 bytes for each link (each link is counted twice)
  weights.resize(0);
  total_weight=0;
  if (type==WEIGHTED) {
    ifstream finput_w;
    finput_w.open(filename_w,fstream::in | fstream::binary);
    weights.resize(nb_links);
    finput_w.read((char *)&weights[0], (long)nb_links*4);  
  }    

  // Compute total weight
  for (unsigned int i=0 ; i<nb_nodes ; i++) {
    total_weight += (double)weighted_degree(i);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x18(%rdi), %rax
movq %rax, (%rsp)
leaq 0x30(%rdi), %r14
leaq 0x48(%rdi), %r15
xorpd %xmm0, %xmm0
movupd %xmm0, 0x48(%rdi)
movupd %xmm0, 0x38(%rdi)
movupd %xmm0, 0x28(%rdi)
movupd %xmm0, 0x18(%rdi)
andq $0x0, 0x58(%rdi)
leaq 0x8(%rsp), %rdi
callq 0x21c0
leaq 0x8(%rsp), %rdi
pushq $0xc
popq %rdx
movq %rbx, %rsi
callq 0x20e0
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rdx
movq %r12, %rsi
callq 0x21f0
movq 0x8(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x28(%rsp,%rax)
jne 0x25f3
movl (%r12), %esi
movq (%rsp), %rdi
callq 0x2a48
movq 0x18(%r12), %rsi
movl (%r12), %edx
shll $0x3, %edx
leaq 0x8(%rsp), %rdi
callq 0x21f0
movl (%r12), %eax
decl %eax
movq 0x18(%r12), %rcx
movq (%rcx,%rax,8), %rsi
movq %rsi, 0x8(%r12)
movq %r14, %rdi
callq 0x2a7a
movq 0x8(%r12), %rdx
movq 0x30(%r12), %rsi
shlq $0x3, %rdx
leaq 0x8(%rsp), %rdi
callq 0x21f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2aac
andq $0x0, 0x10(%r12)
testl %ebp, %ebp
jne 0x25b3
leaq 0x210(%rsp), %rdi
callq 0x21c0
leaq 0x210(%rsp), %rdi
pushq $0xc
popq %rdx
movq %r13, %rsi
callq 0x20e0
movq 0x8(%r12), %rsi
movq %r15, %rdi
callq 0x2aac
movq 0x8(%r12), %rdx
movq 0x48(%r12), %rsi
shlq $0x2, %rdx
leaq 0x210(%rsp), %rdi
callq 0x21f0
leaq 0x210(%rsp), %rdi
callq 0x2060
xorl %ebp, %ebp
cmpl (%r12), %ebp
jae 0x25d7
movq %r12, %rdi
movl %ebp, %esi
callq 0x2ade
addsd 0x10(%r12), %xmm0
movsd %xmm0, 0x10(%r12)
incl %ebp
jmp 0x25b5
leaq 0x8(%rsp), %rdi
callq 0x2060
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a0a(%rip), %rdi      # 0x6004
leaq 0x3a24(%rip), %rsi      # 0x6025
leaq 0x3a2e(%rip), %rcx      # 0x6036
pushq $0x22
popq %rdx
callq 0x20f0
jmp 0x262b
movq %rax, %r12
jmp 0x2638
movq %rax, %r12
leaq 0x210(%rsp), %rdi
callq 0x2060
jmp 0x262e
jmp 0x262b
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0x2060
movq %r15, %rdi
callq 0x2c86
movq %r14, %rdi
callq 0x2c52
movq (%rsp), %rdi
callq 0x2c1e
movq %r12, %rdi
callq 0x22c0
nop