// File: /workspace/github_cpp_makefile_star2_O1/VanAndelInstitute[P]intent/src/seq_tools.cpp
// Function: v2_corrected_bc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, int)
std::string v2_corrected_bc(std::string bc, std::set<std::string> whitelist, int maxdist) {
  int mindist = 999;
  std::string best_candidate = "";
  bool ambig = false;
  for(auto cand : whitelist) {
    int dist = 999;
    if(((bc.length() - cand.length())^2) < 4)
      dist = levenshteinDistance(bc, cand, maxdist);
    if(dist < mindist) {
      mindist = dist;
      best_candidate = cand;
      ambig = false;
    } else if (dist == mindist) {
      ambig = true;
    }
  }
  if(mindist <= maxdist) {
    return(best_candidate);
  } else {
    return("");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x48(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2e44(%rip), %rdx      # 0x31439
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x1be64
movq 0x18(%r14), %r12
addq $0x8, %r14
cmpq %r14, %r12
movl %ebx, 0x24(%rsp)
je 0x2e6b2
movslq %ebx, %rax
movq %rax, 0x50(%rsp)
movl $0x3e7, %r13d           # imm = 0x3E7
leaq 0x28(%rsp), %rbp
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x1c224
movq 0x8(%r15), %rax
subq 0x30(%rsp), %rax
movl $0x3e7, %ebx            # imm = 0x3E7
cmpq $0x3, %rax
ja 0x2e66d
movq %r15, %rdi
movq %rbp, %rsi
movq 0x50(%rsp), %rdx
callq 0x2e792
movl %eax, %ebx
cmpl %r13d, %ebx
jge 0x2e680
movq %rsp, %rdi
movq %rbp, %rsi
callq 0x6230
movl %ebx, %r13d
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2e69c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x63c0
movq %r12, %rdi
callq 0x6470
movq %rax, %r12
cmpq %r14, %rax
jne 0x2e628
jmp 0x2e6b8
movl $0x3e7, %r13d           # imm = 0x3E7
movq 0x48(%rsp), %r14
leaq 0x10(%r14), %rax
movq %rax, (%r14)
cmpl 0x24(%rsp), %r13d
jle 0x2e6e4
leaq 0x2d67(%rip), %rdx      # 0x31439
movq %r14, %rdi
movq %rdx, %rsi
leaq 0x10(%rsp), %rbx
callq 0x1be64
jmp 0x2e721
movq (%rsp), %rcx
leaq 0x10(%rsp), %rbx
cmpq %rbx, %rcx
je 0x2e700
movq %rcx, (%r14)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%r14)
jmp 0x2e706
movups (%rbx), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x8(%r14)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x2e737
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x63c0
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2e74b
movq %rax, %rbx
jmp 0x2e76f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2e76f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x63c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e78a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x63c0
movq %rbx, %rdi
callq 0x6660