// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/cds_visitor.c
// Function: add_cds_if_necessary
static int add_cds_if_necessary(GtFeatureNode *fn, void *data, GtError *err)
{
  GtCDSVisitor *v = (GtCDSVisitor*) data;
  int had_err;

  gt_error_check(err);
  gt_assert(fn);

  had_err = extract_spliced_seq(fn, v, err);
  if (!had_err && gt_splicedseq_length(v->splicedseq) > 2) {
    GtArray *orfs;

    if (gt_feature_node_get_strand(fn) == GT_STRAND_REVERSE) {
      if (gt_splicedseq_reverse(v->splicedseq, err))
        return -1;
    }

    orfs = determine_ORFs_for_all_three_frames(v->splicedseq, v->start_codon,
                                               v->final_stop_codon,
                                               v->generic_start_codons);
    if (!orfs)
      had_err = -1;
    if (!had_err)
      create_CDS_features_for_longest_ORF(orfs, v, fn);
    gt_array_delete(orfs);
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
testq %rdx, %rdx
je 0xd99ff
movq %r15, %rdi
callq 0x34fea
testb %al, %al
jne 0xda142
testq %rbx, %rbx
je 0xda138
movq %r15, %rdi
callq 0x34fea
testb %al, %al
je 0xd9a08
callq 0x32c66
testq %rbx, %rbx
je 0xda138
testq %r14, %r14
je 0xda13d
movq 0x20(%r14), %rdi
callq 0xdc02e
leaq 0x73a(%rip), %rdx       # 0xda15b
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x40831
movl %eax, %ebp
testl %eax, %eax
jne 0xda124
movq 0x20(%r14), %rdi
callq 0xdbfad
xorl %ebp, %ebp
cmpq $0x3, %rax
jb 0xda124
movq %rbx, %rdi
callq 0x3f462
cmpl $0x1, %eax
jne 0xd9a74
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdbfc0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xda124
movq %rbx, 0x10(%rsp)
movq 0x20(%r14), %r15
testq %r15, %r15
je 0xda147
movb 0x38(%r14), %al
movb %al, 0x38(%rsp)
movb 0x39(%r14), %al
movb %al, 0xc(%rsp)
movb 0x3a(%r14), %bl
movq %r15, %rdi
callq 0xdbe7d
movq %rax, %r12
movq %r15, %rdi
callq 0xdbfad
xorl %r13d, %r13d
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xa393d
movq %rax, %r15
callq 0x3b728
movq %rax, 0x18(%rsp)
movq %rax, 0x50(%rsp)
callq 0x3b728
movq %rax, 0x28(%rsp)
movq %rax, 0x58(%rsp)
callq 0x3b728
movq %rax, %r12
movq %rax, 0x60(%rsp)
movl $0x0, %ebp
movl $0x0, %eax
testb %bl, %bl
je 0xd9b0e
callq 0x3b728
movq %rax, %r13
callq 0x3b728
movq %rax, %rbp
callq 0x3b728
movq %r12, 0x90(%rsp)
movq %r13, 0x48(%rsp)
movq %r13, 0x70(%rsp)
movq %rbp, 0x40(%rsp)
movq %rbp, 0x78(%rsp)
movq %rax, 0x98(%rsp)
movq %rax, 0x80(%rsp)
testq %r15, %r15
je 0xda14c
movq %r15, 0xa0(%rsp)
movq %r15, %rdi
callq 0xa64b3
movq %rax, %r15
leaq 0xb(%rsp), %r12
leaq 0x34(%rsp), %rbp
leaq 0xa(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa681c
testl %eax, %eax
jne 0xd9baf
movl 0x34(%rsp), %eax
movq 0x50(%rsp,%rax,8), %rdi
movsbl 0xb(%rsp), %esi
callq 0x3b9df
testb %bl, %bl
je 0xd9b65
movl 0x34(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rdi
movzbl 0xa(%rsp), %esi
shll $0x5, %esi
addl $0x2d, %esi
callq 0x3b9df
jmp 0xd9b65
cmpl $-0x2, %eax
jne 0xd9bc9
xorl %r12d, %r12d
movq 0x10(%rsp), %rbx
movq 0x90(%rsp), %rbp
jmp 0xd9d0f
movl $0x10, %edi
callq 0x6ef7c
movq %rax, %r12
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x3bb5d
movq %rax, %r13
movq %rbp, %rdi
callq 0x3bb86
movq %rax, %rbp
testb %bl, %bl
movq %r12, 0x20(%rsp)
je 0xd9c06
movq 0x48(%rsp), %rdi
callq 0x3bb5d
jmp 0xd9c08
xorl %eax, %eax
subq $0x8, %rsp
movzbl 0x14(%rsp), %r10d
movzbl 0x40(%rsp), %r9d
leaq 0x635(%rip), %rdi       # 0xda254
xorl %r12d, %r12d
movq 0x28(%rsp), %rsi
xorl %edx, %edx
movq %r13, %rcx
movq %rbp, %r8
movl %r9d, 0x14(%rsp)
pushq %rax
pushq $0x0
movq %r10, 0x50(%rsp)
pushq %r10
callq 0xdf3e8
addq $0x20, %rsp
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0x3bb5d
movq %rax, %r13
movq %rbp, %rdi
callq 0x3bb86
movq %rax, %rbp
testb %bl, %bl
je 0xd9c73
movq 0x40(%rsp), %rdi
callq 0x3bb5d
movq %rax, %r12
subq $0x8, %rsp
leaq 0x5d6(%rip), %rdi       # 0xda254
movq 0x28(%rsp), %rsi
movl $0x1, %edx
movq %r13, %rcx
movq %rbp, %r8
movl 0x14(%rsp), %r9d
pushq %r12
pushq $0x0
pushq 0x50(%rsp)
callq 0xdf3e8
addq $0x20, %rsp
movq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0x3bb5d
movq %rax, %r12
movq %rbp, %rdi
callq 0x3bb86
movq %rax, %r13
testb %bl, %bl
je 0xd9cd5
movq 0x98(%rsp), %rdi
callq 0x3bb5d
jmp 0xd9cd7
xorl %eax, %eax
movq 0x10(%rsp), %rbx
subq $0x8, %rsp
leaq 0x56d(%rip), %rdi       # 0xda254
movq 0x28(%rsp), %rsi
movl $0x2, %edx
movq %r12, %rcx
movq %rsi, %r12
movq %r13, %r8
movl 0x14(%rsp), %r9d
pushq %rax
pushq $0x0
pushq 0x50(%rsp)
callq 0xdf3e8
addq $0x20, %rsp
movq 0x98(%rsp), %rdi
callq 0x3c87b
movq 0x40(%rsp), %rdi
callq 0x3c87b
movq 0x48(%rsp), %rdi
callq 0x3c87b
movq %rbp, %rdi
callq 0x3c87b
movq 0x28(%rsp), %rdi
callq 0x3c87b
movq 0x18(%rsp), %rdi
callq 0x3c87b
movq %r15, %rdi
callq 0xa68f6
movq 0xa0(%rsp), %rdi
callq 0xa374e
xorl %ebp, %ebp
testq %r12, %r12
sete %r15b
je 0xda117
movq %r12, %rdi
callq 0x6f310
testq %rax, %rax
je 0xda117
movq %r12, %rdi
callq 0x7ea5a
movq %r12, %rdi
callq 0x6f054
movq %rax, %rdi
callq 0x7e19f
movl 0x10(%r14), %ecx
leal (%rcx,%rcx,2), %ecx
cmpq %rcx, %rax
jb 0xda117
movb %r15b, 0x40(%rsp)
movq %r12, 0x20(%rsp)
movq %r12, %rdi
callq 0x6f054
movups (%rax), %xmm0
leaq 0x50(%rsp), %r15
movaps %xmm0, (%r15)
movq %rbx, %rdi
callq 0x3f462
movl %eax, %r13d
movq %r15, %rdi
callq 0x7e19f
cmpq $0x2, %rax
jbe 0xda156
movq %rbx, %r12
movq 0x20(%r14), %rdi
testl %r13d, %r13d
leaq 0x58(%rsp), %rcx
movq %rcx, %rax
cmoveq %r15, %rax
movq (%rax), %rsi
cmoveq %rcx, %r15
callq 0xdbf58
movq %rax, %rbp
movq 0x20(%r14), %rdi
addq 0x30(%r14), %rbp
movq (%r15), %rsi
callq 0xdbf58
movq %rax, %r15
addq 0x30(%r14), %r15
movl $0x8, %edi
callq 0x6ef7c
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x415a1
movq %rax, %rbx
movq %r12, %rdi
callq 0x3f462
leaq 0xb386(%rip), %rsi      # 0xe51cf
movq %rbx, %rdi
movq %rbp, %rdx
movq %r15, %rcx
movl %eax, %r8d
callq 0x3f280
movq %rax, %rbx
movq %rax, 0x70(%rsp)
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x3ef41
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3efa4
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
callq 0x3fb1b
testl %r13d, %r13d
leaq 0x58(%rsp), %rcx
movq -0x8(%rcx), %rax
movq (%rcx), %rsi
movq %rsi, %r15
cmoveq %rax, %r15
xorl %ecx, %ecx
cmpq %rsi, %r15
setb %cl
xorl %edx, %edx
cmpq %rax, %r15
seta %dl
testl %r13d, %r13d
cmovel %ecx, %edx
cmpb $0x1, %dl
jne 0xda011
movq %r12, %rbx
xorl %ebp, %ebp
movl %r13d, %eax
negl %eax
sbbq %rbp, %rbp
orq $0x1, %rbp
movl %r13d, %r12d
movq %rbp, 0x48(%rsp)
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdbe85
testb %al, %al
je 0xd9fdf
movq 0x70(%rsp), %r13
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdbf58
addq 0x30(%r14), %rax
movq %r13, %rdi
movq %rax, %rsi
callq 0x40184
movq 0x70(%rsp), %rdi
callq 0x4160e
movq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f6eb
movl $0x8, %edx
movq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x6f240
testl %r12d, %r12d
je 0xd9f42
leaq -0x1(%r15), %rsi
movq %rsi, 0x58(%rsp)
jmp 0xd9f4b
leaq 0x1(%r15), %rsi
movq %rsi, 0x50(%rsp)
leaq 0x50(%rsp), %rbp
movq 0x20(%r14), %rdi
callq 0xdbf58
movq %rax, %r13
addq 0x30(%r14), %r13
testl %r12d, %r12d
movq 0x20(%r14), %rdi
movq %rbp, %rax
leaq 0x58(%rsp), %rcx
cmoveq %rcx, %rax
movq (%rax), %rsi
callq 0xdbf58
movl %r12d, %ebp
movq %rax, %r12
addq 0x30(%r14), %r12
movq %rbx, %rdi
callq 0x415a1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x3f462
movq %rbx, %rdi
movq 0x10(%rsp), %rbx
leaq 0xb226(%rip), %rsi      # 0xe51cf
movq %r13, %rdx
movq %r12, %rcx
movl %ebp, %r12d
movl %eax, %r8d
callq 0x3f280
movq %rax, 0x70(%rsp)
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x3ef41
movq 0x70(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x3fb79
movq 0x48(%rsp), %rbp
addq %rbp, %r15
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rsi
xorl %ecx, %ecx
cmpq %rsi, %r15
setb %cl
xorl %edx, %edx
cmpq %rax, %r15
seta %dl
testl %r12d, %r12d
cmovel %ecx, %edx
testb %dl, %dl
jne 0xd9ed3
movq 0x70(%rsp), %rbx
jmp 0xda019
movl %r13d, %r12d
movq 0x28(%rsp), %rbx
testl %r12d, %r12d
movq 0x20(%r14), %rdi
cmovneq %rax, %rsi
callq 0xdbf58
addq 0x30(%r14), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x40184
leaq 0x70(%rsp), %rbx
movq (%rbx), %rsi
movq 0x10(%rsp), %rdi
callq 0x3f6eb
movl $0x8, %edx
movq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6f240
cmpl $0x1, %r12d
jne 0xda06d
movq %r15, %rdi
callq 0x6f179
testq %r15, %r15
je 0xda151
movq %r15, %rdi
callq 0x6f310
testq %rax, %rax
je 0xda151
movq %r15, %rdi
callq 0x6f310
testq %rax, %rax
je 0xda103
xorl %r12d, %r12d
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6f037
movq (%rax), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x3efa4
movq %r15, %rdi
movq 0x18(%rsp), %r15
callq 0x4160e
movq %rax, %rcx
movl %r14d, %eax
subq %rax, %rcx
movq %rcx, %rax
mulq %r13
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
movl %ecx, %r14d
xorl $0x3, %r14d
testq %rcx, %rcx
cmovel %r12d, %r14d
incq %rbx
movq %r15, %rdi
callq 0x6f310
cmpq %rax, %rbx
jb 0xda0a6
movq %r15, %rdi
callq 0x6f768
movq 0x20(%rsp), %r12
movb 0x40(%rsp), %r15b
xorl %ebp, %ebp
movb %r15b, %bpl
negl %ebp
movq %r12, %rdi
callq 0x6f768
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x32def
callq 0x32db8
callq 0x32c9d
callq 0x32d81
callq 0x32d48
callq 0x32d0f
callq 0x32cd6