// File: Kingsford-Group[P]ghost2/src/spectralToDistance.hpp
// Function: getDistancesFromFile(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>>>*)
vector<D_alpha> getDistancesFromFile(string file, double alpha, double beta, blastmap* blastscores)
{
  cout << "reading distances from " << file << "\n";
  vector<D_alpha> allDistances;

  ifstream fin(file);
  if(!fin.good()) {cout << ".sig.gz file" << file << "not found\n"; exit(0);}
  char c = fin.get();
  int alen = 0;
  int blen = 0;
  int dlen = 0;
  char a[128];
  char b[128];
  char d[128];
  int filling = 0;
  while(fin.good()){
    if(c == '\n'){
      d[dlen] = '\0';
      allDistances.push_back(D_alpha(string(a), string(b), atof(d)));
      alen = blen = dlen = 0;
      filling = 0;
    }
    else if(c == '\r'){}
    else if (c == '\t'){
      if(filling == 0) a[alen] = '\0';
      else if(filling == 1) b[blen] = '\0';
      filling++;
    }
    else if(filling == 0) a[alen++] = c;
    else if(filling == 1) b[blen++] = c;
    else d[dlen++] = c;
    c = fin.get();
  }

  applyAlpha(alpha, beta, &allDistances, blastscores);
  cout << "finished reading " << allDistances.size() << " distances\n";

  return allDistances;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rsi, -0x490(%rbp)
movq %rdi, -0x498(%rbp)
movq %rdi, %rax
movq %rax, -0x4a0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq 0x117428(%rip), %rdi    # 0x130f98
leaq 0xa2d8e(%rip), %rsi     # 0xbc905
callq 0x106c0
movq -0x490(%rbp), %rsi
movq %rax, %rdi
callq 0x10600
movq %rax, %rdi
leaq 0xa2a72(%rip), %rsi     # 0xbc607
callq 0x106c0
movq -0x498(%rbp), %rdi
movb $0x0, -0x29(%rbp)
callq 0x27ed0
movq -0x490(%rbp), %rsi
leaq -0x238(%rbp), %rdi
movl $0x8, %edx
callq 0x10bd0
jmp 0x19bc4
movq -0x238(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x238(%rbp,%rax), %rdi
callq 0x10c60
movb %al, -0x4a1(%rbp)
jmp 0x19be4
movb -0x4a1(%rbp), %al
testb $0x1, %al
jne 0x19c76
jmp 0x19bf4
movq 0x11739d(%rip), %rdi    # 0x130f98
leaq 0xa2d1b(%rip), %rsi     # 0xbc91d
callq 0x106c0
movq %rax, -0x4b0(%rbp)
jmp 0x19c10
movq -0x490(%rbp), %rsi
movq -0x4b0(%rbp), %rdi
callq 0x10600
movq %rax, -0x4b8(%rbp)
jmp 0x19c2c
movq -0x4b8(%rbp), %rdi
leaq 0xa29db(%rip), %rsi     # 0xbc615
callq 0x106c0
jmp 0x19c41
xorl %edi, %edi
callq 0x10890
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x1a057
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x1a02d
leaq -0x238(%rbp), %rdi
callq 0x10870
movl %eax, -0x4bc(%rbp)
jmp 0x19c8a
movl -0x4bc(%rbp), %eax
movb %al, -0x245(%rbp)
movl $0x0, -0x24c(%rbp)
movl $0x0, -0x250(%rbp)
movl $0x0, -0x254(%rbp)
movl $0x0, -0x3e4(%rbp)
movq -0x238(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x238(%rbp,%rax), %rdi
callq 0x10c60
movb %al, -0x4bd(%rbp)
jmp 0x19cde
movb -0x4bd(%rbp), %al
testb $0x1, %al
jne 0x19ced
jmp 0x19fa4
movsbl -0x245(%rbp), %eax
cmpl $0xa, %eax
jne 0x19e9f
movslq -0x254(%rbp), %rax
movb $0x0, -0x3e0(%rbp,%rax)
leaq -0x459(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x10ce0
movq -0x4c8(%rbp), %rdx
leaq -0x458(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x23400
jmp 0x19d3b
leaq -0x481(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x10ce0
movq -0x4d0(%rbp), %rdx
leaq -0x480(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x23400
jmp 0x19d6a
leaq -0x3e0(%rbp), %rdi
callq 0x108e0
leaq -0x438(%rbp), %rdi
leaq -0x458(%rbp), %rsi
leaq -0x480(%rbp), %rdx
callq 0x274d0
jmp 0x19d92
movq -0x498(%rbp), %rdi
leaq -0x438(%rbp), %rsi
callq 0x28110
jmp 0x19da7
leaq -0x438(%rbp), %rdi
callq 0x27fc0
leaq -0x480(%rbp), %rdi
callq 0x10460
leaq -0x481(%rbp), %rdi
callq 0x10770
leaq -0x458(%rbp), %rdi
callq 0x10460
leaq -0x459(%rbp), %rdi
callq 0x10770
movl $0x0, -0x254(%rbp)
movl $0x0, -0x250(%rbp)
movl $0x0, -0x24c(%rbp)
movl $0x0, -0x3e4(%rbp)
jmp 0x19f7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x19e8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x19e76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x19e6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x27fc0
leaq -0x480(%rbp), %rdi
callq 0x10460
leaq -0x481(%rbp), %rdi
callq 0x10770
leaq -0x458(%rbp), %rdi
callq 0x10460
leaq -0x459(%rbp), %rdi
callq 0x10770
jmp 0x1a02d
movsbl -0x245(%rbp), %eax
cmpl $0xd, %eax
jne 0x19eb0
jmp 0x19f7d
movsbl -0x245(%rbp), %eax
cmpl $0x9, %eax
jne 0x19f01
cmpl $0x0, -0x3e4(%rbp)
jne 0x19ed6
movslq -0x24c(%rbp), %rax
movb $0x0, -0x2e0(%rbp,%rax)
jmp 0x19ef0
cmpl $0x1, -0x3e4(%rbp)
jne 0x19eee
movslq -0x250(%rbp), %rax
movb $0x0, -0x360(%rbp,%rax)
jmp 0x19ef0
movl -0x3e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3e4(%rbp)
jmp 0x19f7b
cmpl $0x0, -0x3e4(%rbp)
jne 0x19f2c
movb -0x245(%rbp), %cl
movl -0x24c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x24c(%rbp)
cltq
movb %cl, -0x2e0(%rbp,%rax)
jmp 0x19f79
cmpl $0x1, -0x3e4(%rbp)
jne 0x19f57
movb -0x245(%rbp), %cl
movl -0x250(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x250(%rbp)
cltq
movb %cl, -0x360(%rbp,%rax)
jmp 0x19f77
movb -0x245(%rbp), %cl
movl -0x254(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x254(%rbp)
cltq
movb %cl, -0x3e0(%rbp,%rax)
jmp 0x19f79
jmp 0x19f7b
jmp 0x19f7d
jmp 0x19f7f
leaq -0x238(%rbp), %rdi
callq 0x10870
movl %eax, -0x4d4(%rbp)
jmp 0x19f93
movl -0x4d4(%rbp), %eax
movb %al, -0x245(%rbp)
jmp 0x19cbe
movq -0x498(%rbp), %rdi
movsd -0x18(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
movq -0x28(%rbp), %rsi
callq 0x187a0
jmp 0x19fc0
movq 0x116fd1(%rip), %rdi    # 0x130f98
leaq 0xa295c(%rip), %rsi     # 0xbc92a
callq 0x106c0
movq %rax, -0x4e0(%rbp)
jmp 0x19fdc
movq -0x498(%rbp), %rdi
callq 0x27750
movq -0x4e0(%rbp), %rdi
movq %rax, %rsi
callq 0x10190
movq %rax, -0x4e8(%rbp)
jmp 0x1a000
movq -0x4e8(%rbp), %rdi
leaq 0xa292e(%rip), %rsi     # 0xbc93c
callq 0x106c0
jmp 0x1a015
movb $0x1, -0x29(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x101b0
testb $0x1, -0x29(%rbp)
jne 0x1a047
jmp 0x1a03b
leaq -0x238(%rbp), %rdi
callq 0x101b0
jmp 0x1a057
movq -0x498(%rbp), %rdi
callq 0x27ff0
movq -0x4a0(%rbp), %rax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
movq -0x498(%rbp), %rdi
callq 0x27ff0
movq -0x240(%rbp), %rdi
callq 0x10cc0
nop