// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rsi, %r14
movq %rdi, %rbx
movb $0x1, %al
movl %eax, 0xc(%rsp)
cmpq $0x0, 0xa0(%rdi)
jne 0x1dd878
cmpq $0x0, 0x98(%rbx)
je 0x1dd870
movb 0xa8(%rbx), %al
xorb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x1dd878
movl $0x0, 0xc(%rsp)
testq %r12, %r12
je 0x1dd88d
movq %r12, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1ddacf
cmpq $0x0, 0x98(%rbx)
jne 0x1dd8a5
cmpq $0x0, 0xa0(%rbx)
je 0x1ddad4
movq (%rbx), %rdi
callq 0x11b0a1
leaq 0x169171(%rip), %rsi    # 0x346a25
leaq 0x178226(%rip), %rdx    # 0x355ae1
leaq 0x1d4932(%rip), %rcx    # 0x3b21f4
movq %rax, %rdi
movl $0x7cb, %r8d            # imm = 0x7CB
movq %r12, %r9
callq 0xfcf97
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1dd95b
movq (%rbx), %rdi
callq 0x11b0a1
leaq 0x169139(%rip), %rsi    # 0x346a2a
leaq 0x1781e9(%rip), %rdx    # 0x355ae1
leaq 0x1d48f5(%rip), %rcx    # 0x3b21f4
movq %rax, %rdi
movl $0x7d0, %r8d            # imm = 0x7D0
movq %r12, %r9
callq 0xfcf97
testq %rax, %rax
je 0x1dd95b
movq %rax, %r15
movq $0x0, 0x18(%rsp)
movq $-0x1, 0x30(%rsp)
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x1dd962
callq 0x170e0
movq 0xb0(%rbx), %rdi
incq %rdi
leaq 0x1d48a8(%rip), %rsi    # 0x3b21f4
movl $0x7da, %edx            # imm = 0x7DA
callq 0x104226
movq %rax, %r13
jmp 0x1dd965
xorl %ebx, %ebx
jmp 0x1ddaa7
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
cmpq $0x0, 0xb8(%rbx)
je 0x1dda4f
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x1dd993
callq 0xe4d8e
movq %rax, %r13
jmp 0x1dd9aa
movl 0xb0(%rbx), %esi
incl %esi
movq 0xa0(%rbx), %rdx
movq %r13, %rdi
callq 0x11f7c1
testq %r14, %r14
je 0x1dd9c5
movq %rbp, %rax
shrq $0x6, %rax
movq (%r14,%rax,8), %rax
movl %ebp, %ecx
shlq %cl, %rax
shrq $0x3f, %rax
jne 0x1dda3f
movq %r13, %rdi
callq 0x172f0
movq %rax, %r12
cmpb $0x0, 0xc(%rsp)
je 0x1dd9e3
testq %r12, %r12
je 0x1ddaca
decq %r12
cmpq 0x18(%rsp), %r12
jbe 0x1dd9ef
movq %r12, 0x18(%rsp)
testq %r15, %r15
je 0x1dda16
leaq -0x1(%r15), %rax
movq %rax, 0x28(%rsp)
movl $0x8, %esi
movl $0x1, %edx
leaq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rcx
callq 0x11f89c
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x11f82c
cmpb $0x0, 0xc(%rsp)
jne 0x1dda39
movl $0xa, %edi
movq 0x10(%rsp), %rsi
callq 0x11f81a
addq %r12, %r15
incq %r15
incq %rbp
cmpq 0xb8(%rbx), %rbp
jb 0x1dd97d
leaq 0x18(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq 0x10(%rsp), %r14
movq %r14, %rcx
callq 0x11f89c
leaq 0x30(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11f89c
cmpq $0x0, 0xa0(%rbx)
je 0x1ddaa0
leaq 0x1d4761(%rip), %rsi    # 0x3b21f4
movq %r13, %rdi
movl $0x801, %edx            # imm = 0x801
callq 0x1045eb
xorl %ebp, %ebp
movq 0x20(%rsp), %rbx
movq 0x10(%rsp), %rdi
callq 0xfd018
movq %rbx, %rdi
callq 0xfd018
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x73637
callq 0x735fe
callq 0x73670