// File: /workspace/github_cpp_makefile_star2_O3/riyadparvez[P]louvain-method/graph.cpp
// Function: Graph::renumber(int)
void
Graph::renumber(int type) {
  vector<int> linked(links.size(),-1);
  map<int, int> renum;
  
  for (unsigned int i=0 ; i<links.size() ; i++) {
    for (unsigned int j=0 ; j<links[i].size() ; j++) {
      linked[i]=1;
      linked[links[i][j].first]=1;
    }
  }
  
  //TODO new rename
  for (unsigned int i=0 ; i<nodes.size() ; i++) {
      renum[nodes[i]]=i;
  }

  for (unsigned int i=0 ; i<links.size() ; i++) {
    if (linked[i]==1) {
      for (unsigned int j=0 ; j<links[i].size() ; j++) {
        links[i][j].first = renum[links[i][j].first];
      }
      links[renum[i]]=links[i];
    }
  }
  
  for (unsigned int i=0 ; i<nodes.size() ; i++) {
    nodes[i] = renum[nodes[i]];
  }
  links.resize(links.size());
  nodes.resize(nodes.size());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rsi
subq (%rdi), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r13, %rsi
leaq 0x28(%rsp), %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rcx
callq 0x3060
leaq 0x30(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq %rsi, %rcx
subq %rax, %rcx
je 0x27c0
sarq $0x3, %rcx
imulq %r13, %rcx
movq 0x10(%rsp), %rdx
xorl %edi, %edi
movl $0x1, %r8d
leaq (%rdi,%rdi,2), %r10
movq (%rax,%r10,8), %r9
movq 0x8(%rax,%r10,8), %r10
subq %r9, %r10
je 0x27b5
sarq $0x3, %r10
xorl %r11d, %r11d
movl %r8d, (%rdx,%rdi,4)
movslq (%r9,%r11,8), %r14
movl %r8d, (%rdx,%r14,4)
incq %r11
movl %r11d, %r14d
cmpq %r14, %r10
ja 0x279e
incq %rdi
movl %edi, %r9d
cmpq %r9, %rcx
ja 0x2785
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
cmpq %rcx, %rdx
je 0x2805
xorl %r15d, %r15d
leaq 0x28(%rsp), %r14
leaq (%rcx,%r15,4), %rsi
movq %r14, %rdi
callq 0x31dc
movl %r15d, (%rax)
incl %r15d
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x2, %rax
cmpq %r15, %rax
ja 0x27d5
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
cmpq %rax, %rsi
je 0x28d8
xorl %ebp, %ebp
leaq 0x28(%rsp), %r14
movq 0x10(%rsp), %rcx
cmpl $0x1, (%rcx,%rbp,4)
jne 0x28b5
leaq (,%rbp,2), %r12
addq %rbp, %r12
movq (%rax,%r12,8), %rcx
cmpq %rcx, 0x8(%rax,%r12,8)
je 0x2883
movl $0x1, %r13d
xorl %r15d, %r15d
leaq (%rcx,%r15,8), %rsi
movq %r14, %rdi
callq 0x31dc
movl (%rax), %edx
movq (%rbx), %rax
movq (%rax,%r12,8), %rcx
movl %edx, (%rcx,%r15,8)
movl %r13d, %r15d
movq 0x8(%rax,%r12,8), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %r15, %rdx
ja 0x2843
leaq (%rax,%r12,8), %r12
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
jmp 0x2887
leaq (%rax,%r12,8), %r12
movl %ebp, 0xc(%rsp)
movq %r14, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3242
movslq (%rax), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
addq (%rbx), %rdi
movq %r12, %rsi
callq 0x32a8
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
incl %ebp
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r13, %rcx
cmpq %rbp, %rcx
ja 0x2815
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
jmp 0x28db
movq %rax, %rsi
cmpq %rcx, %rdx
je 0x291f
movl $0x1, %ebp
xorl %r15d, %r15d
leaq 0x28(%rsp), %r14
leaq (%rcx,%r15,4), %rsi
movq %r14, %rdi
callq 0x31dc
movl (%rax), %eax
movq 0x18(%rbx), %rcx
movl %eax, (%rcx,%r15,4)
movl %ebp, %r15d
movq 0x20(%rbx), %rax
subq %rcx, %rax
sarq $0x2, %rax
incl %ebp
cmpq %r15, %rax
ja 0x28ed
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
imulq %r13, %rsi
movq %rbx, %rdi
callq 0x2fd0
leaq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rsi
subq 0x18(%rbx), %rsi
sarq $0x2, %rsi
callq 0x33d2
leaq 0x28(%rsp), %rdi
callq 0x345e
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2968
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x297f
jmp 0x297f
jmp 0x297f
jmp 0x297f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x345e
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x29a3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x22b0
nop