// File: /workspace/github_cpp_makefile_star2_O1/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 0x15227(%rip), %rdi     # 0x29e54
callq 0x29d5e
movq %rax, 0x8(%rsp)
movq 0x6435a(%rip), %r13     # 0x78f98
leaq 0x34c70(%rip), %rsi     # 0x498b5
movl $0x13, %edx
movq %r13, %rdi
callq 0xd620
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r13, %rdi
callq 0xd620
leaq 0x34a07(%rip), %rsi     # 0x4966f
movl $0x1, %edx
movq %rax, %rdi
callq 0xd620
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 0x28d6a
leaq 0xf0(%rsp), %rdi
movq %r14, %rsi
callq 0x138d9
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x14cc8
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0xd550
movq 0x642c9(%rip), %rdi     # 0x78f98
leaq 0x34bf3(%rip), %rsi     # 0x498c9
movl $0x7, %edx
callq 0xd620
movq 0x100(%rsp), %rsi
movq 0x642a9(%rip), %rdi     # 0x78f98
callq 0xd360
movq %rax, %r14
leaq 0x34bd3(%rip), %rsi     # 0x498d1
movl $0xd, %edx
movq %rax, %rdi
callq 0xd620
leaq 0x15142(%rip), %rdi     # 0x29e54
callq 0x29d5e
leaq 0x228(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x223a0
movabsq $0x20c49ba5e353f7cf, %r13 # imm = 0x20C49BA5E353F7CF
imulq %r13
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xd4c0
leaq 0x34b89(%rip), %rsi     # 0x498df
movl $0x3, %edx
movq %rax, %rdi
callq 0xd620
leaq 0x150ea(%rip), %rdi     # 0x29e54
callq 0x29d5e
movq %rax, 0x8(%rsp)
movq 0x6421d(%rip), %rdi     # 0x78f98
leaq 0x34b33(%rip), %rsi     # 0x498b5
movl $0x13, %edx
callq 0xd620
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq 0x641fc(%rip), %rdi     # 0x78f98
callq 0xd620
leaq 0x348c7(%rip), %rsi     # 0x4966f
movl $0x1, %edx
movq %rax, %rdi
callq 0xd620
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x28d6a
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x138d9
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x14e0c
movq 0x90(%rsp), %rsi
incq %rsi
callq 0xd550
movq 0x64185(%rip), %rdi     # 0x78f98
leaq 0x34aaf(%rip), %rsi     # 0x498c9
movl $0x7, %edx
callq 0xd620
movq 0xb0(%rsp), %rsi
movq 0x64165(%rip), %rdi     # 0x78f98
callq 0xd360
movq %rax, %r14
leaq 0x34a8f(%rip), %rsi     # 0x498d1
movl $0xd, %edx
movq %rax, %rdi
callq 0xd620
leaq 0x14ffe(%rip), %rdi     # 0x29e54
callq 0x29d5e
leaq 0x228(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x223a0
imulq %r13
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xd4c0
leaq 0x34a4f(%rip), %rsi     # 0x498df
movl $0x3, %edx
movq %rax, %rdi
callq 0xd620
movq (%r15), %rsi
leaq 0x228(%rsp), %rdi
movl $0x10, %edx
callq 0xd5a0
leaq 0x14f9b(%rip), %rdi     # 0x29e54
callq 0x29d5e
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 0x14ee8
callq 0xd6b0
movl %eax, %ebp
cmpl $0x3, %ebp
movl $0x2, %r14d
cmovgel %ebp, %r14d
movq 0x6409c(%rip), %rdi     # 0x78f98
leaq 0x349e0(%rip), %rsi     # 0x498e3
movl $0x19, %edx
callq 0xd620
movq 0x64084(%rip), %rdi     # 0x78f98
movl %r14d, %esi
callq 0xd9a0
leaq 0x349da(%rip), %rsi     # 0x498fd
movl $0x9, %edx
movq %rax, %rdi
callq 0xd620
movl %r14d, %esi
leaq 0x60(%rsp), %rdi
callq 0x1de1a
movl 0x100(%rsp), %esi
movq 0x8(%rsp), %rdx
leaq 0x1d8(%rsp), %rdi
callq 0x1e184
cmpq $0x0, 0x100(%rsp)
je 0x14f80
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x15397
movq 0xf8(%rsp), %rcx
movq (%rax,%rcx,8), %r15
jmp 0x14f83
xorl %r15d, %r15d
testq %r15, %r15
je 0x150ed
leaq 0x120(%rsp), %r14
leaq 0x140(%rsp), %r12
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 0xd040
movq %rax, 0x120(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4040c
movl $0x20, %edi
callq 0xd520
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 0x40578
leaq 0x10(%r15), %rsi
movq %r12, %rdi
callq 0x1ed88
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 -0xf6a(%rip), %rsi      # 0x140e3
movq %r12, %rdx
leaq 0xa0(%rsp), %rcx
callq 0x1ec80
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x1edde
movq %r13, %rdi
movq %r14, %rsi
callq 0x1e270
movq %r14, %rdi
callq 0x1e464
leaq 0x1a0(%rsp), %rdi
callq 0x1eafe
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x150af
movq 0x190(%rsp), %rsi
incq %rsi
callq 0xd550
leaq 0x160(%rsp), %rdi
callq 0x1eafe
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x150e1
movq 0x150(%rsp), %rsi
incq %rsi
callq 0xd550
movq (%r15), %r15
testq %r15, %r15
jne 0x14fa9
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
callq 0x1e49c
movq 0x63e98(%rip), %rdi     # 0x78f98
leaq 0x34800(%rip), %rsi     # 0x49907
movl $0x16, %edx
callq 0xd620
movq 0xb0(%rsp), %rsi
imulq 0x100(%rsp), %rsi
movq 0x63e6f(%rip), %rdi     # 0x78f98
callq 0xd360
movq %rax, %r14
leaq 0x347e6(%rip), %rsi     # 0x4991e
movl $0xe, %edx
movq %rax, %rdi
callq 0xd620
leaq 0x14d08(%rip), %rdi     # 0x29e54
callq 0x29d5e
leaq 0x120(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x8(%rsp), %rsi
callq 0x223a0
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq %r14, %rdi
callq 0xd4c0
leaq 0x34774(%rip), %rsi     # 0x49904
movl $0x2, %edx
movq %rax, %rdi
callq 0xd620
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x152bb
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 0xd620
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x15210
movq (%r15), %rdi
leaq 0x10(%r15), %rax
cmpq %rax, %rdi
je 0x15203
movq (%rax), %rsi
incq %rsi
callq 0xd550
movl $0x20, %esi
movq %r15, %rdi
callq 0xd550
cmpq $0x0, 0xb0(%rsp)
je 0x1528e
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x1eecc
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %r15
testq %r15, %r15
je 0x15281
movq 0x20(%r15), %rdi
leaq 0x30(%r15), %rax
cmpq %rax, %rdi
je 0x1525d
movq (%rax), %rsi
incq %rsi
callq 0xd550
movq (%r15), %rdi
leaq 0x10(%r15), %rax
cmpq %rax, %rdi
je 0x15274
movq (%rax), %rsi
incq %rsi
callq 0xd550
movl $0x50, %esi
movq %r15, %rdi
callq 0xd550
incq %r13
cmpq %r13, 0xb0(%rsp)
ja 0x1521e
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x152a1
callq 0xd710
incq %r12
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
cmpq %r12, %rax
ja 0x151c6
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
callq 0x14436
leaq 0x228(%rsp), %rdi
callq 0xd7d0
leaq 0x200(%rsp), %rdi
callq 0x28594
leaq 0x78(%rsp), %rdi
callq 0x2307a
leaq 0x68(%rsp), %rdi
callq 0x2307a
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x15319
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x15330
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
movq 0x63c21(%rip), %rax     # 0x78f58
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 0xd420
leaq 0x320(%rsp), %rdi
callq 0xd1e0
leaq 0xa0(%rsp), %rdi
callq 0x3f0b8
leaq 0xf0(%rsp), %rdi
callq 0x3f0b8
movq %rbx, %rax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x36c61(%rip), %rdi     # 0x4bfff
leaq 0x346fd(%rip), %rsi     # 0x49aa2
leaq 0x47572(%rip), %rcx     # 0x5c91e
movl $0xbd1, %edx            # imm = 0xBD1
callq 0xd340
movq %rax, %r15
jmp 0x1549b
jmp 0x15422
movq %rax, %r15
jmp 0x154dd
jmp 0x15430
movq %rax, %r15
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x154f7
movq 0x90(%rsp), %rsi
incq %rsi
callq 0xd550
jmp 0x154f7
jmp 0x1543a
jmp 0x1543a
movq %rax, %r15
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x15504
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0xd550
jmp 0x15504
jmp 0x15483
movq %rax, %r15
jmp 0x154af
jmp 0x15430
jmp 0x1547e
jmp 0x1547e
movq %rax, %r15
jmp 0x154ea
jmp 0x1543a
movq %rax, %r15
jmp 0x154f7
jmp 0x15483
jmp 0x1547e
movq %rax, %r15
jmp 0x1546d
movq %rax, %r15
jmp 0x15460
movq %rax, %r15
leaq 0x120(%rsp), %rdi
callq 0x1e464
leaq 0x178(%rsp), %rdi
callq 0x1ee7c
leaq 0x140(%rsp), %rdi
callq 0x1eea4
jmp 0x1548e
jmp 0x1547e
movq %rax, %r15
jmp 0x1548e
movq %rax, %r15
movq %rbx, %rdi
callq 0x1ef2c
leaq 0x200(%rsp), %rdi
callq 0x28594
leaq 0x78(%rsp), %rdi
callq 0x2307a
leaq 0x68(%rsp), %rdi
callq 0x2307a
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x154c6
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x154dd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xd550
leaq 0x228(%rsp), %rdi
callq 0xd820
leaq 0xa0(%rsp), %rdi
callq 0x3f0b8
leaq 0xf0(%rsp), %rdi
callq 0x3f0b8
movq %r15, %rdi
callq 0xd9c0