// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/seq.cpp
// Function: Seq_sp::codon2aa(char const*, unsigned char, bool)
char codon2aa (const char codon [3],
               Gencode gencode,
               bool lowercasePossibleStartCodon)
{
  char c [3];
  FOR (size_t, i, 3)
    c [i] = toLower (codon [i]);


  char aa = 'X';
  switch (c [0])
  {
    case 't':
     	switch (c [1])
   	  {
   	    case 't':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'F';
      		  Case 'a': case 'g': case 'r': aa = 'L';
      		}
   	    Case 'c':                         aa = 'S'; 
   	    Case 'a':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'Y';
      		  Case 'a': case 'g': case 'r': aa = *terminator;
      		}
   	    Case 'g':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'C';
      		  Case 'a': 
      		    switch (gencode)
      		    {
      		      case 4: case 25:          aa = 'W';
      		      Default:                  aa = *terminator;
      		    }
      		  Case 'g':                     aa = 'W';
      		}
   	    Case 'r':
   	      if (c [2] == 'a')          aa = *terminator;
   	  }
    Case 'c':
     	switch (c [1])
   	  {
   	    case 't':                         aa = 'L';
   	    Case 'c':                         aa = 'P';
   	    Case 'a':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'H';
      		  Case 'a': case 'g': case 'r': aa = 'Q';
      		}
   	    Case 'g':                         aa = 'R';
   	  }
    Case 'a':
     	switch (c [1])
   	  {
   	    case 't':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'a':
      		  case 'y': case 'w': case 'm':
      		  case 'h':                     aa = 'I';
      		  Case 'g':                     aa = 'M'; 
      		}
   	    Case 'c':                         aa = 'T';
   	    Case 'a':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'N';
      		  Case 'a': case 'g': case 'r': aa = 'K';
      		}
   	    Case 'g':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'S';
      		  Case 'a': case 'g': case 'r': aa = 'R';
      		}
   	  }
    Case 'g':
     	switch (c [1])
   	  {
   	    case 't':                         aa = 'V';
   	    Case 'c':                         aa = 'A';
   	    Case 'a':
   	      switch (c [2])
      		{
      		  case 't': case 'c': case 'y': aa = 'D';
      		  Case 'a': case 'g': case 'r': aa = 'E';
      		}
   	    Case 'g':                         aa = 'G';
   	  }
    Case 'm':
      if (c [1] == 'g' &&
          charInSet (c [2], "agr"))  aa = 'R';
    Case 'r':
      if (c [1] == 'a' &&
          charInSet (c [2], "tcy"))  aa = 'B';
    Case 's':
      if (c [1] == 'a' &&
          charInSet (c [2], "agr"))  aa = 'Z';
    Case 'y':
      if (c [1] == 't' &&
          charInSet (c [2], "agr"))  aa = 'L';
  }
  ASSERT (charInSet (aa, extTermPeptideAlphabet));
  
  
  if (lowercasePossibleStartCodon)
  {
    bool startcodon = false;
    switch (gencode)
    {
      case  1: if (    c[0] == 'a' && c[1] == 't' && c[2] == 'g' )  startcodon = true;
      Case  4: if (   (               c[1] == 't' && c[2] == 'g')
                   || (c[0] == 'a' && c[1] == 't'               )
                   || (c[0] == 't' && c[1] == 't' && c[2] == 'a'))  startcodon = true;
      Case 11: if (                  (c[1] == 't' && c[2] == 'g')
                   || (c[0] == 'a' && c[1] == 't')               )  startcodon = true;  
      Case 25: if (    c[0] != 'c' && c[1] == 't' && c[2] == 'g' )  startcodon = true;
      Default: throw runtime_error (FUNC "Genetic code " + to_string ((int) gencode) + " is not implemented");
    }
    if (startcodon)
      aa = toLower (aa);
  }


  return aa;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %r13d
