// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/extract_feature_sequence.c
// Function: gt_extract_and_translate_feature_sequence
int gt_extract_and_translate_feature_sequence(GtFeatureNode *feature_node,
                                              const char *type,
                                              bool join,
                                              GtStr *seqid,
                                              GtStrArray *target_ids,
                                              GtRegionMapping *rm,
                                              GtTransTable *ttable,
                                              GtStr *translation_fr1,
                                              GtStr *translation_fr2,
                                              GtStr *translation_fr3,
                                              GtError *err)
{
  GtTranslator *tr = NULL;
  GtTranslatorStatus status;
  GtCodonIterator *ci = NULL;
  unsigned int frame, phase_offset = 0;
  char translated;
  int had_err = 0;
  GtStr *sequence = gt_str_new();
  gt_assert(feature_node && type);

  had_err = extract_feature_sequence_generic(sequence,
                                             (GtGenomeNode*) feature_node, type,
                                             join, seqid, target_ids,
                                             &phase_offset, rm, err);

  /* do translation if we have at least one codon */
  if (!had_err && gt_str_length(sequence) > phase_offset + 2) {
    ci = gt_codon_iterator_simple_new(gt_str_get(sequence) + phase_offset,
                                      gt_str_length(sequence) - phase_offset,
                                      NULL);
    tr = gt_translator_new(ci);
    if (ttable)
      gt_translator_set_translation_table(tr, ttable);
    status = gt_translator_next(tr, &translated, &frame, NULL);
    while (status == GT_TRANSLATOR_OK) {
      if (frame == 0 && translation_fr1)
        gt_str_append_char(translation_fr1, translated);
      else if (frame == 1 && translation_fr2)
        gt_str_append_char(translation_fr2, translated);
      else if (frame == 2 && translation_fr3)
        gt_str_append_char(translation_fr3, translated);
      status = gt_translator_next(tr, &translated, &frame, NULL);
    }
    if (status == GT_TRANSLATOR_ERROR)
      had_err = -1;
  }
  gt_translator_delete(tr);
  gt_codon_iterator_delete(ci);
  gt_str_delete(sequence);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %rbp
movl $0x0, 0x8(%rsp)
callq 0x3bfe0
movq %rax, 0x10(%rsp)
testq %rbp, %rbp
je 0xa827f
testq %r13, %r13
je 0xa827f
subq $0x8, %rsp
leaq 0x10(%rsp), %rax
movzbl %bl, %ecx
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %r8
movq %r15, %r9
pushq 0x78(%rsp)
pushq %r14
pushq %rax
callq 0xa7c50
addq $0x20, %rsp
xorl %r14d, %r14d
testl %eax, %eax
je 0xa8142
movl %eax, %ebp
jmp 0xa8243
movq %rbx, %rdi
callq 0x3c434
movl 0x8(%rsp), %ecx
addl $0x2, %ecx
cmpq %rcx, %rax
jbe 0xa8241
movq 0x50(%rsp), %r12
movq %rbx, %rdi
callq 0x3c40b
movq %rbx, %rdi
movl 0x8(%rsp), %ebx
addq %rax, %rbx
callq 0x3c434
movl 0x8(%rsp), %ecx
subq %rcx, %rax
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xa4151
movq %rax, %r14
movq %rax, %rdi
callq 0xa6d7b
movq %rax, %r15
testq %r12, %r12
je 0xa81a8
movq %r15, %rdi
movq %r12, %rsi
callq 0xa6dcb
movq 0x58(%rsp), %rbp
leaq 0x7(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xa7101
movq 0x10(%rsp), %rbx
testl %eax, %eax
jne 0xa826f
testq %rbp, %rbp
sete %cl
movl 0xc(%rsp), %eax
testl %eax, %eax
setne %dl
orb %cl, %dl
jne 0xa81f1
movsbl 0x7(%rsp), %esi
movq %rbp, %rdi
jmp 0xa822a
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
sete %cl
cmpl $0x1, %eax
setne %dl
orb %cl, %dl
jne 0xa820d
movsbl 0x7(%rsp), %esi
jmp 0xa822a
cmpq $0x0, 0x68(%rsp)
sete %cl
cmpl $0x2, %eax
setne %al
orb %cl, %al
jne 0xa822f
movsbl 0x7(%rsp), %esi
movq 0x68(%rsp), %rdi
callq 0x3c28d
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xa7101
jmp 0xa81cc
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xa71e5
movq %r14, %rdi
callq 0xa3f62
movq %rbx, %rdi
callq 0x3d1eb
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x2, %eax
jne 0xa827b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xa8246
xorl %ebp, %ebp
jmp 0xa8246
callq 0x23824