// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/seq.cpp
// Function: Seq_sp::Mutation::Mutation(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Mutation::Mutation (bool prot_arg,
                    const string& line)
: prot (prot_arg)
{ 
  string s (line);
  trim (s);
  
  const size_t dash_pos = s. find ('-');
  
  // geneName
  if (dash_pos != string::npos)
  {
    geneName = s. substr (0, dash_pos);
    QC_ASSERT (! geneName. empty ());
  }

  // ref, pos, allele
  const size_t refStart = dash_pos == string::npos ? 0 : (dash_pos + 1);
  size_t posStart = no_index;
  size_t alleleStart = no_index;
  FFOR_START (size_t, i, refStart, s. size ())
    if (isDigit (s [i]))
    {
      if (posStart == no_index)
        posStart = i;
    }
    else
    {
      if (posStart != no_index)
        if (alleleStart == no_index)
        {
          alleleStart = i;
          break;
        }
    }
  QC_ASSERT (refStart < posStart);
  QC_ASSERT (posStart < alleleStart);
  QC_ASSERT (alleleStart < s. size ());
  ref    =                s. substr (refStart, posStart - refStart);
  pos    = (size_t) stoi (s. substr (posStart, alleleStart - posStart));
  allele =                s. substr (alleleStart);
  QC_ASSERT (pos);
  pos--;

  // frameshift, ambig 
  if (prot)
  {
    if (ref == "ins")
      ref. clear ();
    if (allele == "del")
      allele. clear ();
    if (allele == "fs")
    {
      frameshift = true;
      allele. clear ();
    }
  #if 0
    for (const char c : allele)
      if (isAmbigAa (c))
        ambig = true;
  #endif
  }
  else
  {
    if (ref == "INS")
      ref. clear ();
    if (allele == "DEL")
      allele. clear ();
  #if 0
    for (const char c : allele)
      if (isAmbigNucl (c))
        ambig = true;
  #endif
  }
  
  setAmbig ();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %r12
leaq 0x33585(%rip), %rax     # 0x88b10
movq %rax, (%rdi)
movb %sil, 0x8(%rdi)
leaq 0x20(%rdi), %rax
movq %rax, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
leaq 0x10(%rdi), %r15
xorl %eax, %eax
movb %al, 0x20(%rdi)
orq $-0x1, 0x30(%rdi)
leaq 0x48(%rdi), %rcx
movq %rcx, 0x38(%rdi)
andq $0x0, 0x40(%rdi)
leaq 0x38(%rdi), %rcx
movq %rcx, 0x30(%rsp)
movb %al, 0x48(%rdi)
leaq 0x58(%rdi), %r14
leaq 0x68(%rdi), %rcx
movq %rcx, 0x58(%rdi)
andq $0x0, 0x60(%rdi)
movb %al, 0x68(%rdi)
andw $0x0, 0x78(%rdi)
leaq 0x120(%rsp), %rdi
movq %rdx, %rsi
movq %r14, 0x118(%rsp)
movq %r15, 0x140(%rsp)
callq 0xc7e0
leaq 0x120(%rsp), %rdi
callq 0x2a2c6
leaq 0x120(%rsp), %rdi
pushq $0x2d
popq %rsi
xorl %edx, %edx
callq 0xc790
movq %rax, %rbp
cmpq $-0x1, %rax
je 0x5566a
leaq 0x10(%rsp), %rdi
leaq 0x120(%rsp), %rsi
xorl %edx, %edx
movq %rbp, %rcx
callq 0xc5f0
leaq 0x10(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc710
movq %rbx, %rdi
callq 0xcbe8
callq 0xc070
andl $0x0, (%rax)
cmpq $0x0, 0x18(%r12)
je 0x55bc7
incq %rbp
pushq $-0x1
popq %r14
movq 0x128(%rsp), %rbx
movq %r14, %r13
movq %rbp, %r15
cmpq %rbx, %r15
jae 0x556bb
movq 0x120(%rsp), %rax
movsbl (%rax,%r15), %edi
callq 0x2a264
testb %al, %al
je 0x556a7
cmpq $-0x1, %r13
cmoveq %r15, %r13
movq %r13, %rax
jmp 0x556b0
movq %r14, %rax
cmpq $-0x1, %r13
jne 0x556b8
incq %r15
movq %rax, %r13
jmp 0x5567f
movq %r15, %r14
callq 0xc070
andl $0x0, (%rax)
movq %r13, %rcx
subq %rbp, %rcx
jbe 0x55877
movq %r14, %rbx
subq %r13, %rbx
jbe 0x5594b
cmpq 0x128(%rsp), %r14
jae 0x55a1f
movq %rax, %r15
leaq 0x10(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movq %rbp, %rdx
callq 0xc5f0
leaq 0x10(%rsp), %rbp
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0xc710
movq %rbp, %rdi
callq 0xcbe8
leaq 0x10(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0xc5f0
leaq 0x10(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x45c29
cltq
movq %rax, 0x30(%r12)
leaq 0x10(%rsp), %rdi
callq 0xcbe8
leaq 0x10(%rsp), %rdi
leaq 0x120(%rsp), %rsi
pushq $-0x1
popq %rcx
movq %r14, %rdx
callq 0xc5f0
leaq 0x10(%rsp), %rbx
movq 0x118(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc710
movq %rbx, %rdi
callq 0xcbe8
andl $0x0, (%r15)
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x55af3
decq %rax
movq %rax, 0x30(%r12)
cmpb $0x1, 0x8(%r12)
jne 0x5580c
leaq 0xc9d4(%rip), %rsi      # 0x62188
movq 0x30(%rsp), %rdi
callq 0x2a6be
testb %al, %al
je 0x557d0
andq $0x0, 0x40(%r12)
movq 0x38(%r12), %rax
movb $0x0, (%rax)
leaq 0xc8e9(%rip), %rsi      # 0x620c0
movq %r14, %rdi
callq 0x2a6be
testb %al, %al
je 0x557f1
andq $0x0, 0x60(%r12)
movq 0x58(%r12), %rax
movb $0x0, (%rax)
leaq 0xeb78(%rip), %rsi      # 0x64370
movq %r14, %rdi
callq 0x2a6be
testb %al, %al
je 0x55850
movb $0x1, 0x78(%r12)
jmp 0x55842
leaq 0xeb60(%rip), %rsi      # 0x64373
movq 0x30(%rsp), %rdi
callq 0x2a6be
testb %al, %al
je 0x5582f
andq $0x0, 0x40(%r12)
movq 0x38(%r12), %rax
movb $0x0, (%rax)
leaq 0xbec2(%rip), %rsi      # 0x616f8
movq %r14, %rdi
callq 0x2a6be
testb %al, %al
je 0x55850
andq $0x0, 0x60(%r12)
movq 0x58(%r12), %rax
movb $0x0, (%rax)
movq %r12, %rdi
callq 0x55dc4
leaq 0x120(%rsp), %rdi
callq 0xcbe8
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xc6d0
testl %eax, %eax
jne 0x55c9b
leaq 0xd787(%rip), %rsi      # 0x63012
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x78(%rsp), %rdi
movl $0x11b7, %esi           # imm = 0x11B7
callq 0xe2d5
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xe26e
leaq 0x8904(%rip), %rdx      # 0x5e1d1
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xe24f
leaq 0xe9fd(%rip), %rsi      # 0x642e6
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x8fcd(%rip), %rdx      # 0x5e8cc
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0xe9fd(%rip), %rdx      # 0x6432c
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe24f
leaq 0x10(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x55c9b
leaq 0xd6b3(%rip), %rsi      # 0x63012
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x78(%rsp), %rdi
movl $0x11b8, %esi           # imm = 0x11B8
callq 0xe2d5
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xe26e
leaq 0x8830(%rip), %rdx      # 0x5e1d1
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xe24f
leaq 0xe929(%rip), %rsi      # 0x642e6
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x8ef9(%rip), %rdx      # 0x5e8cc
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0xe93d(%rip), %rdx      # 0x64340
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe24f
leaq 0x10(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x55c9b
leaq 0xd5df(%rip), %rsi      # 0x63012
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x78(%rsp), %rdi
movl $0x11b9, %esi           # imm = 0x11B9
callq 0xe2d5
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xe26e
leaq 0x875c(%rip), %rdx      # 0x5e1d1
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xe24f
leaq 0xe855(%rip), %rsi      # 0x642e6
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x8e25(%rip), %rdx      # 0x5e8cc
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0xe880(%rip), %rdx      # 0x64357
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe24f
leaq 0x10(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x55c9b
leaq 0xd50b(%rip), %rsi      # 0x63012
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x78(%rsp), %rdi
movl $0x11bd, %esi           # imm = 0x11BD
callq 0xe2d5
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xe26e
leaq 0x8688(%rip), %rdx      # 0x5e1d1
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xe24f
leaq 0xe781(%rip), %rsi      # 0x642e6
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x8d51(%rip), %rdx      # 0x5e8cc
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0x9d8b(%rip), %rdx      # 0x5f936
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe24f
leaq 0x10(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x55c9b
leaq 0xd437(%rip), %rsi      # 0x63012
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x78(%rsp), %rdi
movl $0x11a1, %esi           # imm = 0x11A1
callq 0xe2d5
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xe26e
leaq 0x85b4(%rip), %rdx      # 0x5e1d1
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xe24f
leaq 0xe6ad(%rip), %rsi      # 0x642e6
leaq 0x38(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x8c7d(%rip), %rdx      # 0x5e8cc
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0xe698(%rip), %rdx      # 0x64317
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe24f
leaq 0x10(%rsp), %rdi
callq 0x101d0
pushq $0x1
popq %rdi
callq 0xc6f0
jmp 0x55cb3
jmp 0x55cc2
jmp 0x55cb3
jmp 0x55cc2
jmp 0x55cb3
jmp 0x55cc2
jmp 0x55cb3
jmp 0x55cc2
movq %rax, %r12
leaq 0x10(%rsp), %rdi
callq 0xcbe8
jmp 0x55cc5
movq %rax, %r12
leaq 0xf8(%rsp), %rdi
callq 0xcbe8
jmp 0x55cdf
jmp 0x55cdc
jmp 0x55cdc
jmp 0x55cdc
jmp 0x55cdc
movq %rax, %r12
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x55cf6
jmp 0x55cf3
jmp 0x55cf3
jmp 0x55cf3
jmp 0x55cf3
movq %rax, %r12
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x55d0d
jmp 0x55d0a
jmp 0x55d0a
jmp 0x55d0a
jmp 0x55d0a
movq %rax, %r12
leaq 0xd8(%rsp), %rdi
callq 0xcbe8
jmp 0x55d27
jmp 0x55d24
jmp 0x55d24
jmp 0x55d24
jmp 0x55d24
movq %rax, %r12
leaq 0xb8(%rsp), %rdi
callq 0xcbe8
jmp 0x55d41
jmp 0x55d3e
jmp 0x55d3e
jmp 0x55d3e
jmp 0x55d3e
movq %rax, %r12
leaq 0x78(%rsp), %rdi
callq 0xcbe8
jmp 0x55d58
jmp 0x55d55
jmp 0x55d55
jmp 0x55d55
jmp 0x55d55
movq %rax, %r12
leaq 0x98(%rsp), %rdi
jmp 0x55d78
jmp 0x55d83
jmp 0x55d83
jmp 0x55d83
jmp 0x55d83
jmp 0x55d83
jmp 0x55d83
jmp 0x55d83
movq %rax, %r12
leaq 0x10(%rsp), %rdi
callq 0xcbe8
jmp 0x55d86
jmp 0x55d83
jmp 0x55d83
movq %rax, %r12
leaq 0x120(%rsp), %rdi
callq 0xcbe8
movq 0x118(%rsp), %rdi
callq 0xcbe8
movq 0x30(%rsp), %rdi
callq 0xcbe8
movq 0x140(%rsp), %rdi
callq 0xcbe8
movq %r12, %rdi
callq 0xcaa0
movq %rax, %r12
jmp 0x55d93