// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/seq.cpp
// Function: Seq_sp::Dna::makePeptide(char, unsigned char, bool, bool, unsigned long&) const
Peptide Dna::makePeptide (Frame frame,
                          Gencode gencode,
                          bool lowercasePossibleStartCodon,
                          bool firstStartCodon2M,
                          size_t &translationStart) const
{
  ASSERT (isFrame (frame));
  IMPLY (firstStartCodon2M, lowercasePossibleStartCodon);

  const string peptideName (getId () + ".fr" + to_string ((int) frame));
  const size_t frameOffset = (size_t) abs (frame) - 1;
  ASSERT (frameOffset <= 2);
  const size_t aaSeqLen = seq. size () >= 3 ? (seq. size () - frameOffset) / 3 : 0;

  Peptide peptide (peptideName, aaSeqLen, false);
  peptide. pseudo = true;

  // dna
  unique_ptr<Dna> compDna;
  if (frame < 0)
    compDna. reset (makeComplementary ());
  const Dna* dna = (frame < 0) ? compDna. get () : this;
  ASSERT (dna->seq. size () == seq. size ());
  
  translationStart = frame > 0 ? frameOffset : dna->seq. size () - frameOffset;

  const char* s = dna->seq. c_str () + frameOffset;
  FOR (size_t, j, aaSeqLen)
  {
    peptide. seq [j] = codon2aa (s, gencode, lowercasePossibleStartCodon);
    s += 3;
  }
  ASSERT (peptide. seq [aaSeqLen] == '\0');
  
  if (   ! peptide. seq. empty () 
      && firstStartCodon2M 
      && isLower (peptide. seq [0])
     )
  	peptide. seq [0] = 'm';

  return peptide;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %r9d, %ebp
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %rbx
callq 0xc070
movq %rax, 0x78(%rsp)
andl $0x0, (%rax)
leal 0x3(%r14), %eax
cmpl $0x6, %eax
ja 0x4af86
cmpl $0x3, %eax
je 0x4af86
movl %r12d, 0x84(%rsp)
xorb $0x1, %bpl
movl %ebp, %eax
orb %r15b, %al
je 0x4ac1b
movl %ebp, 0x80(%rsp)
leaq 0x58(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0xe516
leaq 0x18a9d(%rip), %rdx     # 0x63520
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0xe24f
movsbl %r14b, %ebp
leaq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0xe2d5
leaq 0x128(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0xe26e
leaq 0x18(%rsp), %rdi
callq 0xcbe8
leaq 0x38(%rsp), %rdi
callq 0xcbe8
leaq 0x58(%rsp), %rdi
callq 0xcbe8
movl %ebp, %r12d
negl %r12d
cmovsl %ebp, %r12d
decq %r12
movq 0x78(%rsp), %rax
andl $0x0, (%rax)
cmpq $0x3, %r12
jae 0x4acf8
movq 0x30(%r13), %rax
cmpq $0x3, %rax
jb 0x4ab0e
subq %r12, %rax
pushq $0x3
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
jmp 0x4ab10
xorl %ebp, %ebp
leaq 0x128(%rsp), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x5b288
movb $0x1, 0x49(%rbx)
testb %r14b, %r14b
js 0x4ab3c
movq $0x0, 0x10(%rsp)
movq %r13, %rax
jmp 0x4ab49
movq %r13, %rdi
callq 0x4a76c
movq %rax, 0x10(%rsp)
movq 0x78(%rsp), %rcx
andl $0x0, (%rcx)
movq 0x30(%rax), %rcx
cmpq 0x30(%r13), %rcx
jne 0x4add2
movl %r15d, %esi
subq %r12, %rcx
testb %r14b, %r14b
cmovgq %r12, %rcx
movq 0x180(%rsp), %rdx
movq %rcx, (%rdx)
addq 0x28(%rax), %r12
xorl %r15d, %r15d
movzbl 0x84(%rsp), %r14d
movzbl %sil, %r13d
cmpq %r15, %rbp
je 0x4abaf
movq %r12, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x496cb
movq 0x28(%rbx), %rcx
movb %al, (%rcx,%r15)
addq $0x3, %r12
incq %r15
jmp 0x4ab8b
movq 0x78(%rsp), %rax
andl $0x0, (%rax)
movq 0x28(%rbx), %rax
cmpb $0x0, (%rax,%rbp)
jne 0x4aeac
cmpq $0x0, 0x30(%rbx)
sete %cl
orb 0x80(%rsp), %cl
jne 0x4abe9
movsbl (%rax), %edi
callq 0x2a34d
testb %al, %al
je 0x4abe9
movq 0x28(%rbx), %rax
movb $0x6d, (%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4abf9
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x128(%rsp), %rdi
callq 0xcbe8
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xc6d0
testl %eax, %eax
jne 0x4b063
leaq 0x183e3(%rip), %rsi     # 0x63012
leaq 0xe8(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0xdbbe
leaq 0xc8(%rsp), %rdi
movl $0x7d4, %esi            # imm = 0x7D4
callq 0xe2d5
leaq 0x18(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0xe26e
leaq 0x1355a(%rip), %rdx     # 0x5e1d1
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe24f
leaq 0x1881a(%rip), %rsi     # 0x634a7
leaq 0x88(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x13c26(%rip), %rdx     # 0x5e8cc
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xe26e
leaq 0x1882b(%rip), %rdx     # 0x63504
leaq 0x128(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0x128(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x4b063
leaq 0x18306(%rip), %rsi     # 0x63012
leaq 0xc8(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0xa8(%rsp), %rdi
movl $0x7d8, %esi            # imm = 0x7D8
callq 0xe2d5
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xe26e
leaq 0x1347d(%rip), %rdx     # 0x5e1d1
leaq 0x18(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xe24f
leaq 0x1873a(%rip), %rsi     # 0x634a7
leaq 0x108(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x13b46(%rip), %rdx     # 0x5e8cc
leaq 0x88(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xe24f
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0xe26e
leaq 0x1876b(%rip), %rdx     # 0x63524
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x4b063
leaq 0x1822c(%rip), %rsi     # 0x63012
leaq 0xc8(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0xa8(%rsp), %rdi
movl $0x7e3, %esi            # imm = 0x7E3
callq 0xe2d5
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xe26e
leaq 0x133a3(%rip), %rdx     # 0x5e1d1
leaq 0x18(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xe24f
leaq 0x18660(%rip), %rsi     # 0x634a7
leaq 0x108(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x13a6c(%rip), %rdx     # 0x5e8cc
leaq 0x88(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xe24f
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0xe26e
leaq 0x186a2(%rip), %rdx     # 0x63535
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x4b063
leaq 0x18152(%rip), %rsi     # 0x63012
leaq 0xc8(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0xa8(%rsp), %rdi
movl $0x7ed, %esi            # imm = 0x7ED
callq 0xe2d5
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xe26e
leaq 0x132c9(%rip), %rdx     # 0x5e1d1
leaq 0x18(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xe24f
leaq 0x18586(%rip), %rsi     # 0x634a7
leaq 0x108(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xdbbe
leaq 0x13992(%rip), %rdx     # 0x5e8cc
leaq 0x88(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xe24f
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0xe26e
leaq 0x185ea(%rip), %rdx     # 0x63557
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x4b063
leaq 0x18078(%rip), %rsi     # 0x63012
leaq 0xe8(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0xdbbe
leaq 0xc8(%rsp), %rdi
movl $0x7d3, %esi            # imm = 0x7D3
callq 0xe2d5
leaq 0x18(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0xe26e
leaq 0x131ef(%rip), %rdx     # 0x5e1d1
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe24f
leaq 0x184af(%rip), %rsi     # 0x634a7
leaq 0x88(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xdbbe
leaq 0x138bb(%rip), %rdx     # 0x5e8cc
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xe26e
leaq 0x184b0(%rip), %rdx     # 0x634f4
leaq 0x128(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xe24f
leaq 0x128(%rsp), %rdi
callq 0x101d0
pushq $0x1
popq %rdi
callq 0xc6f0
jmp 0x4b0b9
jmp 0x4b0cb
jmp 0x4b105
jmp 0x4b142
jmp 0x4b07d
jmp 0x4b08c
movq %rax, %r15
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x4b08f
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x4b0e4
movq %rax, %r15
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x4b0ad
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x4b0f6
movq %rax, %r15
leaq 0x128(%rsp), %rdi
callq 0xcbe8
jmp 0x4b0ce
movq %rax, %r15
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x4b108
jmp 0x4b179
jmp 0x4b0e1
movq %rax, %r15
leaq 0x88(%rsp), %rdi
callq 0xcbe8
jmp 0x4b121
movq %rax, %r15
leaq 0x88(%rsp), %rdi
callq 0xcbe8
jmp 0x4b133
movq %rax, %r15
leaq 0xa8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b145
jmp 0x4b1b3
jmp 0x4b11e
movq %rax, %r15
leaq 0x108(%rsp), %rdi
callq 0xcbe8
jmp 0x4b15e
movq %rax, %r15
leaq 0x108(%rsp), %rdi
callq 0xcbe8
jmp 0x4b16d
movq %rax, %r15
leaq 0x88(%rsp), %rdi
callq 0xcbe8
jmp 0x4b17c
jmp 0x4b1ea
jmp 0x4b15b
movq %rax, %r15
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x4b192
movq %rax, %r15
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x4b1a4
movq %rax, %r15
leaq 0x58(%rsp), %rdi
callq 0xcbe8
jmp 0x4b1b6
jmp 0x4b222
jmp 0x4b18f
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b1c9
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b1db
movq %rax, %r15
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x4b1ed
jmp 0x4b235
jmp 0x4b1c6
movq %rax, %r15
leaq 0xa8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b201
movq %rax, %r15
leaq 0xa8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b213
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b225
jmp 0x4b1fe
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b26f
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
callq 0xcbe8
jmp 0x4b28a
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
jmp 0x4b292
jmp 0x4b26c
jmp 0x4b26c
jmp 0x4b23f
movq %rax, %r15
jmp 0x4b297
movq %rax, %r15
jmp 0x4b282
movq %rax, %r15
jmp 0x4b28a
movq %rax, %r15
leaq 0x18(%rsp), %rdi
callq 0xcbe8
jmp 0x4b256
movq %rax, %r15
leaq 0x38(%rsp), %rdi
callq 0xcbe8
jmp 0x4b265
movq %rax, %r15
leaq 0x58(%rsp), %rdi
jmp 0x4b292
movq %rax, %r15
cmpq $0x0, 0x10(%rsp)
je 0x4b282
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x5bd06
leaq 0x128(%rsp), %rdi
callq 0xcbe8
movq %r15, %rdi
callq 0xcaa0
nop