// File: riyadparvez[P]louvain-method/community.cpp
// Function: Community::neigh_comm(unsigned int)
void
Community::neigh_comm(unsigned int node) {
  for (unsigned int i=0 ; i<neigh_last ; i++)
    neigh_weight[neigh_pos[i]]=-1;
  neigh_last=0;

  pair<vector<unsigned int>::iterator, vector<float>::iterator> p = g.neighbors(node);

  unsigned int deg = g.nb_neighbors(node);

  neigh_pos[0]=n2c[node];
  neigh_weight[neigh_pos[0]]=0;
  neigh_last=1;

  for (unsigned int i=0 ; i<deg ; i++) {
    unsigned int neigh        = *(p.first+i);
    unsigned int neigh_comm   = n2c[neigh];
    double neigh_w = (g.weights.size()==0)?1.:*(p.second+i);
    
    if (neigh!=node) {
      if (neigh_weight[neigh_comm]==-1) {
	    neigh_weight[neigh_comm]=0.;
	    neigh_pos[neigh_last++]=neigh_comm;
      }
      neigh_weight[neigh_comm]+=neigh_w;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x58(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x30(%rcx), %eax
jae 0x8683
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x34b0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0xa150
movsd 0xcb1c(%rip), %xmm0     # 0x15190
movsd %xmm0, (%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x8641
movq -0x58(%rbp), %rdi
movl $0x0, 0x30(%rdi)
addq $0x38, %rdi
movl -0xc(%rbp), %esi
callq 0x3ad0
movq -0x58(%rbp), %rdi
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
addq $0x38, %rdi
movl -0xc(%rbp), %esi
callq 0x3c80
movq -0x58(%rbp), %rdi
movl %eax, -0x24(%rbp)
addq $0xb8, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x3ab0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x34b0
movl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %rdi
movl %ecx, (%rax)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x34b0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0xa150
movq %rax, %rcx
movq -0x58(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rcx)
movl $0x1, 0x30(%rax)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x8863
leaq -0x20(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0x3d40
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3d80
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
addq $0xb8, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3ab0
movq -0x58(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
addq $0x38, %rdi
addq $0x60, %rdi
callq 0x3da0
cmpq $0x0, %rax
jne 0x878b
movsd 0xca04(%rip), %xmm0     # 0x15188
movsd %xmm0, -0x68(%rbp)
jmp 0x87b7
leaq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
callq 0x3dc0
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3e00
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
je 0x8853
movq -0x58(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, %esi
callq 0xa150
movsd (%rax), %xmm0
movsd 0xc9a9(%rip), %xmm1     # 0x15190
ucomisd %xmm1, %xmm0
jne 0x882e
jp 0x882e
movq -0x58(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, %esi
callq 0xa150
movq -0x58(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq %rcx, %rdi
addq $0x18, %rdi
movl 0x30(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x30(%rcx)
movl %eax, %eax
movl %eax, %esi
callq 0x34b0
movl -0x6c(%rbp), %ecx
movl %ecx, (%rax)
movq -0x58(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, %esi
callq 0xa150
movsd -0x78(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x8855
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x871f
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)