// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x88, %rsp
movb %dl, %al
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rdx
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rdx
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
andb $0x1, %al
movb %al, 0x77(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movl $0x0, 0x30(%rsp)
callq 0x18f00
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0xe7872
cmpq $0x0, 0x78(%rsp)
jne 0xe78aa
movq 0xcc75f(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x767e3(%rip), %rsi     # 0x15e066
leaq 0x9223b(%rip), %rdx     # 0x179ac5
leaq 0x92249(%rip), %rcx     # 0x179ada
leaq 0x9226c(%rip), %r8      # 0x179b04
movl $0xc3, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xe78ac
movq 0x28(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x78(%rsp), %rdx
movb 0x77(%rsp), %cl
movq 0x68(%rsp), %r8
movq 0x60(%rsp), %r9
movq 0x58(%rsp), %r10
movq 0xb0(%rsp), %rax
leaq 0x38(%rsp), %r11
andb $0x1, %cl
movzbl %cl, %ecx
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xe71b0
movl %eax, 0x30(%rsp)
cmpl $0x0, 0x30(%rsp)
jne 0xe7a58
movq 0x28(%rsp), %rdi
callq 0x19a00
movl 0x38(%rsp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xe7a58
movq 0x28(%rsp), %rdi
callq 0x19940
movl 0x38(%rsp), %ecx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x19a00
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movl 0x38(%rsp), %eax
subq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xe0180
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0xe59b0
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0xe798b
movq 0x50(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0xe5b10
movq 0x50(%rsp), %rdi
leaq 0x37(%rsp), %rsi
leaq 0x3c(%rsp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xe60e0
movl %eax, 0x4c(%rsp)
cmpl $0x0, 0x4c(%rsp)
jne 0xe7a47
cmpl $0x0, 0x3c(%rsp)
jne 0xe79d8
cmpq $0x0, 0x98(%rsp)
je 0xe79d8
movq 0x98(%rsp), %rdi
movsbl 0x37(%rsp), %esi
callq 0x194d0
jmp 0xe7a26
cmpl $0x1, 0x3c(%rsp)
jne 0xe79fe
cmpq $0x0, 0xa0(%rsp)
je 0xe79fe
movq 0xa0(%rsp), %rdi
movsbl 0x37(%rsp), %esi
callq 0x194d0
jmp 0xe7a24
cmpl $0x2, 0x3c(%rsp)
jne 0xe7a22
cmpq $0x0, 0xa8(%rsp)
je 0xe7a22
movq 0xa8(%rsp), %rdi
movsbl 0x37(%rsp), %esi
callq 0x194d0
jmp 0xe7a24
jmp 0xe7a26
movq 0x50(%rsp), %rdi
leaq 0x37(%rsp), %rsi
leaq 0x3c(%rsp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xe60e0
movl %eax, 0x4c(%rsp)
jmp 0xe79a7
cmpl $-0x2, 0x4c(%rsp)
jne 0xe7a56
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
jmp 0xe7a58
movq 0x50(%rsp), %rdi
callq 0xe6310
movq 0x40(%rsp), %rdi
callq 0xdfde0
movq 0x28(%rsp), %rdi
callq 0x1afc0
movl 0x30(%rsp), %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)