// File: /workspace/github_cpp_makefile_star2_O1/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 0x114a7
movq %rdx, %r15
movq %r14, %rdi
movq %rdx, %rsi
callq 0x28e8a
leaq 0xa8(%rbx), %rdi
movq %r15, %rsi
callq 0x1d38c
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 0x28d6a
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x213e8
movq %rax, %rbx
leaq 0x78(%r13), %rdi
movq %r15, %rsi
callq 0x2e3e8
addq $0x30, %rbx
movq %rbx, 0x30(%rax)
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x1148f
movq 0x98(%rsp), %rsi
incq %rsi
callq 0xd550
movq 0x8(%rsp), %rbx
leaq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x2eb24
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 0x116e8
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 0x2e3e8
movq 0x30(%rax), %rdi
callq 0x2213c
movq %rax, %r12
movq 0x20(%rsp), %rax
addq (%rax), %rbx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x2e3e8
testq %r12, %r12
je 0x116bd
leaq 0x10(%r12), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x22178
movzbl (%r14), %ecx
andl $0x1, %ecx
addq (%rsp), %rcx
movq %r14, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x29098
testq %rax, %rax
je 0x1156b
movq (%r12), %r12
jmp 0x1152e
movq %r14, %rdi
movq %r13, %rsi
movq %r13, %rdx
callq 0x28e8a
leaq 0x50(%rsp), %r15
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x1d38c
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x28d6a
movq 0x18(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x213e8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x2e3e8
addq $0x30, %rbx
movq %rbx, 0x30(%rax)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x115ef
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xd550
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2eb24
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 0x28d6a
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x213e8
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1164c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xd550
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x2213c
movq %rax, %r15
testq %r15, %r15
je 0x11565
leaq 0x10(%r15), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22178
movzbl (%r14), %ecx
andl $0x1, %ecx
addq (%rsp), %rcx
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x29098
testq %rax, %rax
je 0x116b8
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2eb24
incl 0x30(%rax)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2eb24
incl 0x30(%rax)
movq 0x8(%rsp), %rax
incl 0xc4(%rax)
movq (%r15), %r15
jmp 0x1165b
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 0x114f4
leaq 0x70(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x1d990
movq 0x28(%rbx), %rax
movl %eax, 0xc0(%rbx)
movslq %eax, %rcx
testq %rcx, %rcx
js 0x1194d
shlq $0x20, %rax
je 0x1172b
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
divq %rcx
cmpq %rcx, %rax
jl 0x1196c
movq %rcx, %rsi
imulq %rcx, %rsi
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x2f364
movq 0xb0(%rbx), %rax
cmpq 0xa8(%rbx), %rax
je 0x11912
movq %r14, %rdi
callq 0x2213c
testq %rax, %rax
je 0x11912
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 0x2213c
movq %rax, %rbp
testq %rax, %rax
je 0x118fa
movq 0x20(%rsp), %rax
leaq 0x10(%rax), %r12
xorl %r15d, %r15d
movq %r12, 0x10(%rsp)
movq (%rsp), %rdx
cmpq %r15, %rdx
jne 0x117f0
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq %rdx, %rax
jle 0x1192e
cmpq %r15, 0x10(%rcx)
jle 0x1192e
imulq %r15, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movq (%rsp), %rcx
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, (%rax,%rcx,8)
jmp 0x118ea
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x2e3e8
movq 0x30(%rax), %rbx
leaq 0x10(%rbp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x22178
movzbl (%rbx), %ecx
andl $0x1, %ecx
addq %rbx, %rcx
incq %rcx
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x29098
movq %rax, %rbx
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x2e3e8
testq %rbx, %rbx
je 0x11875
movq %r12, %rsi
movq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x2eb24
movl 0x30(%rax), %ebx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2eb24
imull 0x30(%rax), %ebx
cvtsi2sd %ebx, %xmm0
ucomisd 0x377fb(%rip), %xmm0    # 0x49068
jb 0x118ab
sqrtsd %xmm0, %xmm0
jmp 0x118b0
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rsp), %rax
jle 0x1192e
cmpq %r15, 0x10(%rcx)
jle 0x1192e
imulq %r15, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movq (%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x118ea
callq 0xd3f0
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rsp), %rax
jle 0x1192e
cmpq %r15, 0x10(%rcx)
jle 0x1192e
imulq %r15, %rax
shlq $0x3, %rax
addq (%rcx), %rax
movsd 0x3779b(%rip), %xmm1    # 0x49078
divsd %xmm0, %xmm1
movq (%rsp), %rcx
movsd %xmm1, (%rax,%rcx,8)
incq %r15
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x117a9
movq (%rsp), %rcx
incq %rcx
movq 0x20(%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
jne 0x1177b
leaq 0x70(%rsp), %rdi
callq 0x1d3ca
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c0f2(%rip), %rdi     # 0x4da27
leaq 0x3c120(%rip), %rsi     # 0x4da5c
leaq 0x3c142(%rip), %rcx     # 0x4da85
movl $0x151, %edx            # imm = 0x151
callq 0xd340
leaq 0x3b747(%rip), %rdi     # 0x4d09b
leaq 0x3b717(%rip), %rsi     # 0x4d072
leaq 0x4171f(%rip), %rcx     # 0x53081
movl $0xf1, %edx
callq 0xd340
movl $0x8, %edi
callq 0xd260
movq 0x675f3(%rip), %rcx     # 0x78f70
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x67615(%rip), %rsi     # 0x78fa0
movq 0x675ae(%rip), %rdx     # 0x78f40
movq %rax, %rdi
callq 0xd990
jmp 0x119ca
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x11a25
movq 0x98(%rsp), %rsi
incq %rsi
callq 0xd550
jmp 0x11a25
jmp 0x11a18
jmp 0x119ca
jmp 0x11a18
jmp 0x11a18
jmp 0x119ca
jmp 0x11a18
movq %rax, %rdi
callq 0x1d63c
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x11a1b
movq 0x60(%rsp), %rsi
jmp 0x11a06
jmp 0x11a18
jmp 0x11a18
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x11a1b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xd550
jmp 0x11a1b
jmp 0x11a18
jmp 0x11a18
jmp 0x11a18
jmp 0x11a18
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1d3ca
movq %rbx, %rdi
callq 0xd9c0
nop