// File: /workspace/github_cpp_makefile_star2_O3/Kingsford-Group[P]ghost2/src/spectralToDistance.hpp
// Function: getDistances(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, double, boost::unordered::unordered_map<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, double, boost::hash<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::equal_to<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const, double>>>*, int)
vector<D_alpha> getDistances(string file1, string file2, string outputname, double a, double b, blastmap* blastscores, int numP)
{
  ptime t = bclock::local_time();
  cout << "loading sigs file: " << file1 << "\n";
  spectramap m1 = loadSigs(file1);
  cout << "loaded " << m1.size() << " vertices in " <<
    (bclock::local_time() - t).total_milliseconds() << "ms\n";

  t = bclock::local_time();
  cout << "loading sigs file: " << file2 << "\n";
  spectramap m2 = loadSigs(file2);
  cout << "loaded " << m2.size() << " vertices in " <<
    (bclock::local_time() - t).total_milliseconds() << "ms\n";

  ofstream out(outputname.c_str());

  t = bclock::local_time();

  vector<D_alpha**> results;
  vector<string*> outputs;
  int numthreads = numP==-1?boost::thread::hardware_concurrency():numP;
  if(numthreads < 2) numthreads = 2;
  cout << "\ncalculating D_alphas on " << numthreads << " threads\n";
  boost::threadpool::pool threads(numthreads);

  ProgressBar pbar(m1.size(), t);
  for(spectramap::iterator it1 = m1.begin(); it1 != m1.end(); ++it1){
    results.push_back(new D_alpha*[m2.size()]);
    outputs.push_back(new string);
    threads.schedule(boost::bind(&distanceWorker, *it1, &m2, results.back(),
        outputs.back(), &pbar));
  }

  threads.wait();
  cout << "\nfinished calculating " << (m1.size()*m2.size()) << " distances in " <<
    (bclock::local_time()-t).total_seconds() << "s\n";

  vector<D_alpha> allDistances;
  for(int i=0; i<results.size(); i++){
    out << *(outputs[i]);
    delete outputs[i];
    for(int j=0; j<m2.size(); j++){allDistances.push_back(*(results[i][j])); delete results[i][j];}
    delete[] results[i];
  }

  applyAlpha(a, b, &allDistances, blastscores);

  out.close();
  return allDistances;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movl %r9d, %ebp
movq %r8, 0x58(%rsp)
movsd %xmm1, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14f25(%rip), %rdi     # 0x2891c
callq 0x28826
movq %rax, 0x8(%rsp)
movq 0x64590(%rip), %r13     # 0x77f98
leaq 0x34ed6(%rip), %rsi     # 0x488e5
movl $0x13, %edx
movq %r13, %rdi
callq 0xc620
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r13, %rdi
callq 0xc620
leaq 0x34c6d(%rip), %rsi     # 0x4869f
movl $0x1, %edx
movq %rax, %rdi
callq 0xc620
leaq 0xe0(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0x27846
leaq 0xf0(%rsp), %rdi
movq %r14, %rsi
callq 0x126cc
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x13a92
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0xc550
movq 0x644ff(%rip), %rdi     # 0x77f98
leaq 0x34e59(%rip), %rsi     # 0x488f9
movl $0x7, %edx
callq 0xc620
movq 0x100(%rsp), %rsi
movq 0x644df(%rip), %rdi     # 0x77f98
callq 0xc360
movq %rax, %r14
leaq 0x34e39(%rip), %rsi     # 0x48901
movl $0xd, %edx
movq %rax, %rdi
callq 0xc620
leaq 0x14e40(%rip), %rdi     # 0x2891c
callq 0x28826
leaq 0x228(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x20fc4
movabsq $0x20c49ba5e353f7cf, %r13 # imm = 0x20C49BA5E353F7CF
imulq %r13
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xc4c0
leaq 0x34def(%rip), %rsi     # 0x4890f
movl $0x3, %edx
movq %rax, %rdi
callq 0xc620
leaq 0x14de8(%rip), %rdi     # 0x2891c
callq 0x28826
movq %rax, 0x8(%rsp)
movq 0x64453(%rip), %rdi     # 0x77f98
leaq 0x34d99(%rip), %rsi     # 0x488e5
movl $0x13, %edx
callq 0xc620
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq 0x64432(%rip), %rdi     # 0x77f98
callq 0xc620
leaq 0x34b2d(%rip), %rsi     # 0x4869f
movl $0x1, %edx
movq %rax, %rdi
callq 0xc620
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x27846
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x126cc
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x13bd6
movq 0x90(%rsp), %rsi
incq %rsi
callq 0xc550
movq 0x643bb(%rip), %rdi     # 0x77f98
leaq 0x34d15(%rip), %rsi     # 0x488f9
movl $0x7, %edx
callq 0xc620
movq 0xb0(%rsp), %rsi
movq 0x6439b(%rip), %rdi     # 0x77f98
callq 0xc360
movq %rax, %r14
leaq 0x34cf5(%rip), %rsi     # 0x48901
movl $0xd, %edx
movq %rax, %rdi
callq 0xc620
leaq 0x14cfc(%rip), %rdi     # 0x2891c
callq 0x28826
leaq 0x228(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x20fc4
imulq %r13
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xc4c0
leaq 0x34cb5(%rip), %rsi     # 0x4890f
movl $0x3, %edx
movq %rax, %rdi
callq 0xc620
movq (%r15), %rsi
leaq 0x228(%rsp), %rdi
movl $0x10, %edx
callq 0xc5a0
leaq 0x14c99(%rip), %rdi     # 0x2891c
callq 0x28826
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
cmpl $-0x1, %ebp
jne 0x13cb2
callq 0xc6b0
movl %eax, %ebp
cmpl $0x3, %ebp
movl $0x2, %r14d
cmovgel %ebp, %r14d
movq 0x642d2(%rip), %rdi     # 0x77f98
leaq 0x34c46(%rip), %rsi     # 0x48913
movl $0x19, %edx
callq 0xc620
movq 0x642ba(%rip), %rdi     # 0x77f98
movl %r14d, %esi
callq 0xc9a0
leaq 0x34c40(%rip), %rsi     # 0x4892d
movl $0x9, %edx
movq %rax, %rdi
callq 0xc620
movl %r14d, %esi
leaq 0x60(%rsp), %rdi
callq 0x1cb1e
movl 0x100(%rsp), %esi
movq 0x8(%rsp), %rdx
leaq 0x1d8(%rsp), %rdi
callq 0x1ce88
cmpq $0x0, 0x100(%rsp)
je 0x13eb8
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x14165
movq 0xf8(%rsp), %rcx
movq (%rax,%rcx,8), %r12
testq %r12, %r12
je 0x13eb8
leaq 0x120(%rsp), %r14
leaq 0x140(%rsp), %r15
leaq 0x178(%rsp), %rbp
leaq 0x60(%rsp), %r13
movq 0xb0(%rsp), %rax
movq %rax, %rcx
shrq $0x3d, %rcx
shlq $0x3, %rax
negq %rcx
movl $0x0, %edi
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0xc040
movq %rax, 0x120(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x3f304
movl $0x20, %edi
callq 0xc520
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rax, 0x120(%rsp)
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x3f478
leaq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1da74
movq 0x18(%rsp), %rax
movq -0x8(%rax), %r8
movq 0x38(%rsp), %rax
movq -0x8(%rax), %r9
leaq 0x1d8(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq -0xf41(%rip), %rsi      # 0x12ed6
movq %r15, %rdx
leaq 0xa0(%rsp), %rcx
callq 0x1d97a
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x1daca
movq %r13, %rdi
movq %r14, %rsi
callq 0x1cf74
movq %r14, %rdi
callq 0x1d158
leaq 0x1a0(%rsp), %rdi
callq 0x1d7f8
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x13e79
movq 0x190(%rsp), %rsi
incq %rsi
callq 0xc550
leaq 0x160(%rsp), %rdi
callq 0x1d7f8
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x13eab
movq 0x150(%rsp), %rsi
incq %rsi
callq 0xc550
movq (%r12), %r12
testq %r12, %r12
jne 0x13d72
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
callq 0x1d190
movq 0x640cd(%rip), %rdi     # 0x77f98
leaq 0x34a65(%rip), %rsi     # 0x48937
movl $0x16, %edx
callq 0xc620
movq 0xb0(%rsp), %rsi
imulq 0x100(%rsp), %rsi
movq 0x640a4(%rip), %rdi     # 0x77f98
callq 0xc360
movq %rax, %r14
leaq 0x34a4b(%rip), %rsi     # 0x4894e
movl $0xe, %edx
movq %rax, %rdi
callq 0xc620
leaq 0x14a05(%rip), %rdi     # 0x2891c
callq 0x28826
leaq 0x120(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x20fc4
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xc4c0
leaq 0x349d9(%rip), %rsi     # 0x48934
movl $0x2, %edx
movq %rax, %rdi
callq 0xc620
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x14089
xorl %r12d, %r12d
leaq 0x228(%rsp), %r14
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0xc620
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x13fce
movq (%r15), %rdi
leaq 0x10(%r15), %rax
cmpq %rax, %rdi
je 0x13fce
movq (%rax), %rsi
incq %rsi
callq 0xc550
movl $0x20, %esi
movq %r15, %rdi
callq 0xc550
cmpq $0x0, 0xb0(%rsp)
je 0x14059
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x1dbaa
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %r15
testq %r15, %r15
je 0x1403f
movq 0x20(%r15), %rdi
leaq 0x30(%r15), %rax
cmpq %rax, %rdi
je 0x14028
movq (%rax), %rsi
incq %rsi
callq 0xc550
movq (%r15), %rdi
leaq 0x10(%r15), %rax
cmpq %rax, %rdi
je 0x1403f
movq (%rax), %rsi
incq %rsi
callq 0xc550
movl $0x50, %esi
movq %r15, %rdi
callq 0xc550
incq %r13
cmpq %r13, 0xb0(%rsp)
ja 0x13fe9
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x14071
callq 0xc710
movq 0x10(%rsp), %rax
incq %r12
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x13f91
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
callq 0x13229
leaq 0x228(%rsp), %rdi
callq 0xc7d0
leaq 0x200(%rsp), %rdi
callq 0x27078
leaq 0x78(%rsp), %rdi
callq 0x21c42
leaq 0x68(%rsp), %rdi
callq 0x21c42
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x140e7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x140fe
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
movq 0x63e53(%rip), %rax     # 0x77f58
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x230(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x228(%rsp,%rcx)
callq 0xc420
leaq 0x320(%rsp), %rdi
callq 0xc1e0
leaq 0xa0(%rsp), %rdi
callq 0x3dfba
leaq 0xf0(%rsp), %rdi
callq 0x3dfba
movq %rbx, %rax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x36ec3(%rip), %rdi     # 0x4b02f
leaq 0x3495f(%rip), %rsi     # 0x48ad2
leaq 0x47489(%rip), %rcx     # 0x5b603
movl $0xbd1, %edx            # imm = 0xBD1
callq 0xc340
movq %rax, %r15
jmp 0x14269
jmp 0x141f0
movq %rax, %r15
jmp 0x142ab
jmp 0x141fe
movq %rax, %r15
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x142c5
movq 0x90(%rsp), %rsi
incq %rsi
callq 0xc550
jmp 0x142c5
jmp 0x14208
jmp 0x14208
movq %rax, %r15
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x142d2
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0xc550
jmp 0x142d2
jmp 0x14251
movq %rax, %r15
jmp 0x1427d
jmp 0x141fe
jmp 0x1424c
jmp 0x1424c
movq %rax, %r15
jmp 0x142b8
jmp 0x14208
movq %rax, %r15
jmp 0x142c5
jmp 0x1424c
movq %rax, %r15
jmp 0x14239
movq %rax, %r15
jmp 0x1422c
movq %rax, %r15
leaq 0x120(%rsp), %rdi
callq 0x1d158
leaq 0x178(%rsp), %rdi
callq 0x1db5a
leaq 0x140(%rsp), %rdi
callq 0x1db82
jmp 0x1425c
jmp 0x14251
jmp 0x1424c
movq %rax, %r15
jmp 0x1425c
movq %rax, %r15
movq %rbx, %rdi
callq 0x1dc0a
leaq 0x200(%rsp), %rdi
callq 0x27078
leaq 0x78(%rsp), %rdi
callq 0x21c42
leaq 0x68(%rsp), %rdi
callq 0x21c42
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x14294
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x142ab
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xc550
leaq 0x228(%rsp), %rdi
callq 0xc820
leaq 0xa0(%rsp), %rdi
callq 0x3dfba
leaq 0xf0(%rsp), %rdi
callq 0x3dfba
movq %r15, %rdi
callq 0xc9c0