movl %esi, %r12d
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x3, %r14
je 0x49702
movsbl (%rbx,%r14), %edi
callq 0x2a336
movb %al, 0xe(%rsp,%r14)
incq %r14
jmp 0x496e8
movb 0xe(%rsp), %al
movb %al, 0x11(%rsp)
movzbl %al, %eax
movb $0x58, %r15b
leal -0x72(%rax), %ecx
movzbl %r12b, %ebp
pushq $0x58
popq %rbx
cmpl $0x7, %ecx
movl %r12d, 0x14(%rsp)
jbe 0x49795
cmpl $0x61, %eax
je 0x498fc
cmpl $0x63, %eax
je 0x4998c
cmpl $0x67, %eax
je 0x49958
movl %r13d, %r14d
cmpl $0x6d, %eax
jne 0x49b2e
cmpb $0x67, 0xf(%rsp)
jne 0x49b2e
movsbl 0x10(%rsp), %r15d
leaq 0x19bc6(%rip), %rsi     # 0x63329
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0xdbbe
movl %r15d, %edi
movq %r12, %rsi
callq 0x2a35c
movl %eax, %r15d
movq %r12, %rdi
callq 0xcbe8
testb %r15b, %r15b
pushq $0x52
jmp 0x49837
leaq 0x196d0(%rip), %rax     # 0x62e6c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl %r13d, %r14d
cmpb $0x61, 0xf(%rsp)
jne 0x49b2e
movsbl 0x10(%rsp), %r15d
leaq 0x19b6d(%rip), %rsi     # 0x6332d
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0xdbbe
movl %r15d, %edi
movq %r12, %rsi
callq 0x2a35c
movl %eax, %r15d
movq %r12, %rdi
callq 0xcbe8
testb %r15b, %r15b
pushq $0x42
jmp 0x49837
movl %r13d, %r14d
cmpb $0x74, 0xf(%rsp)
jne 0x49b2e
movsbl 0x10(%rsp), %r15d
leaq 0x19b1f(%rip), %rsi     # 0x63329
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0xdbbe
movl %r15d, %edi
movq %r12, %rsi
callq 0x2a35c
movl %eax, %r15d
movq %r12, %rdi
callq 0xcbe8
testb %r15b, %r15b
pushq $0x4c
popq %rax
cmovnel %eax, %ebx
movl %ebx, %r15d
jmp 0x49b2e
movzbl 0xf(%rsp), %eax
cmpl $0x61, %eax
je 0x49afe
cmpl $0x63, %eax
je 0x49ab9
cmpl $0x67, %eax
je 0x49ad0
cmpl $0x72, %eax
je 0x49ac1
cmpl $0x74, %eax
jne 0x49b2b
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x499b4
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jae 0x49b2e
movb $0x46, %r15b
jmp 0x49b2e
movl %r13d, %r14d
cmpb $0x61, 0xf(%rsp)
jne 0x49b2e
movsbl 0x10(%rsp), %r15d
leaq 0x19a61(%rip), %rsi     # 0x63329
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0xdbbe
movl %r15d, %edi
movq %r12, %rsi
callq 0x2a35c
movl %eax, %r15d
movq %r12, %rdi
callq 0xcbe8
addb %r15b, %r15b
orb $0x58, %r15b
jmp 0x49b2e
movzbl 0xf(%rsp), %eax
cmpl $0x61, %eax
je 0x49a00
cmpl $0x63, %eax
je 0x499bc
cmpl $0x67, %eax
je 0x499c7
cmpl $0x74, %eax
jne 0x49b2b
movzbl 0x10(%rsp), %eax
leal -0x61(%rax), %ecx
movl %r13d, %r14d
cmpl $0x7, %ecx
jbe 0x49c37
addl $-0x6d, %eax
cmpl $0xc, %eax
ja 0x49b2e
movl $0x1481, %ecx           # imm = 0x1481
btl %eax, %ecx
jb 0x49c47
jmp 0x49b2e
movzbl 0xf(%rsp), %eax
cmpl $0x61, %eax
je 0x49a50
movl %r13d, %r14d
cmpl $0x63, %eax
je 0x49a38
cmpl $0x67, %eax
je 0x49a48
cmpl $0x74, %eax
jne 0x49b2e
movb $0x56, %r15b
jmp 0x49b2e
movzbl 0xf(%rsp), %eax
cmpl $0x61, %eax
je 0x49a88
movl %r13d, %r14d
cmpl $0x63, %eax
je 0x49a40
cmpl $0x67, %eax
je 0x499f8
cmpl $0x74, %eax
jne 0x49b2e
movb $0x4c, %r15b
jmp 0x49b2e
movl %r13d, %r14d
movb $0x54, %r15b
jmp 0x49b2e
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x499f8
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jb 0x49abc
jmp 0x49b2e
movb $0x52, %r15b
jmp 0x49b2e
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x49c4f
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jae 0x49b2e
movb $0x4e, %r15b
jmp 0x49b2e
movb $0x41, %r15b
jmp 0x49b2e
movb $0x50, %r15b
jmp 0x49b2e
movb $0x47, %r15b
jmp 0x49b2e
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x49c57
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jae 0x49b2e
movb $0x44, %r15b
jmp 0x49b2e
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x49c5f
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jae 0x49b2e
movb $0x48, %r15b
jmp 0x49b2e
movl %r13d, %r14d
movb $0x53, %r15b
jmp 0x49b2e
movl %r13d, %r14d
cmpb $0x61, 0x10(%rsp)
jne 0x49b2e
jmp 0x49c85
movzbl 0x10(%rsp), %eax
movl %r13d, %r14d
cmpl $0x61, %eax
je 0x49c6f
cmpl $0x63, %eax
je 0x49af9
cmpl $0x67, %eax
je 0x49c67
cmpl $0x79, %eax
je 0x49af9
cmpl $0x74, %eax
jne 0x49b2e
movb $0x43, %r15b
jmp 0x49b2e
movzbl 0x10(%rsp), %eax
addl $-0x61, %eax
cmpl $0x18, %eax
ja 0x49b2b
movl %r13d, %r14d
movl $0x20041, %ecx          # imm = 0x20041
btl %eax, %ecx
jb 0x49c85
movl $0x1080004, %ecx        # imm = 0x1080004
btl %eax, %ecx
jae 0x49b2e
movb $0x59, %r15b
jmp 0x49b2e
movl %r13d, %r14d
callq 0xc070
andl $0x0, (%rax)
movq 0x400db(%rip), %rsi     # 0x89c18
leaq 0x38(%rsp), %r13
leaq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0xdbbe
movsbl %r15b, %r12d
movl %r12d, %edi
movq %r13, %rsi
callq 0x2a35c
movl %eax, %ebx
movq %r13, %rdi
callq 0xcbe8
testb %bl, %bl
je 0x49c9c
testb %r14b, %r14b
je 0x49c22
cmpb $0x19, 0x14(%rsp)
je 0x49bc3
cmpl $0x4, %ebp
je 0x49bda
movl %ebp, %eax
cmpl $0xb, %ebp
je 0x49ba1
cmpl $0x1, %eax
jne 0x49d78
cmpb $0x61, 0x11(%rsp)
je 0x49bca
jmp 0x49c22
cmpb $0x74, 0xf(%rsp)
sete %al
cmpb $0x67, 0x10(%rsp)
sete %cl
cmpb $0x61, 0x11(%rsp)
sete %dl
testb %al, %dl
jne 0x49c17
andb %cl, %al
je 0x49c22
jmp 0x49c17
cmpb $0x63, 0x11(%rsp)
je 0x49c22
cmpb $0x74, 0xf(%rsp)
jne 0x49c22
cmpb $0x67, 0x10(%rsp)
je 0x49c17
jmp 0x49c22
movb 0xf(%rsp), %cl
movb 0x10(%rsp), %al
cmpb $0x74, %cl
sete %dl
cmpb $0x67, %al
sete %sil
andb %dl, %sil
movb 0x11(%rsp), %r8b
cmpb $0x61, %r8b
sete %dil
andb %dl, %dil
orb %sil, %dil
jne 0x49c17
xorb $0x74, %cl
xorb $0x74, %r8b
orb %cl, %r8b
xorb $0x61, %al
orb %r8b, %al
jne 0x49c22
movl %r12d, %edi
callq 0x2a336
movl %eax, %r15d
movl %r15d, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1924e(%rip), %rax     # 0x62e8c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movb $0x49, %r15b
jmp 0x49b2e
movb $0x4b, %r15b
jmp 0x49b2e
movb $0x45, %r15b
jmp 0x49b2e
movb $0x51, %r15b
jmp 0x49b2e
movb $0x57, %r15b
jmp 0x49b2e
movb $0x57, %r15b
cmpb $0x4, %r12b
je 0x49b2e
cmpl $0x19, %ebp
je 0x49b2e
movq 0x3ff84(%rip), %rax     # 0x89c10
movb (%rax), %r15b
jmp 0x49b2e
movb $0x4d, %r15b
jmp 0x49b2e
callq 0xc6d0
testl %eax, %eax
jne 0x49d70
leaq 0x19362(%rip), %rsi     # 0x63012
leaq 0x58(%rsp), %rdi
leaq 0x13(%rsp), %rdx
callq 0xdbbe
leaq 0xb8(%rsp), %rdi
movl $0x52e, %esi            # imm = 0x52E
callq 0xe2d5
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0xe26e
leaq 0x144e2(%rip), %rdx     # 0x5e1d1
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xe24f
leaq 0x19629(%rip), %rsi     # 0x63331
leaq 0xd8(%rsp), %rdi
leaq 0x12(%rsp), %rdx
callq 0xdbbe
leaq 0x14bab(%rip), %rdx     # 0x5e8cc
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xe24f
leaq 0x18(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0xe26e
leaq 0x1960d(%rip), %rdx     # 0x63364
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
callq 0x101d0
pushq $0x1
popq %rdi
callq 0xc6f0
pushq $0x10
popq %rdi
callq 0xc310
movq %rax, %r14
leaq 0x195a7(%rip), %rsi     # 0x63331
leaq 0x78(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0xdbbe
leaq 0x195e8(%rip), %rdx     # 0x6338b
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xe24f
leaq 0x58(%rsp), %rdi
movl %ebp, %esi
callq 0xe2d5
leaq 0x18(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xe26e
leaq 0x14366(%rip), %rdx     # 0x5e145
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe24f
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0xc990
xorl %ebp, %ebp
movq 0x3f1e9(%rip), %rsi     # 0x88ff0
movq 0x3f15a(%rip), %rdx     # 0x88f68
movq %r14, %rdi
callq 0xca40
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x49e28
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x49e58
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x49e49
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x49e6d
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0xcbe8
jmp 0x49e7c
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x49e91
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0xcbe8
jmp 0x49ea3
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x98(%rsp), %rdi
callq 0xcbe8
jmp 0x49eb8
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xcbe8
jmp 0x49ecc
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x78(%rsp), %rdi
callq 0xcbe8
testb %bpl, %bpl
jne 0x49edb
jmp 0x49f09
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xcbe8
jmp 0x49ee8
movq %rax, %rbx
movq %r14, %rdi
callq 0xc470
jmp 0x49f09
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xcbe8
jmp 0x49efa
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x49f09
movq %rax, %rbx
movq %rbx, %rdi
callq 0xcaa0
nop