// File: /workspace/github_cpp_makefile_star2_O3/Kingsford-Group[P]ghost2/src/laplacian.hpp
// Function: AdjacencyMatrix::extend(Graph*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void AdjacencyMatrix::extend(Graph *input, string source)
{
  if(nodes.empty())
  {
    nodes.insert(source);
    prev.push_back(source);
    neighborhoods[source] = (*input).neighbors2(source);
    dmap[source] = 0;
  }

  vector<string> next;
  for(int i=0;i<prev.size();i++)
  {
    vlist::iterator vit = (*(neighborhoods[prev[i]])).begin(), 
                    vend = (*(neighborhoods[prev[i]])).end();
    for(; vit != vend; vit++)
      if(nodes.find(*vit) == nodes.end())
      {
        nodes.insert(*vit);
        next.push_back(*vit);
        neighborhoods[*vit] = (*input).neighbors2(*vit);
        dmap[*vit] = 0;
        vlist *neighbors = (*input).neighbors2(*vit);
        vlist::iterator it = (*neighbors).begin(), iend = (*neighbors).end();
        for(; it != iend; it++)
          if(nodes.find(*it) != nodes.end())
          {
            dmap[*vit] += 1;
            dmap[*it] += 1;
            nedge++;
          }
      }
  }
  prev = next;

  nvert = nodes.size();
  m.resize(nvert,nvert);

  if(prev.size() != 0)
  {
    vlist::iterator it1 = nodes.begin(), iend = nodes.end();
    int c1=0, c2=0;
    for(; it1 != iend; it1++)
    {
      vlist::iterator it2 = nodes.begin();
      for(; it2 != iend; it2++)
      {
        if(c1 == c2)
          m(c1,c2) = 1;
        else
        {
          if((*(neighborhoods[*it1])).find(*it2) != 
             (*(neighborhoods[*it1])).end())
            m(c1,c2) = -1. / sqrt(dmap[*it1] * dmap[*it2]);
          else
            m(c1,c2) = 0;
        }
        c2++;
      } 
      c1++; 
      c2=0;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
cmpq $0x0, 0x28(%rdi)
movq %rdi, 0x8(%rsp)
jne 0x102f5
movq %rdx, %r15
movq %r14, %rdi
movq %rdx, %rsi
callq 0x27972
leaq 0xa8(%rbx), %rdi
movq %r15, %rsi
callq 0x1c08e
movq %rbx, %r13
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x27846
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x20002
movq %rax, %rbx
leaq 0x78(%r13), %rdi
movq %r15, %rsi
callq 0x2d11e
addq $0x30, %rbx
movq %rbx, 0x30(%rax)
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x102dd
movq 0x98(%rsp), %rsi
incq %rsi
callq 0xc550
movq 0x8(%rsp), %rbx
leaq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x2d868
movl $0x0, 0x30(%rax)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0xa8(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0xa8(%rbx), %rsi
cmpq %rsi, 0xb0(%rbx)
je 0x10536
leaq 0x78(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x19(%rbx), %rax
movq %rax, (%rsp)
leaq 0x48(%rbx), %rbp
xorl %ecx, %ecx
movq %rcx, 0x28(%rsp)
movq %rcx, %rbx
shlq $0x5, %rbx
addq %rbx, %rsi
movq 0x10(%rsp), %rdi
callq 0x2d11e
movq 0x30(%rax), %rdi
callq 0x20d60
movq %rax, %r12
movq 0x20(%rsp), %rax
addq (%rax), %rbx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x2d11e
testq %r12, %r12
je 0x1050b
leaq 0x10(%r12), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x20d9c
movzbl (%r14), %ecx
andl $0x1, %ecx
addq (%rsp), %rcx
movq %r14, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x27b80
testq %rax, %rax
je 0x103b9
movq (%r12), %r12
jmp 0x1037c
movq %r14, %rdi
movq %r13, %rsi
movq %r13, %rdx
callq 0x27972
leaq 0x50(%rsp), %r15
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x1c08e
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x27846
movq 0x18(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x20002
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x2d11e
addq $0x30, %rbx
movq %rbx, 0x30(%rax)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1043d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xc550
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2d868
movl $0x0, 0x30(%rax)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x27846
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x20002
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1049a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xc550
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x20d60
movq %rax, %r15
testq %r15, %r15
je 0x103b3
leaq 0x10(%r15), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20d9c
movzbl (%r14), %ecx
andl $0x1, %ecx
addq (%rsp), %rcx
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x27b80
testq %rax, %rax
je 0x10506
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2d868
incl 0x30(%rax)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2d868
incl 0x30(%rax)
movq 0x8(%rsp), %rax
incl 0xc4(%rax)
movq (%r15), %r15
jmp 0x104a9
movq 0x28(%rsp), %rcx
incq %rcx
movq 0x8(%rsp), %rbx
movq 0xa8(%rbx), %rsi
movq 0xb0(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rcx, %rax
ja 0x10342
leaq 0x70(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x1c684
movq 0x28(%rbx), %rax
movl %eax, 0xc0(%rbx)
movslq %eax, %rcx
testq %rcx, %rcx
js 0x10779
movq %rcx, %rsi
imulq %rcx, %rsi
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x2e0b6
movq 0xb0(%rbx), %rax
cmpq 0xa8(%rbx), %rax
je 0x1073e
movq %r14, %rdi
callq 0x20d60
testq %rax, %rax
je 0x1073e
movq 0x8(%rsp), %rcx
leaq 0x78(%rcx), %rdx
movq %rdx, 0x18(%rsp)
addq $0x48, %rcx
movq %rcx, 0x28(%rsp)
xorl %ecx, %ecx
movq %rcx, (%rsp)
movq %rax, 0x20(%rsp)
movq %r14, %rdi
callq 0x20d60
movq %rax, %rbp
testq %rax, %rax
je 0x10726
movq 0x20(%rsp), %rax
leaq 0x10(%rax), %r12
xorl %r15d, %r15d
movq %r12, 0x10(%rsp)
movq (%rsp), %rdx
cmpq %r15, %rdx
jne 0x1061c
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq %rdx, %rax
jle 0x1075a
cmpq %rdx, 0x10(%rcx)
jle 0x1075a
imulq %rdx, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax,%rdx,8)
jmp 0x10716
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x2d11e
movq 0x30(%rax), %rbx
leaq 0x10(%rbp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x20d9c
movzbl (%rbx), %ecx
andl $0x1, %ecx
addq %rbx, %rcx
incq %rcx
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x27b80
movq %rax, %rbx
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x2d11e
testq %rbx, %rbx
je 0x106a1
movq %r12, %rsi
movq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x2d868
movl 0x30(%rax), %ebx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2d868
imull 0x30(%rax), %ebx
cvtsi2sd %ebx, %xmm0
ucomisd 0x379cf(%rip), %xmm0    # 0x48068
jb 0x106d7
sqrtsd %xmm0, %xmm0
jmp 0x106dc
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rsp), %rax
jle 0x1075a
cmpq %r15, 0x10(%rcx)
jle 0x1075a
imulq %r15, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movq (%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x10716
callq 0xc3f0
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rsp), %rax
jle 0x1075a
cmpq %r15, 0x10(%rcx)
jle 0x1075a
imulq %r15, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movsd 0x3796f(%rip), %xmm1    # 0x48078
divsd %xmm0, %xmm1
movq (%rsp), %rcx
movsd %xmm1, (%rax,%rcx,8)
incq %r15
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x105d9
movq (%rsp), %rcx
incq %rcx
movq 0x20(%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
jne 0x105ab
leaq 0x70(%rsp), %rdi
callq 0x1c0cc
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c2f6(%rip), %rdi     # 0x4ca57
leaq 0x3c324(%rip), %rsi     # 0x4ca8c
leaq 0x3c346(%rip), %rcx     # 0x4cab5
movl $0x151, %edx            # imm = 0x151
callq 0xc340
leaq 0x3b94b(%rip), %rdi     # 0x4c0cb
leaq 0x3b91b(%rip), %rsi     # 0x4c0a2
leaq 0x415d8(%rip), %rcx     # 0x51d66
movl $0xf1, %edx
callq 0xc340
jmp 0x107c8
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x10823
movq 0x98(%rsp), %rsi
incq %rsi
callq 0xc550
jmp 0x10823
jmp 0x10816
jmp 0x107c8
jmp 0x10816
jmp 0x10816
jmp 0x107c8
jmp 0x10816
movq %rax, %rdi
callq 0x1c340
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x10819
movq 0x60(%rsp), %rsi
jmp 0x10804
jmp 0x10816
jmp 0x10816
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10819
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xc550
jmp 0x10819
jmp 0x10816
jmp 0x10816
jmp 0x10816
jmp 0x10816
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1c0cc
movq %rbx, %rdi
callq 0xc9c0
nop