// File: /workspace/github_cpp_makefile_star2_O3/siolag161[P]louvain-original/community.cpp
// Function: Community::partition2graph_binary()
Graph
Community::partition2graph_binary() {
  // Renumber communities
  vector<int> renumber(size, -1);
  for (int node=0 ; node<size ; node++) {
    renumber[n2c[node]]++;
  }

  int final=0;
  for (int i=0 ; i<size ; i++)
    if (renumber[i]!=-1)
      renumber[i]=final++;

  // Compute communities
  vector<vector<int> > comm_nodes(final);
  for (int node=0 ; node<size ; node++) {
    comm_nodes[renumber[n2c[node]]].push_back(node);
  }

  // Compute weighted graph
  Graph g2;
  g2.nb_nodes = comm_nodes.size();
  g2.degrees.resize(comm_nodes.size());

  int comm_deg = comm_nodes.size();
  for (int comm=0 ; comm<comm_deg ; comm++) {
    map<int,float> m;
    map<int,float>::iterator it;

    int comm_size = comm_nodes[comm].size();
    for (int node=0 ; node<comm_size ; node++) {
      pair<vector<unsigned int>::iterator, vector<float>::iterator> p = g.neighbors(comm_nodes[comm][node]);
      int deg = g.nb_neighbors(comm_nodes[comm][node]);
      for (int i=0 ; i<deg ; i++) {
	int neigh        = *(p.first+i);
	int neigh_comm   = renumber[n2c[neigh]];
	double neigh_weight = (g.weights.size()==0)?1.:*(p.second+i);

	it = m.find(neigh_comm);
	if (it==m.end())
	  m.insert(make_pair(neigh_comm, neigh_weight));
	else
	  it->second+=neigh_weight;
      }
    }
    g2.degrees[comm]=(comm==0)?m.size():g2.degrees[comm-1]+m.size();
    g2.nb_links+=m.size();

    
    for (it = m.begin() ; it!=m.end() ; it++) {
      g2.total_weight  += it->second;
      g2.links.push_back(it->first);
      g2.weights.push_back(it->second);
    }
  }

  return g2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %r13
movslq 0x98(%rsi), %rsi
leaq 0x20(%rsp), %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
leaq 0x78(%rsp), %rdi
leaq 0x50(%rsp), %rcx
callq 0x506e
cmpl $0x0, 0x98(%r14)
jle 0x4459
movq 0xa0(%r14), %rcx
movq 0x78(%rsp), %rdx
xorl %esi, %esi
movslq (%rcx,%rsi,4), %rax
incl (%rdx,%rax,4)
incq %rsi
movslq 0x98(%r14), %rax
cmpq %rax, %rsi
jl 0x4414
xorl %esi, %esi
testl %eax, %eax
jle 0x445b
movq 0x78(%rsp), %rcx
xorl %edx, %edx
cmpl $-0x1, (%rcx,%rdx,4)
je 0x4449
movl %esi, (%rcx,%rdx,4)
incl %esi
movl 0x98(%r14), %eax
incq %rdx
movslq %eax, %rdi
cmpq %rdi, %rdx
jl 0x4437
movslq %esi, %rsi
jmp 0x445b
xorl %esi, %esi
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x51ea
movl $0x0, 0x20(%rsp)
cmpl $0x0, 0x98(%r14)
jle 0x44d8
xorl %eax, %eax
leaq 0x20(%rsp), %r15
movslq %eax, %rcx
movq 0xa0(%r14), %rdx
movslq (%rdx,%rcx,4), %rcx
movq 0x78(%rsp), %rdx
movslq (%rdx,%rcx,4), %rcx
movq 0x50(%rsp), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x44bd
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x44c5
movq %r15, %rdx
callq 0x5d86
movl 0x20(%rsp), %eax
incl %eax
movl %eax, 0x20(%rsp)
cmpl 0x98(%r14), %eax
jl 0x4483
movq %r13, %rdi
callq 0x259c
movq 0x58(%rsp), %rsi
subq 0x50(%rsp), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rbx, %rsi
movl %esi, (%r13)
leaq 0x18(%r13), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2f48
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x3, %rax
imulq %rbx, %rax
movq %rax, 0x10(%rsp)
testl %eax, %eax
jle 0x480b
leaq 0x30(%r13), %rax
movq %rax, 0xa8(%rsp)
leaq 0x48(%r13), %rax
movq %rax, 0xa0(%rsp)
movq 0x10(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x10(%rsp)
xorl %edx, %edx
movq %r13, 0x70(%rsp)
movl $0x0, 0x28(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq 0x50(%rsp), %rax
movq %rdx, 0x68(%rsp)
leaq (%rdx,%rdx,2), %rcx
movq 0x8(%rax,%rcx,8), %rdx
movq %rcx, 0xb0(%rsp)
subq (%rax,%rcx,8), %rdx
shrq $0x2, %rdx
movq %rdx, 0x18(%rsp)
testl %edx, %edx
jle 0x4718
movq 0x18(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
movq 0x50(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax,%r12,4), %eax
cmpl %eax, 0x38(%r14)
jbe 0x4844
movq 0x80(%r14), %rbx
testq %rax, %rax
je 0x461f
movq 0x50(%r14), %rcx
leal -0x1(%rax), %edx
movq (%rcx,%rdx,8), %rdx
leaq (,%rdx,4), %rbp
addq 0x68(%r14), %rbp
cmpq %rbx, 0x88(%r14)
movl $0x0, %esi
cmovneq %rdx, %rsi
leaq (%rbx,%rsi,4), %rbx
movq (%rcx,%rax,8), %r15
subq %rdx, %r15
jmp 0x462a
movq 0x50(%r14), %rax
movq 0x68(%r14), %rbp
movq (%rax), %r15
testl %r15d, %r15d
jle 0x4705
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq 0x88(%r14), %rax
movsd 0x3ae4(%rip), %xmm0     # 0x8130
cmpq 0x80(%r14), %rax
je 0x465e
xorps %xmm0, %xmm0
cvtss2sd (%rbx,%r13,4), %xmm0
movslq (%rbp,%r13,4), %rax
movq 0xa0(%r14), %rcx
movslq (%rcx,%rax,4), %rax
movq 0x78(%rsp), %rcx
movl (%rcx,%rax,4), %eax
movq 0x30(%rsp), %r8
testq %r8, %r8
je 0x46be
leaq 0x28(%rsp), %rcx
movq %rcx, %rdx
movq %r8, %rsi
movl 0x20(%r8), %edi
xorl %r8d, %r8d
cmpl %eax, %edi
setl %r8b
movq %rsi, %rcx
cmovlq %rdx, %rcx
movq 0x10(%rsi,%r8,8), %r8
testq %r8, %r8
jne 0x4685
leaq 0x28(%rsp), %r8
cmpq %r8, %rcx
je 0x46be
cmpl %eax, %edi
cmovlq %rdx, %rsi
cmpl 0x20(%rsi), %eax
jge 0x46ee
movl %eax, 0x90(%rsp)
movsd %xmm0, 0x98(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x5e62
incq %r13
cmpq %r15, %r13
jne 0x463d
jmp 0x4705
xorps %xmm1, %xmm1
cvtss2sd 0x24(%rcx), %xmm1
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x24(%rcx)
jmp 0x46e0
incq %r12
cmpq 0x18(%rsp), %r12
movq 0x70(%rsp), %r13
jne 0x45c0
movq 0x68(%rsp), %rdx
testq %rdx, %rdx
je 0x4736
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rsp), %rcx
addq -0x8(%rax,%rdx,8), %rcx
jmp 0x4743
movq 0x48(%rsp), %rcx
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rcx, (%rax,%rdx,8)
movq 0x48(%rsp), %rax
addq %rax, 0x8(%r13)
movq 0x38(%rsp), %r12
leaq 0x28(%rsp), %rax
cmpq %rax, %r12
je 0x47ee
xorps %xmm0, %xmm0
cvtss2sd 0x24(%r12), %xmm0
addsd 0x10(%r13), %xmm0
movsd %xmm0, 0x10(%r13)
movl 0x20(%r12), %eax
movl %eax, 0x90(%rsp)
movq 0x38(%r13), %rsi
cmpq 0x40(%r13), %rsi
je 0x479b
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%r13)
jmp 0x47b0
movq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x5faa
leaq 0x24(%r12), %rdx
movq 0x50(%r13), %rsi
cmpq 0x58(%r13), %rsi
je 0x47d1
movss (%rdx), %xmm0
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x50(%r13)
jmp 0x47de
movq 0xa0(%rsp), %rdi
callq 0x6086
movq %r12, %rdi
callq 0x2160
movq %rax, %r12
jmp 0x4755
leaq 0x20(%rsp), %rdi
callq 0x5600
movq 0x68(%rsp), %rdx
incq %rdx
cmpq 0x10(%rsp), %rdx
jne 0x455b
leaq 0x50(%rsp), %rdi
callq 0x5268
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x482f
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %r13, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3812(%rip), %rdi      # 0x805d
leaq 0x3824(%rip), %rsi      # 0x8076
leaq 0x382e(%rip), %rcx      # 0x8087
movl $0x7b, %edx
callq 0x2130
movq %rax, %r14
jmp 0x488d
jmp 0x486f
movq %rax, %r14
jmp 0x48da
movq %rax, %r14
jmp 0x48d0
jmp 0x4876
movq %rax, %r14
jmp 0x4883
movq %rax, %r14
movq 0x70(%rsp), %r13
leaq 0x20(%rsp), %rdi
callq 0x5600
movq 0x48(%r13), %rdi
testq %rdi, %rdi
je 0x48a2
movq 0x58(%r13), %rsi
subq %rdi, %rsi
callq 0x2200
movq 0x30(%r13), %rdi
testq %rdi, %rdi
je 0x48b7
movq 0x40(%r13), %rsi
subq %rdi, %rsi
callq 0x2200
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x48d0
movq 0x28(%r13), %rsi
subq %rdi, %rsi
callq 0x2200
leaq 0x50(%rsp), %rdi
callq 0x5268
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x48f4
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %r14, %rdi
callq 0x2340