// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/condenseq.c
// Function: gt_condenseq_output_to_gff3
int gt_condenseq_output_to_gff3(const GtCondenseq *condenseq,
                                GtError *err)
{
  int had_err = 0;
  GtUword idx,
          name_len,
          seqnum = 0, seqstart = 0, seqend = 0,
          desclen;
  GtStr *filename = NULL,
        *id = gt_str_new_cstr("U"),
        *name = gt_str_new_cstr("unique"),
        *parent_unique = gt_str_new_cstr("U"),
        *seqid = gt_str_new(),
        *source = gt_str_new_cstr("Condenseq");
  GtFile *outfile = NULL;
  GtGFF3Visitor *gffv = NULL;
  GtNodeVisitor *nodev = NULL;
  GtFeatureNode *fnode = NULL;
  GtGenomeNode *node = NULL;
  GtRange range;

  gt_assert(condenseq != NULL);

  filename = gt_str_new_cstr(gt_condenseq_basefilename(condenseq));

  name_len = gt_str_length(name);
  gt_str_append_cstr(filename, ".gff3");
  outfile = gt_file_new(gt_str_get(filename), "w", err);
  nodev = gt_gff3_visitor_new(outfile);
  gffv = (GtGFF3Visitor *) nodev;
  gt_gff3_visitor_retain_id_attributes(gffv);

  node = gt_feature_node_new(seqid, "experimental_feature", (GtUword) 1,
                             (GtUword) 1, GT_STRAND_BOTH);
  fnode = (GtFeatureNode*) node;
  gt_feature_node_set_source(fnode, source);
  for (idx = 0; !had_err && idx < condenseq->uds_nelems; ++idx) {
    GtCondenseqUnique uq = condenseq->uniques[idx];
    if (seqend <= uq.orig_startpos) {
      const char *desc;
      gt_genome_node_delete(node);
      seqnum = gt_condenseq_pos2seqnum(condenseq, uq.orig_startpos);
      seqstart = gt_condenseq_seqstartpos(condenseq, seqnum);
      seqend = seqstart + condenseq_seqlength_help(condenseq, seqnum, seqstart);
      desc = gt_condenseq_description(condenseq, &desclen, seqnum);
      gt_str_reset(seqid);
      gt_str_append_cstr_nt(seqid, desc, desclen);
      node = gt_feature_node_new(seqid, "experimental_feature", (GtUword) 1,
                                 (GtUword) 1, GT_STRAND_BOTH);
      fnode = (GtFeatureNode*) node;
      gt_feature_node_set_source(fnode, source);
    }
    gt_str_set_length(name, name_len);
    gt_str_append_uword(name, idx);
    gt_str_set_length(id, (GtUword) 1);
    gt_str_append_uword(id, idx);
    gt_feature_node_set_attribute(fnode, "Name", gt_str_get(name));
    gt_feature_node_set_attribute(fnode, "ID", gt_str_get(id));
    /* 1 Based coordinates! */
    range.start = uq.orig_startpos + 1 - seqstart;
    range.end = uq.orig_startpos + uq.len - seqstart;
    gt_genome_node_set_range(node, &range);
    had_err = gt_genome_node_accept(node, nodev, err);
  }
  gt_str_reset(name);
  gt_str_append_cstr(name, "link");
  gt_str_reset(id);
  gt_str_append_cstr(id, "L");
  name_len = gt_str_length(name);
  seqend = 0;
  for (idx = 0; !had_err && idx < condenseq->lds_nelems; ++idx) {
    GtCondenseqLink link = condenseq->links[idx];
    if (seqend <= link.orig_startpos) {
      const char *desc;
      gt_genome_node_delete(node);
      seqnum = gt_condenseq_pos2seqnum(condenseq, link.orig_startpos);
      seqstart = gt_condenseq_seqstartpos(condenseq, seqnum);
      seqend = seqstart + condenseq_seqlength_help(condenseq, seqnum, seqstart);
      desc = gt_condenseq_description(condenseq, &desclen, seqnum);
      gt_str_reset(seqid);
      gt_str_append_cstr_nt(seqid, desc, desclen);
      node = gt_feature_node_new(seqid, "experimental_feature", (GtUword) 1,
                                 (GtUword) 1, GT_STRAND_BOTH);
      fnode = (GtFeatureNode*) node;
      gt_feature_node_set_source(fnode, source);
    }
    gt_str_set_length(name, name_len);
    gt_str_append_uword(name, idx);
    gt_str_set_length(id, (GtUword) 1);
    gt_str_append_uword(id, idx);
    gt_feature_node_set_attribute(fnode, "Name", gt_str_get(name));
    gt_feature_node_set_attribute(fnode, "ID", gt_str_get(id));
    gt_str_set_length(parent_unique, (GtUword) 1);
    gt_str_append_uword(parent_unique, link.unique_id);
    gt_feature_node_set_attribute(fnode, "Derives_from",
                                  gt_str_get(parent_unique));
    /* 1 Based coordinates! */
    range.start = link.orig_startpos + 1 - seqstart;
    range.end = link.orig_startpos + link.len - seqstart;
    gt_genome_node_set_range(node, &range);
    had_err = gt_genome_node_accept(node, nodev, err);
  }
  gt_file_delete(outfile);
  gt_genome_node_delete(node);
  gt_node_visitor_delete(nodev);
  gt_str_delete(filename);
  gt_str_delete(id);
  gt_str_delete(name);
  gt_str_delete(parent_unique);
  gt_str_delete(seqid);
  gt_str_delete(source);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %rbp
leaq 0x2637a5(%rip), %rbx    # 0x39723f
movq %rbx, %rdi
callq 0x120955
movq %rax, 0x30(%rsp)
leaq 0x272a22(%rip), %rdi    # 0x3a64d0
callq 0x120955
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x120955
movq %rax, 0x60(%rsp)
callq 0x1208f8
movq %rax, %rbx
leaq 0x24eafd(%rip), %rdi    # 0x3825d1
callq 0x120955
testq %rbp, %rbp
je 0x1340b9
movq %rax, %r13
movq %rbp, %rdi
callq 0x132fa0
movq %rax, %rdi
callq 0x120955
movq %rax, %r12
movq 0x28(%rsp), %rdi
callq 0x120d4c
movq %rax, 0x10(%rsp)
leaq 0x24eae9(%rip), %rsi    # 0x3825f7
movq %r12, %rdi
callq 0x12097f
movq %r12, 0x88(%rsp)
movq %r12, %rdi
callq 0x120d23
leaq 0x268f04(%rip), %rsi    # 0x39ca31
movq %rax, %rdi
movq %r15, %rdx
callq 0x103957
movq %rax, 0x80(%rsp)
movq %rax, %rdi
callq 0x1530bc
movq %rax, 0x48(%rsp)
movq %rax, %rdi
callq 0x1531cf
leaq 0x21d63f(%rip), %rsi    # 0x35119b
movl $0x1, %edx
movl $0x1, %ecx
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
movl $0x2, %r8d
callq 0x14952c
movq %rax, %r14
movq %rax, %rdi
movq %r13, 0x38(%rsp)
movq %r13, %rsi
callq 0x1491f1
cmpq $0x0, 0x98(%rbp)
movq %r15, 0x68(%rsp)
movq %rbp, 0x20(%rsp)
je 0x133d91
movl $0x20, %ebx
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %r14, %rdi
movq 0x10(%rbp), %rax
movq -0x8(%rax,%rbx), %r14
movl (%rax,%rbx), %eax
movq %rax, (%rsp)
cmpq %r14, 0x18(%rsp)
movq %r14, 0x50(%rsp)
jbe 0x133be5
movq %rdi, %r15
jmp 0x133cb2
callq 0x14c43a
cmpq $0x2, 0x80(%rbp)
jb 0x133c05
movq 0x28(%rbp), %rdi
movq %r14, %rsi
callq 0x15e36d
movq %rax, %r15
jmp 0x133c08
xorl %r15d, %r15d
testq %r15, %r15
je 0x133c24
movq 0x28(%rbp), %rdi
leaq -0x1(%r15), %rsi
callq 0x15e2ef
incq %rax
movq %rax, 0x8(%rsp)
jmp 0x133c2d
movq $0x0, 0x8(%rsp)
movq 0x80(%rbp), %rax
decq %rax
cmpq %r15, %rax
jbe 0x133c4a
movq 0x28(%rbp), %rdi
movq %r15, %rsi
callq 0x15e2ef
jmp 0x133c4e
movq 0x78(%rbp), %rax
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
movq %r15, %rdx
callq 0x131be9
movq %rax, %r15
movq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x120db4
movq 0x58(%rsp), %rdx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x120a9d
movl $0x1, %edx
movl $0x1, %ecx
movq %rbp, %rdi
leaq 0x21d504(%rip), %rsi    # 0x35119b
movl $0x2, %r8d
callq 0x14952c
movq %rax, %r15
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x1491f1
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x120d59
movq %r14, %rdi
movq %r12, %rsi
callq 0x120af4
movl $0x1, %esi
movq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x120d59
movq %r13, %rdi
movq %r12, %rsi
callq 0x120af4
movq %r14, %rdi
callq 0x120d23
movq %r15, %rdi
leaq 0x277950(%rip), %rsi    # 0x3ab64e
movq %rax, %rdx
callq 0x149c3c
movq %r13, %rdi
callq 0x120d23
movq %r15, %rdi
leaq 0x2b0054(%rip), %rsi    # 0x3e3d6c
movq %rax, %rdx
callq 0x149c3c
movq 0x50(%rsp), %rdx
movq %rdx, %rax
movq 0x8(%rsp), %rcx
subq %rcx, %rax
incq %rax
movq %rax, 0x70(%rsp)
movq (%rsp), %rax
addq %rdx, %rax
subq %rcx, %rax
movq %rax, 0x78(%rsp)
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x14b940
movq %r15, %r14
movq %r15, %rdi
movq 0x48(%rsp), %rsi
movq 0x68(%rsp), %r15
movq %r15, %rdx
callq 0x14b992
movl %eax, %r13d
testl %eax, %eax
jne 0x133d9f
incq %r12
addq $0x28, %rbx
movq 0x20(%rsp), %rbp
cmpq 0x98(%rbp), %r12
movq %r14, %rdi
jb 0x133bc1
jmp 0x133da7
movq $0x0, 0x8(%rsp)
xorl %r13d, %r13d
jmp 0x133da4
movq 0x20(%rsp), %rbp
movq %r14, %rdi
movq %rdi, (%rsp)
movq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x120db4
leaq 0x21eb86(%rip), %rsi    # 0x352945
movq %r14, %rdi
callq 0x12097f
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x120db4
leaq 0x25167d(%rip), %rsi    # 0x385458
movq %rbx, %rdi
callq 0x12097f
movq %r14, %rdi
callq 0x120d4c
testl %r13d, %r13d
je 0x133e6a
movq (%rsp), %rdi
movq %rdi, %rbx
movq 0x80(%rsp), %rdi
callq 0x1040fc
movq %rbx, %rdi
callq 0x14c43a
movq 0x48(%rsp), %rdi
callq 0x16b162
movq 0x88(%rsp), %rdi
callq 0x121b03
movq 0x30(%rsp), %rdi
callq 0x121b03
movq 0x28(%rsp), %rdi
callq 0x121b03
movq 0x60(%rsp), %rdi
callq 0x121b03
movq 0x40(%rsp), %rdi
callq 0x121b03
movq 0x38(%rsp), %rdi
callq 0x121b03
movl %r13d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x70(%rbp)
je 0x133df0
movq %rax, 0x90(%rsp)
movl $0x14, %ebx
movq $0x0, 0x10(%rsp)
xorl %r12d, %r12d
movq (%rsp), %rdi
movq 0x8(%rbp), %rax
movq -0xc(%rax,%rbx), %r13
movl -0x4(%rax,%rbx), %ecx
movq %rcx, (%rsp)
movl (%rax,%rbx), %eax
movq %rax, 0x18(%rsp)
cmpq %r13, 0x10(%rsp)
movq %r13, 0x50(%rsp)
jbe 0x133ebf
movq %rdi, %rbp
jmp 0x133f9b
callq 0x14c43a
cmpq $0x2, 0x80(%rbp)
jb 0x133edf
movq 0x28(%rbp), %rdi
movq %r13, %rsi
callq 0x15e36d
movq %rax, %r14
jmp 0x133ee2
xorl %r14d, %r14d
testq %r14, %r14
je 0x133f03
movq 0x20(%rsp), %r15
movq 0x28(%r15), %rdi
leaq -0x1(%r14), %rsi
callq 0x15e2ef
incq %rax
movq %rax, 0x8(%rsp)
jmp 0x133f11
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r15
movq 0x80(%r15), %rax
decq %rax
cmpq %r14, %rax
jbe 0x133f2e
movq 0x28(%r15), %rdi
movq %r14, %rsi
callq 0x15e2ef
jmp 0x133f32
movq 0x78(%r15), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq 0x58(%rsp), %rsi
movq %r14, %rdx
callq 0x131be9
movq %rax, %r14
movq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x120db4
movq 0x58(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x120a9d
movl $0x1, %edx
movl $0x1, %ecx
movq %r15, %rdi
leaq 0x21d220(%rip), %rsi    # 0x35119b
movl $0x2, %r8d
callq 0x14952c
movq %rax, %rbp
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x1491f1
movq 0x68(%rsp), %r15
movq 0x28(%rsp), %r13
movq %r13, %rdi
movq 0x90(%rsp), %rsi
callq 0x120d59
movq %r13, %rdi
movq %r12, %rsi
callq 0x120af4
movl $0x1, %esi
movq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x120d59
movq %r14, %rdi
movq %r12, %rsi
callq 0x120af4
movq %r13, %rdi
callq 0x120d23
movq %rbp, %rdi
leaq 0x277664(%rip), %rsi    # 0x3ab64e
movq %rax, %rdx
callq 0x149c3c
movq %r14, %rdi
callq 0x120d23
movq %rbp, %rdi
leaq 0x2afd68(%rip), %rsi    # 0x3e3d6c
movq %rax, %rdx
callq 0x149c3c
movl $0x1, %esi
movq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x120d59
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x120af4
movq %r14, %rdi
callq 0x120d23
movq %rbp, %rdi
leaq 0x24e5c0(%rip), %rsi    # 0x3825fd
movq %rax, %rdx
callq 0x149c3c
movq 0x50(%rsp), %rdx
movq %rdx, %rax
movq 0x8(%rsp), %rcx
subq %rcx, %rax
incq %rax
movq %rax, 0x70(%rsp)
movq (%rsp), %rax
addq %rdx, %rax
subq %rcx, %rax
movq %rax, 0x78(%rsp)
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
callq 0x14b940
movq %rbp, %r14
movq %rbp, %rdi
movq 0x48(%rsp), %rsi
movq %r15, %rdx
callq 0x14b992
movl %eax, %r13d
testl %eax, %eax
jne 0x1340b1
incq %r12
addq $0x20, %rbx
movq 0x20(%rsp), %rbp
cmpq 0x70(%rbp), %r12
movq %r14, %rdi
jb 0x133e92
jmp 0x133df4
movq %r14, %rdi
jmp 0x133df4
callq 0x3e3a2