// File: riyadparvez[P]louvain-method/graph.cpp
// Function: Graph::clean(int)
void
Graph::clean(int type) {
  for (unsigned int i=0 ; i<links.size() ; i++) {
    map<int, float> m;
    map<int, float>::iterator it;

    for (unsigned int j=0 ; j<links[i].size() ; j++) {
      it = m.find(links[i][j].first);
      if (it==m.end())
	m.insert(make_pair(links[i][j].first, links[i][j].second));
      else if (type==WEIGHTED)
      	it->second+=links[i][j].second;
    }
    
    vector<pair<int,float> > v;
    for (it = m.begin() ; it!=m.end() ; it++)
      v.push_back(*it);
    links[i].clear();
    links[i]=v;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x0, -0x10(%rbp)
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movq %rax, -0xd0(%rbp)
callq 0x36b0
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jae 0x3108
leaq -0x40(%rbp), %rdi
callq 0x4150
leaq -0x48(%rbp), %rdi
callq 0x4170
movl $0x0, -0x4c(%rbp)
movq -0xc8(%rbp), %rdi
movl -0x4c(%rbp), %eax
movq %rax, -0xd8(%rbp)
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
callq 0x3c10
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jae 0x2ff3
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x3c50
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x4190
movq %rax, -0xe0(%rbp)
jmp 0x2eaf
movq -0xe0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x41f0
movq %rax, -0x70(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x41c0
testb $0x1, %al
jne 0x2ee5
jmp 0x2f95
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x3c50
movq -0xc8(%rbp), %rdi
movq %rax, -0xf0(%rbp)
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x3c50
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
addq $0x4, %rsi
callq 0x4260
movq %rax, -0xe8(%rbp)
jmp 0x2f44
movq -0xe8(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4220
movb %dl, -0xf9(%rbp)
movq %rax, -0xf8(%rbp)
jmp 0x2f6b
movb -0xf9(%rbp), %al
movq -0xf8(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movb %al, -0x80(%rbp)
jmp 0x2fe3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x30fd
cmpl $0x0, -0xc(%rbp)
jne 0x2fe1
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x3c50
movss 0x4(%rax), %xmm0
movss %xmm0, -0x100(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4290
movss -0x100(%rbp), %xmm0
addss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%rax)
jmp 0x2fe3
jmp 0x2fe5
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2e46
leaq -0xa0(%rbp), %rdi
callq 0x42b0
leaq -0x40(%rbp), %rdi
callq 0x42d0
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x41f0
movq %rax, -0xb0(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4300
testb $0x1, %al
jne 0x3040
jmp 0x309f
leaq -0x48(%rbp), %rdi
callq 0x4330
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x4350
jmp 0x305a
leaq -0xa0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x37d0
jmp 0x306f
jmp 0x3071
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x4380
movq %rax, -0xc0(%rbp)
jmp 0x301a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x43e0
jmp 0x30fd
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
callq 0x43c0
movq -0xc8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x37b0
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3e50
jmp 0x30da
leaq -0xa0(%rbp), %rdi
callq 0x43e0
leaq -0x40(%rbp), %rdi
callq 0x4440
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2e04
leaq -0x40(%rbp), %rdi
callq 0x4440
jmp 0x3111
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2260
nopw (%rax,%rax)