// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/ft-trimstat.c
// Function: gt_ft_trimstat_add
void gt_ft_trimstat_add(GtFtTrimstat *trimstat,
                        bool diedout,
                        GtUword sumvalid,
                        GtUword maxvalid,
                        GtUword d,
                        size_t spaceforfront)
{
  if (trimstat == NULL)
  {
    return;
  }
  while (maxvalid >= trimstat->maxvalid_dist.allocatedGtUword)
  {
    GtUword idx;
    const GtUword allocated = trimstat->maxvalid_dist.allocatedGtUword;

    trimstat->maxvalid_dist.allocatedGtUword
      = trimstat->maxvalid_dist.allocatedGtUword * 1.2 + 128UL;
    trimstat->maxvalid_dist.spaceGtUword
      = gt_realloc(trimstat->maxvalid_dist.spaceGtUword,
                   sizeof *trimstat->maxvalid_dist.spaceGtUword *
                   trimstat->maxvalid_dist.allocatedGtUword);
    for (idx = allocated; idx < trimstat->maxvalid_dist.allocatedGtUword; idx++)
    {
      trimstat->maxvalid_dist.spaceGtUword[idx] = 0;
    }
  }
  gt_assert(maxvalid < trimstat->maxvalid_dist.allocatedGtUword);
  trimstat->maxvalid_dist.spaceGtUword[maxvalid]++;
  if (diedout)
  {
    trimstat->diedout++;
  } else
  {
    const GtUword fullfronts = (d+1) * (d+1);
    GtUword percentage;

    percentage
      = (GtUword) (100.0 * (double) (fullfronts - sumvalid)/fullfronts);
    gt_assert(percentage <= 100UL);
    trimstat->sum_meanvalid += (double) sumvalid/(d+1);
    trimstat->trim_dist[percentage]++;
    GT_CHECKARRAYSPACE(&trimstat->distance_dist,GtUword,32);
    trimstat->distance_dist.spaceGtUword[trimstat->
                                         distance_dist.nextfreeGtUword++] = d;
    trimstat->spaceforfront_total += spaceforfront;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x1b8959
movq %rcx, %r13
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movq %r8, 0x10(%rsp)
movq %r9, 0x8(%rsp)
movq 0x38(%rdi), %rbx
cmpq %rcx, %rbx
ja 0x1b8816
leaq 0x1f7c4f(%rip), %r15    # 0x3b03d8
movq %rbx, %xmm0
punpckldq 0x19814a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x198152(%rip), %xmm0   # 0x3508f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x198566(%rip), %xmm1   # 0x350d18
addsd 0x1f7c16(%rip), %xmm1   # 0x3b03d0
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x198552(%rip), %xmm1   # 0x350d20
cvttsd2si %xmm1, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movq %rsi, 0x38(%r14)
movq 0x30(%r14), %rdi
shlq $0x3, %rsi
movq %r15, %rdx
movl $0x37, %ecx
callq 0x1094e6
movq %rax, 0x30(%r14)
cmpq 0x38(%r14), %rbx
jae 0x1b8809
movq $0x0, (%rax,%rbx,8)
incq %rbx
jmp 0x1b87f6
movq 0x38(%r14), %rbx
cmpq %r13, %rbx
jbe 0x1b8789
movq 0x30(%r14), %rax
incq (%rax,%r13,8)
testb %bpl, %bpl
je 0x1b882d
movl $0x1, %eax
jmp 0x1b8956
movq 0x10(%rsp), %rbx
leaq 0x1(%rbx), %rax
movq %rax, %rcx
imulq %rax, %rcx
movq %rcx, %xmm2
subq %r12, %rcx
movq %rcx, %xmm3
movq 0x19808e(%rip), %xmm0   # 0x3508e0
punpckldq %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movapd 0x198092(%rip), %xmm1   # 0x3508f0
subpd %xmm1, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
mulsd 0x199f7a(%rip), %xmm4   # 0x3527f0
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
divsd %xmm3, %xmm4
cvttsd2si %xmm4, %rdx
movq %rdx, %rsi
subsd 0x198482(%rip), %xmm4   # 0x350d20
cvttsd2si %xmm4, %rcx
sarq $0x3f, %rsi
andq %rsi, %rcx
orq %rdx, %rcx
cmpq $0x65, %rcx
jae 0x1b8968
movq %r12, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movq %rax, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
divsd %xmm0, %xmm3
addsd 0x50(%r14), %xmm3
movsd %xmm3, 0x50(%r14)
movq 0x8(%r14), %rax
incq (%rax,%rcx,8)
movq 0x20(%r14), %rax
cmpq %rax, 0x28(%r14)
jb 0x1b8934
leaq 0x20(%rax), %rcx
movq %rcx, 0x20(%r14)
movq 0x18(%r14), %rdi
leaq 0x100(,%rax,8), %rsi
leaq 0x1f7ab2(%rip), %rdx    # 0x3b03d8
movl $0x4c, %ecx
callq 0x1094e6
movq %rax, 0x18(%r14)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x1b896d
movq 0x28(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x28(%r14)
movq %rbx, (%rax,%rcx,8)
addq $0x48, %r14
movq 0x8(%rsp), %rax
addq %rax, (%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x663db
callq 0x66412