// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/ltr/ltrdigest_file_out_stream.c
// Function: write_pdom
static int write_pdom(GtLTRdigestFileOutStream *ls, GtArray *pdoms,
                      const char *pdomname, GT_UNUSED GtRegionMapping *rmap,
                      char *desc, GtError *err)
{
  int had_err = 0;
  GtFile *seqfile = NULL,
         *alifile = NULL,
         *aafile = NULL;
  GtUword i = 0,
                seq_length = 0;
  GtStr *pdom_seq,
        *pdom_aaseq;
  gt_error_check(err);
  char buffer[GT_MAXFILENAMELEN];

  pdom_seq = gt_str_new();
  pdom_aaseq = gt_str_new();

  (void) snprintf(buffer, (size_t) (GT_MAXFILENAMELEN-1), "%s_pdom_%s.fas",
                  ls->fileprefix, pdomname);
  seqfile = gt_file_xopen(buffer, "a+");

  /* get protein alignment output file */
  if (ls->write_pdom_alignments)
  {
    (void) snprintf(buffer, (size_t) (GT_MAXFILENAMELEN-1), "%s_pdom_%s.ali",
                    ls->fileprefix, pdomname);
    alifile = gt_file_xopen(buffer, "a+");
  }

  /* get amino acid sequence output file */
  if (ls->write_pdom_aaseqs)
  {
    (void) snprintf(buffer, (size_t) (GT_MAXFILENAMELEN-1),
                    "%s_pdom_%s_aa.fas",
                    ls->fileprefix, pdomname);
    aafile = gt_file_xopen(buffer, "a+");
  }

  if (gt_array_size(pdoms) > 1UL)
  {
    for (i=1UL; i<gt_array_size(pdoms); i++)
    {
      gt_assert(gt_genome_node_cmp(*(GtGenomeNode**)gt_array_get(pdoms, i),
                                *(GtGenomeNode**)gt_array_get(pdoms, i-1))
                >= 0);
    }
    if (gt_feature_node_get_strand(*(GtFeatureNode**) gt_array_get(pdoms, 0UL))
        == GT_STRAND_REVERSE)
    {
      gt_array_reverse(pdoms);
    }
  }

  /* output protein domain data */
  for (i=0;i<gt_array_size(pdoms);i++)
  {
    GtRange pdom_rng;
    GtStr *ali,
          *aaseq;
    GtFeatureNode *fn;

    fn = *(GtFeatureNode**) gt_array_get(pdoms, i);

    ali = gt_genome_node_get_user_data((GtGenomeNode*) fn, "pdom_alignment");
    aaseq = gt_genome_node_get_user_data((GtGenomeNode*) fn, "pdom_aaseq");
    pdom_rng = gt_genome_node_get_range((GtGenomeNode*) fn);

    if (gt_extract_feature_sequence(pdom_seq, (GtGenomeNode*) fn,
                                    gt_symbol(gt_ft_protein_match), false,
                                    NULL, NULL, rmap, err))
    {
      had_err = -1;
      break;
    }

    if (ls->write_pdom_alignments && ali)
    {
      char buf[BUFSIZ];
      gt_assert(alifile);
      /* write away alignment */
      (void) snprintf(buf, BUFSIZ-1, "Protein domain alignment in translated "
                                     "sequence for candidate\n'%s':\n\n",
                                     desc);
      gt_file_xwrite(alifile, buf, (size_t) strlen(buf) * sizeof (char));
      gt_file_xwrite(alifile, gt_str_get(ali),
                        (size_t) gt_str_length(ali) * sizeof (char));
      gt_file_xwrite(alifile, "---\n\n", 5 * sizeof (char));
    }
    if (ls->write_pdom_aaseqs && aaseq)
    {
      /* append amino acid sequence */
      gt_str_append_str(pdom_aaseq, aaseq);
    }
    gt_genome_node_release_user_data((GtGenomeNode*) fn, "pdom_alignment");
    gt_genome_node_release_user_data((GtGenomeNode*) fn, "pdom_aaseq");
    seq_length += gt_range_length(&pdom_rng);
  }

  if (!had_err)
  {
    gt_assert(seqfile);
    gt_fasta_show_entry(desc,
                        gt_str_get(pdom_seq),
                        seq_length,
                        GT_FSWIDTH,
                        seqfile);
    if (ls->write_pdom_aaseqs)
    {
      gt_assert(aafile);
      gt_fasta_show_entry(desc,
                          gt_str_get(pdom_aaseq),
                          gt_str_length(pdom_aaseq),
                          GT_FSWIDTH,
                          aafile);
    }
  }
  gt_str_delete(pdom_seq);
  gt_str_delete(pdom_aaseq);
  gt_file_delete(aafile);
  gt_file_delete(alifile);
  gt_file_delete(seqfile);
  return had_err;
}

