// File: riyadparvez[P]louvain-method/community.cpp
// Function: Community::init_partition(char*)
void
Community::init_partition(char * filename) {
  ifstream finput;
  finput.open(filename,fstream::in);

  // read partition
  while (!finput.eof()) {
    unsigned int node, comm;
    finput >> node >> comm;
    
    if (finput) {
      int old_comm = n2c[node];
      neigh_comm(node);

      remove(node, old_comm, neigh_weight[old_comm]);

      unsigned int i=0;
      for ( i=0 ; i<neigh_last ; i++) {
	unsigned int best_comm     = neigh_pos[i];
	float best_nblinks  = neigh_weight[neigh_pos[i]];
	if (best_comm==comm) {
	  insert(node, best_comm, best_nblinks);
	  break;
	}
      }
      if (i==neigh_last)
	insert(node, comm, 0);
    }
  }
  finput.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x218(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x21e0
movq -0x248(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x8, %edx
callq 0x2100
jmp 0x83b8
jmp 0x83ba
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x2320
movb %al, -0x251(%rbp)
jmp 0x83da
movb -0x251(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x83eb
jmp 0x85ed
leaq -0x218(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x2040
movq %rax, -0x260(%rbp)
jmp 0x8407
movq -0x260(%rbp), %rdi
leaq -0x22c(%rbp), %rsi
callq 0x2040
jmp 0x841c
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x2220
movb %al, -0x261(%rbp)
jmp 0x843c
movb -0x261(%rbp), %al
testb $0x1, %al
jne 0x844b
jmp 0x85e8
movq -0x250(%rbp), %rdi
addq $0xb8, %rdi
movl -0x228(%rbp), %eax
movl %eax, %esi
callq 0x3ab0
movq -0x250(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x230(%rbp)
movl -0x228(%rbp), %esi
callq 0x8620
jmp 0x8482
movq -0x250(%rbp), %rdi
movl -0x228(%rbp), %eax
movl %eax, -0x26c(%rbp)
movl -0x230(%rbp), %eax
movl %eax, -0x268(%rbp)
movslq %eax, %rsi
callq 0xa150
movq -0x250(%rbp), %rdi
movl -0x26c(%rbp), %esi
movl -0x268(%rbp), %edx
movsd (%rax), %xmm0
callq 0xa390
jmp 0x84c7
movl $0x0, -0x234(%rbp)
movl $0x0, -0x234(%rbp)
movq -0x250(%rbp), %rcx
movl -0x234(%rbp), %eax
cmpl 0x30(%rcx), %eax
jae 0x85b5
movq -0x250(%rbp), %rdi
addq $0x18, %rdi
movl -0x234(%rbp), %eax
movl %eax, %esi
callq 0x34b0
movq -0x250(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x238(%rbp)
addq $0x18, %rdi
movl -0x234(%rbp), %eax
movl %eax, %esi
callq 0x34b0
movq -0x250(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0xa150
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x23c(%rbp)
movl -0x238(%rbp), %eax
cmpl -0x22c(%rbp), %eax
jne 0x859f
movq -0x250(%rbp), %rdi
movl -0x228(%rbp), %esi
movl -0x238(%rbp), %edx
movss -0x23c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0xa4b0
jmp 0x857d
jmp 0x85b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2080
jmp 0x8610
jmp 0x85a1
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x84db
movq -0x250(%rbp), %rcx
movl -0x234(%rbp), %eax
cmpl 0x30(%rcx), %eax
jne 0x85e6
movq -0x250(%rbp), %rdi
movl -0x228(%rbp), %esi
movl -0x22c(%rbp), %edx
xorps %xmm0, %xmm0
callq 0xa4b0
jmp 0x85e4
jmp 0x85e6
jmp 0x85e8
jmp 0x83ba
leaq -0x218(%rbp), %rdi
callq 0x2060
jmp 0x85fb
leaq -0x218(%rbp), %rdi
callq 0x2080
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
movq -0x220(%rbp), %rdi
callq 0x2300
nopl (%rax)