// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/match_iterator_last.c
// Function: last_prepare_fasta_seqs
static int last_prepare_fasta_seqs(const char *filename, GtEncseq *encseq,
                                   GtHashmap *desc_to_seqno,
                                   GT_UNUSED GtError *err)
{
  char *seq;
  const char *desc;
  int had_err = 0;
  GtFile *fp;
  GtStr *header = NULL;
  GtUword desclen;
  gt_assert(filename && encseq);
  gt_error_check(err);

  if (!(fp = gt_file_open(GT_FILE_MODE_UNCOMPRESSED, filename, "w", err)))
    had_err = -1;
  header = gt_str_new();
  if (!had_err) {
    GtUword i, length, startpos, endpos;
    for (i = 0; i < gt_encseq_num_of_sequences(encseq); i++) {
      char *desccpy;
      desc = gt_encseq_description(encseq, &desclen, i);
      desccpy = gt_calloc(desclen+1, sizeof (char));
      strncpy(desccpy, desc, desclen);
      startpos = gt_encseq_seqstartpos(encseq, i);
      length = gt_encseq_seqlength(encseq, i);
      gt_hashmap_add(desc_to_seqno, desccpy, (void*) i);
      endpos = startpos + length - 1;
      seq = gt_malloc(sizeof (char) * length);
      gt_str_reset(header);
      gt_str_append_cstr_nt(header, desc, desclen);
      gt_encseq_extract_decoded(encseq, seq, startpos, endpos);
      gt_fasta_show_entry(gt_str_get(header), seq, length, 80, fp);
      gt_free(seq);
    }
    gt_file_delete(fp);
  }
  gt_str_delete(header);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x20(%rsp)
testq %rdi, %rdi
je 0x15f80e
movq %rsi, %r12
testq %rsi, %rsi
je 0x15f80e
movq %rcx, %rbx
movq %rdi, %r15
testq %rcx, %rcx
je 0x15f687
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x15f813
leaq 0x233f27(%rip), %rdx    # 0x3935b5
xorl %ebp, %ebp
xorl %edi, %edi
movq %r15, %rsi
movq %rbx, %rcx
callq 0xfead5
movq %rax, %rbx
callq 0x11ac6c
testq %rbx, %rbx
je 0x15f7ef
movq %rax, 0x10(%rsp)
movq %r12, %rdi
callq 0xe7bac
testq %rax, %rax
je 0x15f7e0
xorl %r13d, %r13d
movq %rbx, 0x18(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0xec19e
movq %rax, %rbx
movq %rax, 0x30(%rsp)
movq 0x8(%rsp), %rdi
incq %rdi
movl $0x1, %esi
leaq 0x227a31(%rip), %r14    # 0x387129
movq %r14, %rdx
movl $0xbb, %ecx
callq 0x10436a
movq %rax, %rbp
movq 0x8(%rsp), %rdx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x17370
movq %r12, %rdi
movq %r13, %rsi
callq 0xeb6ee
movq %rax, %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0xeb9d2
movq %rax, %r15
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x100b18
leaq (%rbx,%r15), %rax
decq %rax
movq %rax, 0x28(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movl $0xc1, %edx
callq 0x104226
movq %rax, %rbp
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x11b132
movq 0x8(%rsp), %rdx
movq %r14, %rdi
movq 0x30(%rsp), %rsi
callq 0x11ae1b
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %rcx
callq 0xe92be
movq %r14, %rdi
callq 0x11b0a1
movl $0x50, %ecx
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %r8
callq 0xfe000
movq %rbp, %rdi
leaq 0x227967(%rip), %rsi    # 0x387129
movl $0xc6, %edx
callq 0x1045eb
incq %r13
movq %r12, %rdi
callq 0xe7bac
cmpq %rax, %r13
jb 0x15f6cc
movq %rbx, %rdi
callq 0xff22c
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
cmpq $0x1, %rbx
sbbl %ebp, %ebp
movq %rax, %rdi
callq 0x11bdbf
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4c55a
callq 0x4c593