// File: 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
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdx, -0x170(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x168(%rbp)
addq $0x18, %rdi
callq 0x24c50
testb $0x1, %al
jne 0x14deb
jmp 0x14ed4
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdi
addq $0x18, %rdi
callq 0x24c70
movq -0x168(%rbp), %rdi
movq -0x170(%rbp), %rsi
movq %rax, -0x28(%rbp)
movb %dl, -0x20(%rbp)
addq $0xa8, %rdi
callq 0x23620
movq -0x170(%rbp), %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x10300
movq -0x188(%rbp), %rdi
movq -0x180(%rbp), %rsi
callq 0x24cb0
movq %rax, -0x178(%rbp)
jmp 0x14e61
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdi
addq $0x78, %rdi
callq 0x24cd0
movq %rax, -0x190(%rbp)
jmp 0x14e81
movq -0x190(%rbp), %rax
movq -0x178(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x48(%rbp), %rdi
callq 0x10460
movq -0x168(%rbp), %rdi
movq -0x170(%rbp), %rsi
addq $0x48, %rdi
callq 0x24d20
movl $0x0, (%rax)
jmp 0x14ed4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x10460
jmp 0x15880
leaq -0x70(%rbp), %rdi
callq 0x235d0
movl $0x0, -0x74(%rbp)
movq -0x168(%rbp), %rdi
movslq -0x74(%rbp), %rax
movq %rax, -0x198(%rbp)
addq $0xa8, %rdi
callq 0x24d70
movq %rax, %rcx
movq -0x198(%rbp), %rax
cmpq %rcx, %rax
jae 0x15464
movq -0x168(%rbp), %rdi
movq %rdi, %rax
addq $0x78, %rax
movq %rax, -0x1a8(%rbp)
addq $0xa8, %rdi
movslq -0x74(%rbp), %rsi
callq 0x24d90
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
callq 0x24cd0
movq %rax, -0x1a0(%rbp)
jmp 0x14f52
movq -0x1a0(%rbp), %rax
movq (%rax), %rdi
callq 0x23730
movq -0x168(%rbp), %rdi
movq %rax, -0x80(%rbp)
movq %rdi, %rax
addq $0x78, %rax
movq %rax, -0x1b8(%rbp)
addq $0xa8, %rdi
movslq -0x74(%rbp), %rsi
callq 0x24d90
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0x24cd0
movq %rax, -0x1b0(%rbp)
jmp 0x14fa2
movq -0x1b0(%rbp), %rax
movq (%rax), %rdi
callq 0x23770
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x14fd1
jmp 0x15454
movq -0x168(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x1c8(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x1c0(%rbp)
jmp 0x14ff5
movq -0x1c0(%rbp), %rsi
movq -0x1c8(%rbp), %rdi
callq 0x24db0
movq %rax, -0x1d0(%rbp)
jmp 0x15011
movq -0x168(%rbp), %rdi
movq -0x1d0(%rbp), %rax
movq %rax, -0x90(%rbp)
addq $0x18, %rdi
callq 0x23770
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23790
testb $0x1, %al
jne 0x15052
jmp 0x1542b
movq -0x168(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x1e0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x1d8(%rbp)
jmp 0x15076
movq -0x1d8(%rbp), %rsi
movq -0x1e0(%rbp), %rdi
callq 0x24c70
movb %dl, -0x1e9(%rbp)
movq %rax, -0x1e8(%rbp)
jmp 0x15098
movb -0x1e9(%rbp), %al
movq -0x1e8(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movb %al, -0xa0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x1f8(%rbp)
jmp 0x150c4
movq -0x1f8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x23620
jmp 0x150d6
movq -0x10(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x200(%rbp)
jmp 0x150f3
movq -0x200(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x10300
jmp 0x15108
movq -0x208(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x24cb0
movq %rax, -0x210(%rbp)
jmp 0x15124
movq -0x168(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x220(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x218(%rbp)
jmp 0x15148
movq -0x218(%rbp), %rsi
movq -0x220(%rbp), %rdi
callq 0x24cd0
movq %rax, -0x228(%rbp)
jmp 0x15164
movq -0x228(%rbp), %rax
movq -0x210(%rbp), %rcx
movq %rcx, (%rax)
leaq -0xc8(%rbp), %rdi
callq 0x10460
movq -0x168(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x238(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x230(%rbp)
jmp 0x151a5
movq -0x230(%rbp), %rsi
movq -0x238(%rbp), %rdi
callq 0x24d20
movq %rax, -0x240(%rbp)
jmp 0x151c1
movq -0x240(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x248(%rbp)
jmp 0x151eb
movq -0x248(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x10300
jmp 0x15200
movq -0x250(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x24cb0
movq %rax, -0x258(%rbp)
jmp 0x1521c
leaq -0xf0(%rbp), %rdi
callq 0x10460
movq -0x258(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x23730
movq %rax, -0xf8(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x23770
movq %rax, -0x100(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x15278
jmp 0x15429
movq -0x168(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x268(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x23830
movq %rax, -0x260(%rbp)
jmp 0x1529f
movq -0x260(%rbp), %rsi
movq -0x268(%rbp), %rdi
callq 0x24db0
movq %rax, -0x270(%rbp)
jmp 0x152bb
movq -0x168(%rbp), %rdi
movq -0x270(%rbp), %rax
movq %rax, -0x108(%rbp)
addq $0x18, %rdi
callq 0x23770
movq %rax, -0x110(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x152fc
jmp 0x153fd
movq -0x168(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x280(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23830
movq %rax, -0x278(%rbp)
jmp 0x15320
movq -0x278(%rbp), %rsi
movq -0x280(%rbp), %rdi
callq 0x24d20
movq %rax, -0x288(%rbp)
jmp 0x1533c
movq -0x168(%rbp), %rax
movq -0x288(%rbp), %rcx
movl (%rcx), %edx
incl %edx
movl %edx, (%rcx)
addq $0x48, %rax
movq %rax, -0x298(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x23830
movq %rax, -0x290(%rbp)
jmp 0x15370
movq -0x290(%rbp), %rsi
movq -0x298(%rbp), %rdi
callq 0x24d20
movq %rax, -0x2a0(%rbp)
jmp 0x1538c
movq -0x168(%rbp), %rax
movq -0x2a0(%rbp), %rcx
movl (%rcx), %edx
addl $0x1, %edx
movl %edx, (%rcx)
movl 0xc4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc4(%rax)
jmp 0x153fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x15877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x10460
jmp 0x15877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x10460
jmp 0x15877
jmp 0x153ff
leaq -0xf8(%rbp), %rdi
xorl %esi, %esi
callq 0x237c0
movq %rax, -0x2a8(%rbp)
jmp 0x15416
movq -0x2a8(%rbp), %rax
movq %rax, -0x118(%rbp)
jmp 0x1525c
jmp 0x1542b
jmp 0x1542d
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x237c0
movq %rax, -0x2b0(%rbp)
jmp 0x15441
movq -0x2b0(%rbp), %rax
movq %rax, -0x120(%rbp)
jmp 0x14fb8
jmp 0x15456
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x14ee4
movq -0x168(%rbp), %rdi
addq $0xa8, %rdi
leaq -0x70(%rbp), %rsi
callq 0x24df0
jmp 0x1547d
movq -0x168(%rbp), %rdi
addq $0x18, %rdi
callq 0x25040
movq -0x168(%rbp), %rdi
movl %eax, 0xc0(%rdi)
movslq 0xc0(%rdi), %rdx
movq %rdx, %rsi
callq 0x25060
jmp 0x154ab
movq -0x168(%rbp), %rdi
addq $0xa8, %rdi
callq 0x24d70
cmpq $0x0, %rax
je 0x15865
movq -0x168(%rbp), %rdi
addq $0x18, %rdi
callq 0x23730
movq -0x168(%rbp), %rdi
movq %rax, -0x128(%rbp)
addq $0x18, %rdi
callq 0x23770
movq %rax, -0x130(%rbp)
movl $0x0, -0x134(%rbp)
movl $0x0, -0x138(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x15526
jmp 0x15863
movq -0x168(%rbp), %rdi
addq $0x18, %rdi
callq 0x23730
movq %rax, -0x140(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x15559
jmp 0x15820
movl -0x134(%rbp), %eax
cmpl -0x138(%rbp), %eax
jne 0x155a2
movq -0x168(%rbp), %rdi
movslq -0x134(%rbp), %rsi
movslq -0x138(%rbp), %rdx
callq 0x246b0
movq %rax, -0x2b8(%rbp)
jmp 0x1558a
movq -0x2b8(%rbp), %rax
movsd 0xa6ad7(%rip), %xmm0    # 0xbc070
movsd %xmm0, (%rax)
jmp 0x157e7
movq -0x168(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x2c8(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x23830
movq %rax, -0x2c0(%rbp)
jmp 0x155c9
movq -0x2c0(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x24cd0
movq %rax, -0x2d0(%rbp)
jmp 0x155e5
movq -0x2d0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x23830
movq %rax, -0x2d8(%rbp)
jmp 0x1560b
movq -0x2d8(%rbp), %rsi
movq -0x2e0(%rbp), %rdi
callq 0x24db0
movq %rax, -0x2e8(%rbp)
jmp 0x15627
movq -0x168(%rbp), %rax
movq -0x2e8(%rbp), %rcx
movq %rcx, -0x148(%rbp)
addq $0x78, %rax
movq %rax, -0x2f8(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x23830
movq %rax, -0x2f0(%rbp)
jmp 0x1565c
movq -0x2f0(%rbp), %rsi
movq -0x2f8(%rbp), %rdi
callq 0x24cd0
movq %rax, -0x300(%rbp)
jmp 0x15678
movq -0x300(%rbp), %rax
movq (%rax), %rdi
callq 0x23770
movq %rax, -0x150(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x23800
testb $0x1, %al
jne 0x156aa
jmp 0x157b4
movq -0x168(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x310(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x23830
movq %rax, -0x308(%rbp)
jmp 0x156d1
movq -0x308(%rbp), %rsi
movq -0x310(%rbp), %rdi
callq 0x24d20
movq %rax, -0x318(%rbp)
jmp 0x156ed
movq -0x168(%rbp), %rax
movq -0x318(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, -0x32c(%rbp)
addq $0x48, %rax
movq %rax, -0x328(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x23830
movq %rax, -0x320(%rbp)
jmp 0x15723
movq -0x320(%rbp), %rsi
movq -0x328(%rbp), %rdi
callq 0x24d20
movq %rax, -0x338(%rbp)
jmp 0x1573f
movl -0x32c(%rbp), %edi
movq -0x338(%rbp), %rax
movl (%rax), %eax
imull %eax, %edi
callq 0x251d0
movsd %xmm0, -0x340(%rbp)
jmp 0x15760
movq -0x168(%rbp), %rdi
movsd -0x340(%rbp), %xmm1
movsd 0xa6901(%rip), %xmm0    # 0xbc078
divsd %xmm1, %xmm0
movsd %xmm0, -0x350(%rbp)
movslq -0x134(%rbp), %rsi
movslq -0x138(%rbp), %rdx
callq 0x246b0
movq %rax, -0x348(%rbp)
jmp 0x1579f
movq -0x348(%rbp), %rax
movsd -0x350(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x157e5
movq -0x168(%rbp), %rdi
movslq -0x134(%rbp), %rsi
movslq -0x138(%rbp), %rdx
callq 0x246b0
movq %rax, -0x358(%rbp)
jmp 0x157d7
movq -0x358(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x157e7
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
leaq -0x140(%rbp), %rdi
xorl %esi, %esi
callq 0x237c0
movq %rax, -0x360(%rbp)
jmp 0x1580d
movq -0x360(%rbp), %rax
movq %rax, -0x158(%rbp)
jmp 0x1553d
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
movl $0x0, -0x138(%rbp)
leaq -0x128(%rbp), %rdi
xorl %esi, %esi
callq 0x237c0
movq %rax, -0x368(%rbp)
jmp 0x15850
movq -0x368(%rbp), %rax
movq %rax, -0x160(%rbp)
jmp 0x1550a
jmp 0x15865
leaq -0x70(%rbp), %rdi
callq 0x236d0
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x236d0
movq -0x50(%rbp), %rdi
callq 0x10cc0
nopl (%rax)