// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/reads2twobit.c
// Function: gt_reads2twobit_write_descriptions
int gt_reads2twobit_write_descriptions(GtReads2Twobit *r2t,
    GtBitsequence *skip, GtError *err)
{
  FILE *desfp = NULL, *sdsfp = NULL;
  int had_err = 0;
  bool with_newline = (r2t->descsfp || (r2t->descs && (!r2t->clipdes)));
  GtUword i, startpos = 0;
  gt_assert(r2t);
  gt_error_check(err);
  gt_assert(r2t->descs != NULL || r2t->descsfp != NULL);
  desfp = gt_fa_fopen_with_suffix(gt_str_get(r2t->indexname),
      GT_DESTABFILESUFFIX, "wb", err);
  if (desfp == NULL)
      had_err = -1;
  if (!had_err) {
    sdsfp = gt_fa_fopen_with_suffix(gt_str_get(r2t->indexname),
        GT_SDSTABFILESUFFIX, "wb", err);
    if (sdsfp == NULL)
        had_err = -1;
  }
  if (!had_err) {
    char *desc = NULL;
    GtUword len = 0, longestdesc = 0, fin = ~0UL, posbuf;
    if (r2t->descsfp != NULL)
    {
      rewind(r2t->descsfp);
      desc = gt_malloc((size_t)r2t->longestdesc+(size_t)1);
    }
    for (i = 0; i < r2t->n_descs; i++)
    {
      if (r2t->descs != NULL)
      {
        desc = (char*) gt_desc_buffer_get_next(r2t->descs);
      }
      else
      {
        (void)gt_xfgets(desc, (int)r2t->longestdesc+(size_t)1, r2t->descsfp);
      }
      if (skip && GT_ISIBITSET(skip, i))
        continue;
      /* note: do not use longestdesc = r2t->longestdesc (for diskbased)
         or the value stored in the desc_buffer (for membased), as these
         values are not up to date when <skip> is applied */
      len = (GtUword)strlen(desc);
      if (with_newline)
      {
        gt_assert(len > 0);
        len--;
      }
      if (len > longestdesc)
        longestdesc = len;
      if (startpos > 0)
      {
        posbuf = startpos - (GtUword)1;
        gt_xfwrite_one(&posbuf, sdsfp);
      }
      gt_xfputs(desc, desfp);
      if (!with_newline)
        gt_xfputc((int) '\n', desfp);
      startpos += (len+(GtUword)1);
    }
    gt_xfwrite_one(&longestdesc, desfp);
    gt_xfwrite_one(&fin, desfp);
    if (r2t->descsfp != NULL)
    {
      gt_free(desc);
    }
  }
  gt_fa_fclose(desfp);
  gt_fa_fclose(sdsfp);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movb $0x1, %al
movl %eax, 0x4(%rsp)
cmpq $0x0, 0xa0(%rdi)
jne 0x1e70a6
cmpq $0x0, 0x98(%rbx)
je 0x1e709e
movb 0xa8(%rbx), %al
xorb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x1e70a6
movl $0x0, 0x4(%rsp)
testq %rbx, %rbx
je 0x1e731b
testq %r13, %r13
je 0x1e70c4
movq %r13, %rdi
callq 0x101a9a
testb %al, %al
jne 0x1e7320
cmpq $0x0, 0x98(%rbx)
jne 0x1e70dc
cmpq $0x0, 0xa0(%rbx)
je 0x1e7325
movq (%rbx), %rdi
callq 0x120d23
leaq 0x16893a(%rip), %rsi    # 0x34fa25
leaq 0x177a1b(%rip), %rdx    # 0x35eb0d
leaq 0x1d46fb(%rip), %rcx    # 0x3bb7f4
movq %rax, %rdi
movl $0x7cb, %r8d            # imm = 0x7CB
movq %r13, %r9
callq 0x101dff
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1e715b
movq (%rbx), %rdi
callq 0x120d23
leaq 0x1688ff(%rip), %rsi    # 0x34fa2a
leaq 0x1779db(%rip), %rdx    # 0x35eb0d
leaq 0x1d46bb(%rip), %rcx    # 0x3bb7f4
movq %rax, %rdi
movl $0x7d0, %r8d            # imm = 0x7D0
movq %r13, %r9
callq 0x101dff
testq %rax, %rax
je 0x1e7158
movq %rax, %r15
movb $0x1, %al
xorl %ebp, %ebp
jmp 0x1e715d
xorl %r15d, %r15d
xorl %eax, %eax
testb %al, %al
je 0x1e72f3
movq $0x0, 0x10(%rsp)
movq $-0x1, 0x30(%rsp)
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x1e71a8
callq 0x170e0
movq 0xb0(%rbx), %rdi
incq %rdi
leaq 0x1d465b(%rip), %rsi    # 0x3bb7f4
movl $0x7da, %edx            # imm = 0x7DA
callq 0x1092b2
movq %rax, %r13
jmp 0x1e71ab
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
movl %ebp, 0x1c(%rsp)
cmpq $0x0, 0xb8(%rbx)
je 0x1e7299
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x1e71dd
callq 0xe926a
movq %rax, %r13
jmp 0x1e71f4
movl 0xb0(%rbx), %esi
incl %esi
movq 0xa0(%rbx), %rdx
movq %r13, %rdi
callq 0x12557d
testq %r14, %r14
je 0x1e720f
movq %rbp, %rax
shrq $0x6, %rax
movq (%r14,%rax,8), %rax
movl %ebp, %ecx
shlq %cl, %rax
shrq $0x3f, %rax
jne 0x1e7289
movq %r13, %rdi
callq 0x172f0
movq %rax, %r12
cmpb $0x0, 0x4(%rsp)
je 0x1e722d
testq %r12, %r12
je 0x1e7316
decq %r12
cmpq 0x10(%rsp), %r12
jbe 0x1e7239
movq %r12, 0x10(%rsp)
testq %r15, %r15
je 0x1e7260
leaq -0x1(%r15), %rax
movq %rax, 0x28(%rsp)
movl $0x8, %esi
movl $0x1, %edx
leaq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rcx
callq 0x125658
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x1255e8
cmpb $0x0, 0x4(%rsp)
jne 0x1e7283
movl $0xa, %edi
movq 0x8(%rsp), %rsi
callq 0x1255d6
addq %r12, %r15
incq %r15
incq %rbp
cmpq 0xb8(%rbx), %rbp
jb 0x1e71c7
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq 0x8(%rsp), %r14
movq %r14, %rcx
callq 0x125658
leaq 0x30(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x125658
cmpq $0x0, 0xa0(%rbx)
je 0x1e72ea
leaq 0x1d4517(%rip), %rsi    # 0x3bb7f4
movq %r13, %rdi
movl $0x801, %edx            # imm = 0x801
callq 0x109670
movl 0x1c(%rsp), %ebp
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rdi
callq 0x101e80
movq %r15, %rdi
callq 0x101e80
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x75252
callq 0x752c4
callq 0x75219
callq 0x7528b