// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/rdj-contigs-writer.c
// Function: gt_contigs_writer_write
void gt_contigs_writer_write(GtContigsWriter *contigs_writer)
{
  gt_assert(contigs_writer != NULL);

  if (contigs_writer->contig.nextfreechar > 0)
  {
    gt_assembly_stats_calculator_add(contigs_writer->asc,
        contigs_writer->contig.nextfreechar);
    /* build description */
    gt_str_append_cstr(contigs_writer->contig_desc, "contig_");
    gt_str_append_uword(contigs_writer->contig_desc,
        contigs_writer->contignum);
    contigs_writer->depthinfo.length = contigs_writer->contig.nextfreechar;
    gt_str_append_cstr(contigs_writer->contig_desc, " length=");
    gt_str_append_uword(contigs_writer->contig_desc,
        contigs_writer->depthinfo.length);
    gt_str_append_cstr(contigs_writer->contig_desc, " depth=");
    gt_str_append_uword(contigs_writer->contig_desc,
        contigs_writer->depthinfo.depth);
    if (contigs_writer->rcn != NULL)
    {
      contigs_writer->depthinfo.internal_copynum -= (float)contigs_writer->rcn[
        GT_CONTIGS_WRITER_READNUM(contigs_writer->lastseqnum,
            contigs_writer->nofseqs)];
      contigs_writer->depthinfo.lastread_copynum = (float)contigs_writer->rcn[
        GT_CONTIGS_WRITER_READNUM(contigs_writer->lastseqnum,
            contigs_writer->nofseqs)];
      gt_str_append_cstr(contigs_writer->contig_desc, " k=");
      gt_str_append_double(contigs_writer->contig_desc,
          (double)contigs_writer->depthinfo.internal_copynum, 2);
    }
    if (contigs_writer->calculate_astat)
    {
      float astat;
      float k = (float)0;
      if (contigs_writer->rcn != NULL)
        k = contigs_writer->depthinfo.internal_copynum;
      else
      {
        if (contigs_writer->depthinfo.depth > 2UL)
          k = (float)(contigs_writer->depthinfo.depth - 2UL);
      }
      astat = - (k * (float)log((double)2));
      if (contigs_writer->contig.nextfreechar + 1UL > contigs_writer->rlen)
      {
        astat += contigs_writer->arrival_rate * (
            contigs_writer->contig.nextfreechar + 1UL - contigs_writer->rlen);
      }
      gt_str_append_cstr(contigs_writer->contig_desc, " astat=");
      gt_str_append_double(contigs_writer->contig_desc, (double)astat, 6);
      contigs_writer->depthinfo.astat = astat;
    }
    gt_str_append_cstr(contigs_writer->contig_desc, " ");
    if (!contigs_writer->show_paths && contigs_writer->depthinfo.depth > 1UL)
    {
      /* show path summary only */
      gt_str_append_cstr(contigs_writer->path_desc,
          contigs_writer->depthinfo.depth > 2UL ? "-->...-->" :
          "-->");
      gt_str_append_uword(contigs_writer->path_desc,
          GT_CONTIGS_WRITER_READNUM(contigs_writer->lastseqnum,
              contigs_writer->nofseqs));
      gt_str_append_char(contigs_writer->path_desc,
          GT_CONTIGS_WRITER_LETTER(contigs_writer->lastseqnum,
              contigs_writer->nofseqs));
    }
    gt_str_append_str(contigs_writer->contig_desc, contigs_writer->path_desc);

    gt_fasta_show_entry(gt_str_get(contigs_writer->contig_desc),
        contigs_writer->contig.spacechar, contigs_writer->contig.nextfreechar,
        60UL, contigs_writer->outfp);
    if (contigs_writer->depthinfo_fp != NULL)
    {
      gt_xfwrite(&contigs_writer->depthinfo,
          sizeof (contigs_writer->depthinfo), (size_t)1,
          contigs_writer->depthinfo_fp);
    }
    contigs_writer->contignum++;
    gt_contigs_writer_reset_buffers(contigs_writer);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x178c50
movq %rdi, %rbx
movq 0x38(%rdi), %rsi
testq %rsi, %rsi
je 0x178ac1
movq 0x18(%rbx), %rdi
callq 0xbaa5e
movq 0x40(%rbx), %rdi
leaq 0x1d58c6(%rip), %rsi    # 0x34e294
callq 0xacbfb
movq 0x40(%rbx), %rdi
movq 0x50(%rbx), %rsi
callq 0xace26
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %rdi
movq %rax, 0x80(%rbx)
leaq 0x1d58a6(%rip), %rsi    # 0x34e29c
callq 0xacbfb
movq 0x40(%rbx), %rdi
movq 0x80(%rbx), %rsi
callq 0xace26
movq 0x40(%rbx), %rdi
leaq 0x1d588f(%rip), %rsi    # 0x34e2a5
callq 0xacbfb
movq 0x40(%rbx), %rdi
movq 0x78(%rbx), %rsi
callq 0xace26
movq 0x98(%rbx), %rax
testq %rax, %rax
je 0x178a9f
movq 0x40(%rbx), %rdi
movq 0x58(%rbx), %rcx
movq 0x60(%rbx), %rdx
movq %rcx, %rsi
notq %rsi
addq %rdx, %rsi
shrq %rdx
cmpq %rdx, %rcx
cmovbq %rcx, %rsi
movzbl (%rax,%rsi), %ecx
cvtsi2ss %ecx, %xmm0
movss 0x8c(%rbx), %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0x8c(%rbx)
movzbl (%rax,%rsi), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x90(%rbx)
leaq 0x1d5827(%rip), %rsi    # 0x34e2ad
callq 0xacbfb
movq 0x40(%rbx), %rdi
cvtss2sd 0x8c(%rbx), %xmm0
pushq $0x2
popq %rsi
callq 0xacfff
leaq 0x78(%rbx), %r14
cmpb $0x1, 0x11(%rbx)
jne 0x178b7c
cmpq $0x0, 0x98(%rbx)
je 0x178ac9
movss 0x8c(%rbx), %xmm2
jmp 0x178af7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%r14), %rax
xorps %xmm2, %xmm2
cmpq $0x3, %rax
jb 0x178af7
addq $-0x2, %rax
js 0x178ae2
cvtsi2ss %rax, %xmm2
jmp 0x178af7
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
mulss 0x1d5701(%rip), %xmm2   # 0x34e200
movq 0x38(%rbx), %rax
incq %rax
subq 0x68(%rbx), %rax
jbe 0x178b46
movq %rax, %xmm0
punpckldq 0x16edc7(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x16edcf(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x70(%rbx), %xmm1
cvtss2sd %xmm2, %xmm0
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
jmp 0x178b4c
movss %xmm2, 0x4(%rsp)
movq 0x40(%rbx), %rdi
leaq 0x1d575a(%rip), %rsi    # 0x34e2b1
callq 0xacbfb
movq 0x40(%rbx), %rdi
cvtss2sd 0x4(%rsp), %xmm0
pushq $0x6
popq %rsi
callq 0xacfff
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x94(%rbx)
movq 0x40(%rbx), %rdi
leaq 0x1e99a9(%rip), %rsi    # 0x362530
callq 0xacbfb
cmpb $0x0, 0x10(%rbx)
jne 0x178bf6
cmpq $0x2, (%r14)
jb 0x178bf6
movq 0x48(%rbx), %rdi
leaq 0x1d571c(%rip), %rax    # 0x34e2bf
leaq 0x1d570f(%rip), %rsi    # 0x34e2b9
cmoveq %rax, %rsi
callq 0xacbfb
movq 0x48(%rbx), %rdi
movq 0x58(%rbx), %rax
movq 0x60(%rbx), %rcx
movq %rax, %rsi
notq %rsi
addq %rcx, %rsi
shrq %rcx
cmpq %rcx, %rax
cmovbq %rax, %rsi
callq 0xace26
movq 0x48(%rbx), %rdi
movq 0x60(%rbx), %rax
shrq %rax
xorl %ecx, %ecx
cmpq %rax, 0x58(%rbx)
setb %cl
leal (%rcx,%rcx,2), %esi
addl $0x42, %esi
callq 0xaced9
movq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0xacd13
movq 0x40(%rbx), %rdi
callq 0xad1fa
movq 0x8(%rbx), %r8
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rdx
pushq $0x3c
popq %rcx
movq %rax, %rdi
callq 0x8c0bc
movq 0xa0(%rbx), %rcx
testq %rcx, %rcx
je 0x178c3d
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0xb302c
incq 0x50(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x178972
movq 0x2bf311(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16c3b2(%rip), %rsi    # 0x2e5013
leaq 0x1d55e5(%rip), %rdx    # 0x34e24d
leaq 0x1d560d(%rip), %rcx    # 0x34e27c
leaq 0x1d55a4(%rip), %r8     # 0x34e21a
movl $0x9f, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390