// File: /workspace/github_c_makefile_star2_O1/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 $0x88, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
testq %rdx, %rdx
je 0xd930d
movq %r15, %rdi
callq 0x3566a
testb %al, %al
jne 0xd9a49
testq %rbx, %rbx
je 0xd9a3f
testq %r15, %r15
je 0xd932b
movq %r15, %rdi
callq 0x3566a
testb %al, %al
jne 0xd9a4e
testq %r14, %r14
je 0xd9a44
movq 0x20(%r14), %rdi
callq 0xdb97b
leaq 0x723(%rip), %rdx       # 0xd9a67
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x411ba
movl %eax, %ebp
testl %eax, %eax
jne 0xd9a2b
movq 0x20(%r14), %rdi
callq 0xdb8fa
xorl %ebp, %ebp
cmpq $0x3, %rax
jb 0xd9a2b
movq %rbx, %rdi
callq 0x3fdd2
cmpl $0x1, %eax
jne 0xd9397
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdb90d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xd9a2b
movq %rbx, 0x78(%rsp)
movq 0x20(%r14), %r15
testq %r15, %r15
je 0xd9a53
movb 0x38(%r14), %al
movb %al, 0x40(%rsp)
movb 0x39(%r14), %al
movb %al, 0x4(%rsp)
movb 0x3a(%r14), %bl
movq %r15, %rdi
callq 0xdb7ca
movq %rax, %r12
movq %r15, %rdi
callq 0xdb8fa
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xa4151
movq %rax, %r15
callq 0x3bfe0
movq %rax, 0x30(%rsp)
movq %rax, 0x60(%rsp)
callq 0x3bfe0
movq %rax, 0x8(%rsp)
movq %rax, 0x68(%rsp)
callq 0x3bfe0
movq %rax, %r12
movq %rax, 0x70(%rsp)
testb %bl, %bl
je 0xd9420
callq 0x3bfe0
movq %rax, 0x10(%rsp)
callq 0x3bfe0
jmp 0xd942b
movq $0x0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x18(%rsp)
testb %bl, %bl
movq %rax, 0x58(%rsp)
je 0xd9440
callq 0x3bfe0
jmp 0xd9442
xorl %eax, %eax
movq %r12, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq %rax, 0x20(%rsp)
testq %r15, %r15
je 0xd9a58
movq %r15, 0x80(%rsp)
movq %r15, %rdi
callq 0xa6d7b
movq %rax, %r12
leaq 0x3(%rsp), %r13
leaq 0x3c(%rsp), %rbp
leaq 0x2(%rsp), %r15
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xa710b
testl %eax, %eax
jne 0xd94c6
movl 0x3c(%rsp), %eax
movq 0x60(%rsp,%rax,8), %rdi
movsbl 0x3(%rsp), %esi
callq 0x3c28d
testb %bl, %bl
je 0xd947c
movl 0x3c(%rsp), %eax
movq 0x10(%rsp,%rax,8), %rdi
movzbl 0x2(%rsp), %esi
shll $0x5, %esi
addl $0x2d, %esi
callq 0x3c28d
jmp 0xd947c
cmpl $-0x2, %eax
jne 0xd94d7
xorl %ebx, %ebx
movq 0x48(%rsp), %rbp
jmp 0xd960d
movl $0x10, %edi
callq 0x6e93c
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x3c40b
movq %rax, %r15
movq %r13, %rdi
callq 0x3c434
movq %rax, %r13
testb %bl, %bl
je 0xd9511
movq 0x10(%rsp), %rdi
callq 0x3c40b
jmp 0xd9513
xorl %eax, %eax
subq $0x8, %rsp
movzbl 0xc(%rsp), %r10d
movzbl 0x48(%rsp), %r9d
leaq 0x636(%rip), %rdi       # 0xd9b60
xorl %ebp, %ebp
movq 0x30(%rsp), %rsi
xorl %edx, %edx
movq %r15, %rcx
movq %r13, %r8
movl %r9d, 0xc(%rsp)
pushq %rax
pushq $0x0
movq %r10, 0x58(%rsp)
pushq %r10
callq 0xdecf8
addq $0x20, %rsp
movq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x3c40b
movq %rax, %r15
movq %r13, %rdi
callq 0x3c434
movq %rax, %r13
testb %bl, %bl
je 0xd957d
movq 0x58(%rsp), %rdi
callq 0x3c40b
movq %rax, %rbp
subq $0x8, %rsp
leaq 0x5d8(%rip), %rdi       # 0xd9b60
movq 0x30(%rsp), %rsi
movl $0x1, %edx
movq %r15, %rcx
movq %r13, %r8
movl 0xc(%rsp), %r9d
pushq %rbp
pushq $0x0
pushq 0x58(%rsp)
callq 0xdecf8
addq $0x20, %rsp
movq 0x48(%rsp), %rbp
movq %rbp, %rdi
callq 0x3c40b
movq %rax, %r15
movq %rbp, %rdi
callq 0x3c434
movq %rax, %r13
testb %bl, %bl
je 0xd95d8
movq 0x50(%rsp), %rdi
callq 0x3c40b
jmp 0xd95da
xorl %eax, %eax
subq $0x8, %rsp
leaq 0x57b(%rip), %rdi       # 0xd9b60
movq 0x30(%rsp), %rbx
movq %rbx, %rsi
movl $0x2, %edx
movq %r15, %rcx
movq %r13, %r8
movl 0xc(%rsp), %r9d
pushq %rax
pushq $0x0
pushq 0x58(%rsp)
callq 0xdecf8
addq $0x20, %rsp
movq 0x50(%rsp), %rdi
callq 0x3d1eb
movq 0x58(%rsp), %rdi
callq 0x3d1eb
movq 0x10(%rsp), %rdi
callq 0x3d1eb
movq %rbp, %rdi
callq 0x3d1eb
movq 0x8(%rsp), %rdi
callq 0x3d1eb
movq 0x30(%rsp), %rdi
callq 0x3d1eb
movq %r12, %rdi
callq 0xa71e5
movq 0x80(%rsp), %rdi
callq 0xa3f62
xorl %ebp, %ebp
testq %rbx, %rbx
sete %r15b
je 0xd9a1e
movq %rbx, %rdi
callq 0x6ecda
testq %rax, %rax
je 0xd9a1e
movq %rbx, %rdi
callq 0x7e96d
movq %rbx, %rdi
callq 0x6ea17
movq %rax, %rdi
callq 0x7e05b
movl 0x10(%r14), %ecx
leal (%rcx,%rcx,2), %ecx
cmpq %rcx, %rax
jb 0xd9a1e
movb %r15b, 0x48(%rsp)
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
callq 0x6ea17
movups (%rax), %xmm0
leaq 0x60(%rsp), %r15
movaps %xmm0, (%r15)
movq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x3fdd2
movl %eax, %ebx
movq %r15, %rdi
callq 0x7e05b
cmpq $0x2, %rax
jbe 0xd9a62
movq 0x20(%r14), %rdi
testl %ebx, %ebx
leaq 0x68(%rsp), %rcx
movq %rcx, %rax
cmoveq %r15, %rax
movq (%rax), %rsi
movl %ebx, 0x30(%rsp)
cmoveq %rcx, %r15
callq 0xdb8a5
movq %rax, %r13
movq 0x20(%r14), %rdi
addq 0x30(%r14), %r13
movq (%r15), %rsi
movl 0x30(%rsp), %ebx
callq 0xdb8a5
movq %rax, %r15
addq 0x30(%r14), %r15
movl $0x8, %edi
callq 0x6e93c
movq %rax, %rbp
movq %r12, %rdi
callq 0x41f3f
movq %rax, 0x8(%rsp)
movq %r12, %rdi
callq 0x3fdd2
leaq 0xbaa3(%rip), %rsi      # 0xe51ef
movq 0x8(%rsp), %rdi
movq %r13, %rdx
movq %r15, %rcx
movl %eax, %r8d
callq 0x3fbf0
movq %rax, 0x10(%rsp)
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x3f8b5
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3f918
movq 0x10(%rsp), %rdi
callq 0x40480
testl %ebx, %ebx
leaq 0x68(%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 %ebx, %ebx
cmovel %ecx, %edx
cmpb $0x1, %dl
jne 0xd991b
leaq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
xorl %r13d, %r13d
movl %ebx, %eax
negl %eax
sbbq %r13, %r13
orq $0x1, %r13
movq %rbp, 0x8(%rsp)
movq %r13, 0x50(%rsp)
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdb7d2
testb %al, %al
je 0xd98f1
movq 0x10(%rsp), %r13
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0xdb8a5
addq 0x30(%r14), %rax
movq %r13, %rdi
movq %rax, %rsi
callq 0x40aee
movq 0x10(%rsp), %rdi
callq 0x41fac
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x4005b
movl $0x8, %edx
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x6ec0e
testl %ebx, %ebx
je 0xd984a
leaq -0x1(%r15), %rax
movq %rax, 0x68(%rsp)
jmp 0xd9853
leaq 0x1(%r15), %rax
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rcx
testl %ebx, %ebx
movq 0x20(%r14), %rdi
leaq 0x68(%rsp), %rdx
movq %rdx, %rax
cmoveq %rcx, %rax
movq (%rax), %rsi
movq %rcx, %rbx
cmoveq %rdx, %rbx
callq 0xdb8a5
movq %rax, %r13
movq 0x20(%r14), %rdi
addq 0x30(%r14), %r13
movq (%rbx), %rsi
callq 0xdb8a5
movq %rax, %rbp
addq 0x30(%r14), %rbp
movq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x41f3f
movq %rax, %rbx
movq %r12, %rdi
callq 0x3fdd2
movq %rbx, %rdi
movl 0x30(%rsp), %ebx
leaq 0xb936(%rip), %rsi      # 0xe51ef
movq %r13, %rdx
movq %rbp, %rcx
movl %eax, %r8d
callq 0x3fbf0
movq %rax, 0x10(%rsp)
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x3f8b5
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x404de
movq 0x8(%rsp), %rbp
movq 0x50(%rsp), %r13
addq %r13, %r15
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rsi
xorl %ecx, %ecx
cmpq %rsi, %r15
setb %cl
xorl %edx, %edx
cmpq %rax, %r15
seta %dl
testl %ebx, %ebx
cmovel %ecx, %edx
testb %dl, %dl
jne 0xd97de
testl %ebx, %ebx
movl %ebx, %r13d
leaq 0x10(%rsp), %rbx
movq (%rbx), %r15
movq 0x20(%r14), %rdi
cmovneq %rax, %rsi
callq 0xdb8a5
addq 0x30(%r14), %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0x40aee
movq (%rbx), %rsi
movq %r12, %rdi
callq 0x4005b
movl $0x8, %edx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6ec0e
cmpl $0x1, %r13d
jne 0xd996d
movq %rbp, %rdi
callq 0x6eb46
testq %rbp, %rbp
je 0xd9a5d
movq %rbp, %rdi
callq 0x6ecda
testq %rax, %rax
je 0xd9a5d
movq %rbp, %rdi
callq 0x6ecda
testq %rax, %rax
je 0xd9a0a
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
movabsq $0x5555555555555556, %r13 # imm = 0x5555555555555556
xorl %ebx, %ebx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6e9fa
movq (%rax), %r14
movq %r14, %rdi
movl %r15d, %esi
callq 0x3f918
movq %r14, %rdi
callq 0x41fac
movq %rax, %r14
movl %r15d, %eax
subq %rax, %r14
movq %r14, %rax
mulq %r12
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %r14
xorq $0x3, %r14
movq %r14, %rax
mulq %r13
leal (%rdx,%rdx,2), %eax
subl %eax, %r14d
incq %rbx
movq %rbp, %rdi
callq 0x6ecda
movl %r14d, %r15d
cmpq %rax, %rbx
jb 0xd99ad
movq %rbp, %rdi
callq 0x6f134
movq 0x28(%rsp), %rbx
xorl %ebp, %ebp
movb 0x48(%rsp), %r15b
movb %r15b, %bpl
negl %ebp
movq %rbx, %rdi
callq 0x6f134
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x333ec
callq 0x333b5
callq 0x33263
callq 0x3329c
callq 0x3337e
callq 0x33345
callq 0x3330c
callq 0x332d3