// File: /workspace/github_c_makefile_star2_O3/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 0x1afe20
movq %rcx, %r13
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movq %r8, 0x10(%rsp)
movq %r9, 0x8(%rsp)
movq 0x30(%rdi), %rax
movq 0x38(%rdi), %rbx
cmpq %rcx, %rbx
ja 0x1afcdf
leaq 0x1f71e7(%rip), %r15    # 0x3a6e38
movq %rbx, %xmm0
punpckldq 0x197c82(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x197c8a(%rip), %xmm0   # 0x3478f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x19809e(%rip), %xmm1   # 0x347d18
addsd 0x1f71ae(%rip), %xmm1   # 0x3a6e30
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
subsd 0x19808a(%rip), %xmm1   # 0x347d20
cvttsd2si %xmm1, %rsi
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x38(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
movq %r15, %rdx
movl $0x37, %ecx
callq 0x104461
movq %rax, 0x30(%r14)
movq 0x38(%r14), %rcx
cmpq %rcx, %rbx
jae 0x1afcd3
movq $0x0, (%rax,%rbx,8)
incq %rbx
jmp 0x1afcbd
movq %rcx, %rbx
cmpq %r13, %rcx
jbe 0x1afc51
incq (%rax,%r13,8)
testb %bpl, %bpl
je 0x1afcf2
movl $0x1, %eax
jmp 0x1afe1d
movq 0x10(%rsp), %rbx
leaq 0x1(%rbx), %rax
movq %rax, %rcx
imulq %rax, %rcx
movq %rcx, %xmm2
subq %r12, %rcx
movq %rcx, %xmm3
movq 0x197bc9(%rip), %xmm0   # 0x3478e0
punpckldq %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movapd 0x197bcd(%rip), %xmm1   # 0x3478f0
subpd %xmm1, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
mulsd 0x199aa5(%rip), %xmm4   # 0x3497e0
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 0x197fbd(%rip), %xmm4   # 0x347d20
cvttsd2si %xmm4, %rcx
sarq $0x3f, %rsi
andq %rsi, %rcx
orq %rdx, %rcx
cmpq $0x65, %rcx
jae 0x1afe2f
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)
jae 0x1afdd6
movq 0x18(%r14), %rax
jmp 0x1afdff
leaq 0x20(%rax), %rcx
movq %rcx, 0x20(%r14)
movq 0x18(%r14), %rdi
leaq 0x100(,%rax,8), %rsi
leaq 0x1f7047(%rip), %rdx    # 0x3a6e38
movl $0x4c, %ecx
callq 0x104461
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x1afe34
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 0x64c53
callq 0x64c8a