// Assembly:
subq $0x2228, %rsp           # imm = 0x2228
movq %rdi, 0x2220(%rsp)
movq %rsi, 0x2218(%rsp)
movq %rdx, 0x2210(%rsp)
movq %rcx, 0x2208(%rsp)
movq %r8, 0x2200(%rsp)
movq %r9, 0x21f8(%rsp)
movl $0x0, 0x21f4(%rsp)
movq $0x0, 0x21e8(%rsp)
movq $0x0, 0x21e0(%rsp)
movq $0x0, 0x21d8(%rsp)
movq $0x0, 0x21d0(%rsp)
movq $0x0, 0x21c8(%rsp)
cmpq $0x0, 0x21f8(%rsp)
je 0x304604
movq 0x21f8(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x3045cc
jmp 0x304604
movq 0x3379cd(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x211a36(%rip), %rsi    # 0x516013
leaq 0x211bdb(%rip), %rdx    # 0x5161bf
leaq 0x28eb72(%rip), %rcx    # 0x59315d
leaq 0x28e4ef(%rip), %r8     # 0x592ae1
movl $0xfe, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x304606
callq 0x11d4a0
movq %rax, 0x21c0(%rsp)
callq 0x11d4a0
movq %rax, 0x21b8(%rsp)
leaq 0x20b0(%rsp), %rdi
movq 0x2220(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x2210(%rsp), %r8
movl $0xff, %esi
leaq 0x28eb20(%rip), %rdx    # 0x593168
movb $0x0, %al
callq 0x19b90
leaq 0x20b0(%rsp), %rdi
leaq 0x28eb19(%rip), %rsi    # 0x593177
callq 0xdd9b0
movq %rax, 0x21e8(%rsp)
movq 0x2220(%rsp), %rax
testb $0x1, 0xd8(%rax)
je 0x3046c7
leaq 0x20b0(%rsp), %rdi
movq 0x2220(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x2210(%rsp), %r8
movl $0xff, %esi
leaq 0x28ead6(%rip), %rdx    # 0x59317a
movb $0x0, %al
callq 0x19b90
leaq 0x20b0(%rsp), %rdi
leaq 0x28eabd(%rip), %rsi    # 0x593177
callq 0xdd9b0
movq %rax, 0x21e0(%rsp)
movq 0x2220(%rsp), %rax
testb $0x1, 0xd9(%rax)
je 0x304723
leaq 0x20b0(%rsp), %rdi
movq 0x2220(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x2210(%rsp), %r8
movl $0xff, %esi
leaq 0x28ea89(%rip), %rdx    # 0x593189
movb $0x0, %al
callq 0x19b90
leaq 0x20b0(%rsp), %rdi
leaq 0x28ea61(%rip), %rsi    # 0x593177
callq 0xdd9b0
movq %rax, 0x21d8(%rsp)
movq 0x2218(%rsp), %rdi
callq 0x81370
cmpq $0x1, %rax
jbe 0x30483d
movq $0x1, 0x21d0(%rsp)
movq 0x21d0(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x2218(%rsp), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x304810
jmp 0x304773
movq 0x2218(%rsp), %rdi
movq 0x21d0(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x2218(%rsp), %rdi
movq 0x21d0(%rsp), %rsi
subq $0x1, %rsi
callq 0x80b60
movq 0x60(%rsp), %rdi
movq (%rax), %rsi
callq 0x171580
cmpl $0x0, %eax
jge 0x3047f3
movq 0x3377de(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x211847(%rip), %rsi    # 0x516013
leaq 0x28e9c8(%rip), %rdx    # 0x59319b
leaq 0x28e983(%rip), %rcx    # 0x59315d
leaq 0x28e300(%rip), %r8     # 0x592ae1
movl $0x11f, %r9d            # imm = 0x11F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x3047f5
jmp 0x3047f7
movq 0x21d0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x21d0(%rsp)
jmp 0x304746
movq 0x2218(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x80b60
movq (%rax), %rdi
callq 0x16cc70
cmpl $0x1, %eax
jne 0x30483b
movq 0x2218(%rsp), %rdi
callq 0x80f40
jmp 0x30483d
movq $0x0, 0x21d0(%rsp)
movq 0x21d0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x2218(%rsp), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x304b26
movq 0x2218(%rsp), %rdi
movq 0x21d0(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x2088(%rsp)
movq 0x2088(%rsp), %rdi
leaq 0x28e964(%rip), %rsi    # 0x593207
callq 0x1728c0
movq %rax, 0x2098(%rsp)
movq 0x2088(%rsp), %rdi
leaq 0x28e957(%rip), %rsi    # 0x593216
callq 0x1728c0
movq %rax, 0x2090(%rsp)
movq 0x2088(%rsp), %rdi
callq 0x171cc0
movq %rax, 0x2078(%rsp)
movq %rdx, 0x2080(%rsp)
movq 0x2078(%rsp), %rax
movq %rax, 0x20a0(%rsp)
movq 0x2080(%rsp), %rax
movq %rax, 0x20a8(%rsp)
movq 0x21c0(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x2088(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x24e908(%rip), %rdi    # 0x553232
callq 0x120930
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rax, %rdx
movq 0x2208(%rsp), %r10
movq 0x21f8(%rsp), %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x48f4f0
cmpl $0x0, %eax
je 0x30497a
movl $0xffffffff, 0x21f4(%rsp) # imm = 0xFFFFFFFF
jmp 0x304b26
movq 0x2220(%rsp), %rax
testb $0x1, 0xd8(%rax)
je 0x304a97
cmpq $0x0, 0x2098(%rsp)
je 0x304a97
jmp 0x3049a0
cmpq $0x0, 0x21e0(%rsp)
jne 0x3049e3
movq 0x3375ee(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x211657(%rip), %rsi    # 0x516013
leaq 0x28e85e(%rip), %rdx    # 0x593221
leaq 0x28e793(%rip), %rcx    # 0x59315d
leaq 0x28e110(%rip), %r8     # 0x592ae1
movl $0x141, %r9d            # imm = 0x141
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x3049e5
leaq 0x70(%rsp), %rdi
movq 0x2200(%rsp), %rcx
movl $0x1fff, %esi           # imm = 0x1FFF
leaq 0x28e82b(%rip), %rdx    # 0x593229
movb $0x0, %al
callq 0x19b90
movq 0x21e0(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x192b0
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rdx
shlq $0x0, %rdx
callq 0xde230
movq 0x21e0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x2098(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x40(%rsp)
movq 0x2098(%rsp), %rdi
callq 0x11dfa0
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rax, %rdx
shlq $0x0, %rdx
callq 0xde230
movq 0x21e0(%rsp), %rdi
leaq 0x28e7e2(%rip), %rsi    # 0x59326f
movl $0x5, %edx
callq 0xde230
movq 0x2220(%rsp), %rax
testb $0x1, 0xd9(%rax)
je 0x304ac8
cmpq $0x0, 0x2090(%rsp)
je 0x304ac8
movq 0x21b8(%rsp), %rdi
movq 0x2090(%rsp), %rsi
callq 0x11d750
movq 0x2088(%rsp), %rdi
leaq 0x28e730(%rip), %rsi    # 0x593207
callq 0x172980
movq 0x2088(%rsp), %rdi
leaq 0x28e72b(%rip), %rsi    # 0x593216
callq 0x172980
leaq 0x20a0(%rsp), %rdi
callq 0x107320
addq 0x21c8(%rsp), %rax
movq %rax, 0x21c8(%rsp)
movq 0x21d0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x21d0(%rsp)
jmp 0x304849
cmpl $0x0, 0x21f4(%rsp)
jne 0x304c60
jmp 0x304b36
cmpq $0x0, 0x21e8(%rsp)
jne 0x304b79
movq 0x337458(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2114c1(%rip), %rsi    # 0x516013
leaq 0x26bd10(%rip), %rdx    # 0x570869
leaq 0x28e5fd(%rip), %rcx    # 0x59315d
leaq 0x28df7a(%rip), %r8     # 0x592ae1
movl $0x157, %r9d            # imm = 0x157
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x304b7b
movq 0x2200(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x21c0(%rsp), %rdi
callq 0x11dee0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movq 0x21c8(%rsp), %rdx
movq 0x21e8(%rsp), %r8
movl $0x3c, %ecx
callq 0xdbd10
movq 0x2220(%rsp), %rax
testb $0x1, 0xd9(%rax)
je 0x304c5e
jmp 0x304bce
cmpq $0x0, 0x21d8(%rsp)
jne 0x304c11
movq 0x3373c0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x211429(%rip), %rsi    # 0x516013
leaq 0x28e684(%rip), %rdx    # 0x593275
leaq 0x28e565(%rip), %rcx    # 0x59315d
leaq 0x28dee2(%rip), %r8     # 0x592ae1
movl $0x15f, %r9d            # imm = 0x15F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x304c13
movq 0x2200(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x21b8(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x18(%rsp)
movq 0x21b8(%rsp), %rdi
callq 0x11dfa0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rax, %rdx
movq 0x21d8(%rsp), %r8
movl $0x3c, %ecx
callq 0xdbd10
jmp 0x304c60
movq 0x21c0(%rsp), %rdi
callq 0x11f560
movq 0x21b8(%rsp), %rdi
callq 0x11f560
movq 0x21d8(%rsp), %rdi
callq 0xde430
movq 0x21e0(%rsp), %rdi
callq 0xde430
movq 0x21e8(%rsp), %rdi
callq 0xde430
movl 0x21f4(%rsp), %eax
addq $0x2228, %rsp           # imm = 0x2228
retq