// File: Kingsford-Group[P]ghost2/src/computeSpectralSignatures.hpp
// Function: computeSpectralSignatures(Graph*, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void computeSpectralSignatures(Graph *input, int numHops, int numP, string mode)
{
  ptime t = bclock::local_time();
  if(numP < 1) numP = boost::thread::hardware_concurrency();
  if(numP < 1) numP = 2;
  pool tpool(numP);
  vector<string> nodes = (*input).nodes();
  int numNodes = nodes.size();
  GzWriter w((*input).getName()+".sig.gz");
  ProgressBar p(numNodes, t);
  cout << "creating: " << (*input).getName() << ".sig.gz\n";
  w.writeInt(numNodes);
  w.writeInt(numHops);
  
  levelMap levelmap;
  vector< vector<LevelData> > data;
  data.resize(numNodes);
  if(mode=="")
    for(int i=0;i<numNodes;i++)
      tpool.schedule(
        boost::bind(&spectrum, input, numHops, nodes[i], &(data[i]), &p)
      );
  else if(mode=="rayleigh")
    for(int i=0;i<numNodes;i++)
      tpool.schedule(
        boost::bind(&spectrumR, input, numHops, nodes[i], &(data[i]), &p)
      );
  else if(mode=="inverseIter")
    for(int i=0;i<numNodes;i++)
      tpool.schedule(
        boost::bind(&spectrumI, input, numHops, nodes[i], &(data[i]), &p)
      );
  else
  {
    cout << "sigApprox should be either rayleigh or inverseIter\n";
    exit(0);
  }
  tpool.wait();
  cout << "\n";

  for(int i=0;i<numNodes;i++)
    levelmap[nodes[i]] = data[i];
  w.writeData(levelmap);
  cout << "created: " << (*input).getName() << ".sig.gz in " <<
    (bclock::local_time() - t).total_milliseconds() << " milliseconds\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x550, %rsp            # imm = 0x550
movq %rcx, -0x4b8(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
callq 0x23b20
movq %rax, -0x20(%rbp)
cmpl $0x1, -0x10(%rbp)
jge 0x166f7
callq 0x108b0
movl %eax, -0x10(%rbp)
cmpl $0x1, -0x10(%rbp)
jge 0x16704
movl $0x2, -0x10(%rbp)
movslq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x25990
movq -0x8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x12320
jmp 0x16720
leaq -0x58(%rbp), %rdi
callq 0x24d70
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x23c90
jmp 0x1673e
leaq 0xa60af(%rip), %rdx     # 0xbc7f4
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x23850
jmp 0x1675a
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x25ae0
jmp 0x1676f
leaq -0x1b8(%rbp), %rdi
callq 0x10460
leaq -0x1d8(%rbp), %rdi
callq 0x10460
movl -0x68(%rbp), %esi
movq -0x20(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x230(%rbp), %rdx
leaq -0x228(%rbp), %rdi
callq 0x25dd0
jmp 0x167aa
movq 0x11a7e7(%rip), %rdi    # 0x130f98
leaq 0xa6044(%rip), %rsi     # 0xbc7fc
callq 0x106c0
movq %rax, -0x4c0(%rbp)
jmp 0x167c6
movq -0x8(%rbp), %rsi
leaq -0x250(%rbp), %rdi
callq 0x23c90
jmp 0x167d8
movq -0x4c0(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x10600
movq %rax, -0x4c8(%rbp)
jmp 0x167f4
movq -0x4c8(%rbp), %rdi
leaq 0xa6005(%rip), %rsi     # 0xbc807
callq 0x106c0
jmp 0x16809
leaq -0x250(%rbp), %rdi
callq 0x10460
movl -0x68(%rbp), %esi
leaq -0x198(%rbp), %rdi
callq 0x25630
jmp 0x16826
movl -0xc(%rbp), %esi
leaq -0x198(%rbp), %rdi
callq 0x25630
jmp 0x16837
leaq -0x280(%rbp), %rdi
callq 0x25e40
jmp 0x16845
leaq -0x298(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x25ed0
movq -0x4d0(%rbp), %rdi
movslq -0x68(%rbp), %rsi
callq 0x25ef0
jmp 0x1686a
movq -0x4b8(%rbp), %rdi
leaq 0xa6014(%rip), %rsi     # 0xbc88c
callq 0x233d0
movb %al, -0x4d1(%rbp)
jmp 0x16885
movb -0x4d1(%rbp), %al
testb $0x1, %al
jne 0x16894
jmp 0x16a8e
movl $0x0, -0x29c(%rbp)
movl -0x29c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x16a89
movq -0x8(%rbp), %rax
movq %rax, -0x4e0(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x4d8(%rbp)
movslq -0x29c(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x24d90
movq %rax, %rsi
leaq -0x328(%rbp), %rdi
callq 0x10300
jmp 0x168e2
movslq -0x29c(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x26100
movq -0x4e0(%rbp), %rdx
movl -0x4d8(%rbp), %ecx
movq %rax, %r9
movq %rsp, %rax
leaq -0x228(%rbp), %rsi
movq %rsi, (%rax)
leaq -0x8b9(%rip), %rsi      # 0x16060
leaq -0x308(%rbp), %rdi
leaq -0x328(%rbp), %r8
callq 0x25fb0
jmp 0x1692e
leaq -0x2c0(%rbp), %rdi
leaq -0x308(%rbp), %rsi
xorl %edx, %edx
callq 0x26120
jmp 0x16945
leaq -0x40(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x25f80
jmp 0x16957
leaq -0x2c0(%rbp), %rdi
callq 0x261a0
leaq -0x308(%rbp), %rdi
callq 0x261d0
leaq -0x328(%rbp), %rdi
callq 0x10460
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x1689e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1702b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x17022
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x169d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x10460
leaq -0x1d8(%rbp), %rdi
callq 0x10460
jmp 0x17022
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x17016
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1700a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x10460
jmp 0x1700a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16a78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16a6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x261a0
leaq -0x308(%rbp), %rdi
callq 0x261d0
leaq -0x328(%rbp), %rdi
callq 0x10460
jmp 0x16ff2
jmp 0x16da1
movq -0x4b8(%rbp), %rdi
leaq 0xa5d74(%rip), %rsi     # 0xbc810
callq 0x233d0
movb %al, -0x4e1(%rbp)
jmp 0x16aa9
movb -0x4e1(%rbp), %al
testb $0x1, %al
jne 0x16ab8
jmp 0x16c09
movl $0x0, -0x32c(%rbp)
movl -0x32c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x16c04
movq -0x8(%rbp), %rax
movq %rax, -0x4f0(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x4e8(%rbp)
movslq -0x32c(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x24d90
movq %rax, %rsi
leaq -0x3b8(%rbp), %rdi
callq 0x10300
jmp 0x16b06
movslq -0x32c(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x26100
movq -0x4f0(%rbp), %rdx
movl -0x4e8(%rbp), %ecx
movq %rax, %r9
movq %rsp, %rax
leaq -0x228(%rbp), %rsi
movq %rsi, (%rax)
leaq -0x8bd(%rip), %rsi      # 0x16280
leaq -0x398(%rbp), %rdi
leaq -0x3b8(%rbp), %r8
callq 0x25fb0
jmp 0x16b52
leaq -0x350(%rbp), %rdi
leaq -0x398(%rbp), %rsi
xorl %edx, %edx
callq 0x26120
jmp 0x16b69
leaq -0x40(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x25f80
jmp 0x16b7b
leaq -0x350(%rbp), %rdi
callq 0x261a0
leaq -0x398(%rbp), %rdi
callq 0x261d0
leaq -0x3b8(%rbp), %rdi
callq 0x10460
movl -0x32c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x32c(%rbp)
jmp 0x16ac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16bf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16be7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x261a0
leaq -0x398(%rbp), %rdi
callq 0x261d0
leaq -0x3b8(%rbp), %rdi
callq 0x10460
jmp 0x16ff2
jmp 0x16d9f
movq -0x4b8(%rbp), %rdi
leaq 0xa5c02(%rip), %rsi     # 0xbc819
callq 0x233d0
movb %al, -0x4f1(%rbp)
jmp 0x16c24
movb -0x4f1(%rbp), %al
testb $0x1, %al
jne 0x16c33
jmp 0x16d81
movl $0x0, -0x3bc(%rbp)
movl -0x3bc(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x16d7f
movq -0x8(%rbp), %rax
movq %rax, -0x500(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x4f8(%rbp)
movslq -0x3bc(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x24d90
movq %rax, %rsi
leaq -0x448(%rbp), %rdi
callq 0x10300
jmp 0x16c81
movslq -0x3bc(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x26100
movq -0x500(%rbp), %rdx
movl -0x4f8(%rbp), %ecx
movq %rax, %r9
movq %rsp, %rax
leaq -0x228(%rbp), %rsi
movq %rsi, (%rax)
leaq -0x818(%rip), %rsi      # 0x164a0
leaq -0x428(%rbp), %rdi
leaq -0x448(%rbp), %r8
callq 0x25fb0
jmp 0x16ccd
leaq -0x3e0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
xorl %edx, %edx
callq 0x26120
jmp 0x16ce4
leaq -0x40(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x25f80
jmp 0x16cf6
leaq -0x3e0(%rbp), %rdi
callq 0x261a0
leaq -0x428(%rbp), %rdi
callq 0x261d0
leaq -0x448(%rbp), %rdi
callq 0x10460
movl -0x3bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3bc(%rbp)
jmp 0x16c3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16d6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16d62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x261a0
leaq -0x428(%rbp), %rdi
callq 0x261d0
leaq -0x448(%rbp), %rdi
callq 0x10460
jmp 0x16ff2
jmp 0x16d9d
movq 0x11a210(%rip), %rdi    # 0x130f98
leaq 0xa5a96(%rip), %rsi     # 0xbc825
callq 0x106c0
jmp 0x16d96
xorl %edi, %edi
callq 0x10890
jmp 0x16d9f
jmp 0x16da1
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x261f0
jmp 0x16db0
movq 0x11a1e1(%rip), %rdi    # 0x130f98
leaq 0xa5849(%rip), %rsi     # 0xbc607
callq 0x106c0
jmp 0x16dc5
movl $0x0, -0x44c(%rbp)
movl -0x44c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x16e44
movslq -0x44c(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x26100
movq %rax, -0x510(%rbp)
movslq -0x44c(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x24d90
movq %rax, %rsi
leaq -0x280(%rbp), %rdi
callq 0x26220
movq %rax, -0x508(%rbp)
jmp 0x16e1c
movq -0x510(%rbp), %rsi
movq -0x508(%rbp), %rdi
callq 0x26270
jmp 0x16e31
jmp 0x16e33
movl -0x44c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44c(%rbp)
jmp 0x16dcf
leaq -0x480(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x264c0
jmp 0x16e59
leaq -0x198(%rbp), %rdi
leaq -0x480(%rbp), %rsi
callq 0x15d90
jmp 0x16e6e
leaq -0x480(%rbp), %rdi
callq 0x265c0
movq 0x11a117(%rip), %rdi    # 0x130f98
leaq 0xa59d1(%rip), %rsi     # 0xbc859
callq 0x106c0
movq %rax, -0x518(%rbp)
jmp 0x16e96
movq -0x8(%rbp), %rsi
leaq -0x4a0(%rbp), %rdi
callq 0x23c90
jmp 0x16ea8
movq -0x518(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
callq 0x10600
movq %rax, -0x520(%rbp)
jmp 0x16ec4
movq -0x520(%rbp), %rdi
leaq 0xa5991(%rip), %rsi     # 0xbc863
callq 0x106c0
movq %rax, -0x528(%rbp)
jmp 0x16ee0
callq 0x23b20
movq %rax, -0x530(%rbp)
jmp 0x16eee
movq -0x530(%rbp), %rax
movq %rax, -0x4b0(%rbp)
leaq -0x4b0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x23cc0
movq %rax, -0x538(%rbp)
jmp 0x16f15
movq -0x538(%rbp), %rax
movq %rax, -0x4a8(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x23cf0
movq %rax, -0x540(%rbp)
jmp 0x16f38
movq -0x540(%rbp), %rsi
movq -0x528(%rbp), %rdi
callq 0x10d40
movq %rax, -0x548(%rbp)
jmp 0x16f54
movq -0x548(%rbp), %rdi
leaq 0xa584f(%rip), %rsi     # 0xbc7b1
callq 0x106c0
jmp 0x16f69
leaq -0x4a0(%rbp), %rdi
callq 0x10460
leaq -0x298(%rbp), %rdi
callq 0x265e0
leaq -0x280(%rbp), %rdi
callq 0x265c0
leaq -0x228(%rbp), %rdi
callq 0x26640
leaq -0x198(%rbp), %rdi
callq 0x26660
leaq -0x58(%rbp), %rdi
callq 0x236d0
leaq -0x40(%rbp), %rdi
callq 0x26680
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x265c0
jmp 0x16ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x4a0(%rbp), %rdi
callq 0x10460
leaq -0x298(%rbp), %rdi
callq 0x265e0
leaq -0x280(%rbp), %rdi
callq 0x265c0
leaq -0x228(%rbp), %rdi
callq 0x26640
leaq -0x198(%rbp), %rdi
callq 0x26660
leaq -0x58(%rbp), %rdi
callq 0x236d0
leaq -0x40(%rbp), %rdi
callq 0x26680
movq -0x60(%rbp), %rdi
callq 0x10cc0
nopl (%rax)