// File: millanek[P]evo/process_vcf_coding_sequences.cpp
// Function: codingSequenceErrorChecks(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::vector<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>>>>, std::allocator<std::vector<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>>>>>> const&, int, std::basic_ofstream<char, std::char_traits<char>>*&)
bool codingSequenceErrorChecks(const string& geneSeq, const string& transcriptName, const std::vector<std::vector<string> >& annotation, const int k, std::ofstream*& badStartStopCodonFile) {
    string::size_type l = geneSeq.length();
    bool divisibleByThree = true;
    if (l % 3 != 0) {
#ifdef DEBUG2
        std::cerr << "Error!!! The length of the gene: " << transcriptName << " is not divisible by three (" << l << ") composed of " << annotation[k].size() << " coding sequences" << std::endl;
        for (std::vector<std::string>::size_type j = 0; j != annotation[k].size(); j++) {
            std::cerr << annotation[k][j] << std::endl;
        }
#endif
        divisibleByThree = false;
    }
    if (!(geneSeq[0] == 'A' && geneSeq[1] == 'T' && geneSeq[2] == 'G')) {
        std::cerr << "Possible error!!! The coding sequence of the gene: " << transcriptName << " does not start with ATG (start codon). Maybe a SNP? Or an annotation error..." << std::endl;
        *badStartStopCodonFile << transcriptName << "\t" << "start" << "\t" << geneSeq.substr(0,3) << std::endl;
    }
    if (geneSeq[l-3] != 'T' && ((geneSeq[l-2] == 'A' && geneSeq[l-1] == 'G') || (geneSeq[l-2] == 'A' && geneSeq[l-1] == 'A') || (geneSeq[l-2] == 'G' && geneSeq[l-1] == 'A'))) {
        std::cerr << "Possible error!!! The coding sequence of the gene: " << transcriptName << " does not end with TAG,TAA, or TGA (stop codons). Maybe a SNP? Or an annotation error..." << std::endl;
        *badStartStopCodonFile << transcriptName << "\t" << "stop" << "\t" << geneSeq.substr(l-3,3) << std::endl;
    }
    return divisibleByThree;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa930
movq %rax, -0x30(%rbp)
movb $0x1, -0x31(%rbp)
movq -0x30(%rbp), %rax
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
je 0xb29f7
movb $0x0, -0x31(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xb2a3c
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x54, %eax
jne 0xb2a3c
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x47, %eax
je 0xb2b37
movq 0xe65ad(%rip), %rdi     # 0x198ff0
leaq 0x8e30d(%rip), %rsi     # 0x140d57
callq 0xa5c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0xa520
movq %rax, %rdi
leaq 0x8e326(%rip), %rsi     # 0x140d8b
callq 0xa5c0
movq %rax, %rdi
movq 0xe6514(%rip), %rsi     # 0x198f88
callq 0xa610
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xa520
movq %rax, %rdi
leaq 0x8344b(%rip), %rsi     # 0x135ede
movq %rsi, -0xa8(%rbp)
callq 0xa5c0
movq %rax, %rdi
leaq 0x8e331(%rip), %rsi     # 0x140dda
callq 0xa5c0
movq -0xa8(%rbp), %rsi
movq %rax, %rdi
callq 0xa5c0
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x58(%rbp), %rdi
movq %rdi, -0x98(%rbp)
movl $0x3, %ecx
callq 0xa5f0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0xa520
movq %rax, -0x90(%rbp)
jmp 0xb2afd
movq -0x90(%rbp), %rdi
movq 0xe647d(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xb2b12
leaq -0x58(%rbp), %rdi
callq 0xac88
jmp 0xb2b37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xac88
jmp 0xb2d05
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x3, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x54, %eax
je 0xb2cf7
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x2, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xb2b86
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x47, %eax
je 0xb2bf2
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x2, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xb2bb8
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x41, %eax
je 0xb2bf2
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x2, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x47, %eax
jne 0xb2cf7
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xb2cf7
movq 0xe63f7(%rip), %rdi     # 0x198ff0
leaq 0x8e157(%rip), %rsi     # 0x140d57
callq 0xa5c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0xa520
movq %rax, %rdi
leaq 0x8e1c5(%rip), %rsi     # 0x140de0
callq 0xa5c0
movq %rax, %rdi
movq 0xe635e(%rip), %rsi     # 0x198f88
callq 0xa610
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xa520
movq %rax, %rdi
leaq 0x83295(%rip), %rsi     # 0x135ede
movq %rsi, -0xc8(%rbp)
callq 0xa5c0
movq %rax, %rdi
leaq 0x8df4f(%rip), %rsi     # 0x140bae
callq 0xa5c0
movq -0xc8(%rbp), %rsi
movq %rax, %rdi
callq 0xa5c0
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $-0x3, %rdx
leaq -0x88(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
movl $0x3, %ecx
callq 0xa5f0
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0xa520
movq %rax, -0xb0(%rbp)
jmp 0xb2cba
movq -0xb0(%rbp), %rdi
movq 0xe62c0(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xb2ccf
leaq -0x88(%rbp), %rdi
callq 0xac88
jmp 0xb2cf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xac88
jmp 0xb2d05
movb -0x31(%rbp), %al
andb $0x1, %al
addq $0xd0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0xab50
nop