// File: /workspace/github_c_makefile_star2_O2/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 0x15d4fa
movq %rcx, %r13
movl %esi, %ebp
movq %rdi, %r14
movq %rdx, 0x8(%rsp)
movq %r8, 0x10(%rsp)
movq %r9, (%rsp)
movq 0x38(%rdi), %r12
movq 0x18a5be(%rip), %xmm4   # 0x2e78e0
leaq 0x1e9e8f(%rip), %r15    # 0x3471b8
pushq $0x37
popq %rbx
cmpq %r13, %r12
ja 0x15d3bd
movq %r12, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd 0x18a5aa(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x18a9be(%rip), %xmm1   # 0x2e7d18
addsd 0x1e9e4e(%rip), %xmm1   # 0x3471b0
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x18a9aa(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movq %rsi, 0x38(%r14)
movq 0x30(%r14), %rdi
shlq $0x3, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x93472
movq 0x18a541(%rip), %xmm4   # 0x2e78e0
movq %rax, 0x30(%r14)
movq %r12, %rcx
movq 0x38(%r14), %r12
cmpq %r12, %rcx
jae 0x15d32c
andq $0x0, (%rax,%rcx,8)
incq %rcx
jmp 0x15d3a6
movq 0x30(%r14), %rax
incq (%rax,%r13,8)
testb %bpl, %bpl
je 0x15d3d2
pushq $0x1
popq %rax
jmp 0x15d4f7
movq 0x10(%rsp), %rbx
leaq 0x1(%rbx), %rax
movq %rax, %rcx
imulq %rax, %rcx
movq %rcx, %xmm1
movq 0x8(%rsp), %rdi
subq %rdi, %rcx
movq %rcx, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movapd 0x18a4f0(%rip), %xmm0   # 0x2e78f0
subpd %xmm0, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd 0x18c3c8(%rip), %xmm3   # 0x2e97e0
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm0, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm3
cvttsd2si %xmm3, %rdx
movq %rdx, %rsi
subsd 0x18a8e0(%rip), %xmm3   # 0x2e7d20
cvttsd2si %xmm3, %rcx
sarq $0x3f, %rsi
andq %rsi, %rcx
orq %rdx, %rcx
cmpq $0x65, %rcx
jae 0x15d509
movq %rdi, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm0, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movq %rax, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd %xmm0, %xmm2
addsd 0x50(%r14), %xmm2
movsd %xmm2, 0x50(%r14)
movq 0x8(%r14), %rax
incq (%rax,%rcx,8)
movq 0x20(%r14), %rax
cmpq %rax, 0x28(%r14)
jae 0x15d4b3
movq 0x18(%r14), %rax
jmp 0x15d4da
leaq 0x20(%rax), %rcx
movq %rcx, 0x20(%r14)
movq 0x18(%r14), %rdi
leaq 0x100(,%rax,8), %rsi
leaq 0x1e9cea(%rip), %rdx    # 0x3471b8
pushq $0x4c
popq %rcx
callq 0x93472
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x15d533
movq 0x28(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x28(%r14)
movq %rbx, (%rax,%rcx,8)
addq $0x48, %r14
movq (%rsp), %rax
addq %rax, (%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2daa58(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x187af9(%rip), %rsi    # 0x2e5013
leaq 0x1e9cff(%rip), %rdx    # 0x347220
leaq 0x1e9ce5(%rip), %rcx    # 0x34720d
leaq 0x1e9c89(%rip), %r8     # 0x3471b8
pushq $0x49
jmp 0x15d55b
movq 0x2daa2e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x187acf(%rip), %rsi    # 0x2e5013
leaq 0x1e9ce9(%rip), %rdx    # 0x347234
leaq 0x1e9cbb(%rip), %rcx    # 0x34720d
leaq 0x1e9c5f(%rip), %r8     # 0x3471b8
pushq $0x4c
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390