// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/randomcodes-correct.c
// Function: gt_randomcodes_correct_process_kmergroup_end
static inline void gt_randomcodes_correct_process_kmergroup_end(
    const GtSeqnumrelpos *snrp, GtRandomcodesCorrectData *cdata)
{
  cdata->nofkmergroups++;
  if (!cdata->alltrusted)
  {
    unsigned int i, max_count = 0, countpos = 0;
    for (i = 0; i < cdata->alphasize; i++)
    {
      if (cdata->count[i] > max_count)
      {
        max_count = cdata->count[i];
        countpos = i;
      }
    }
    if (max_count >= cdata->c)
    {
      const GtUword trusted_char_seqnumrelpos =
        (cdata->kpositions + countpos * cdata->c)[0];
      GtUchar trusted_char = gt_encseq_get_encoded_char_nospecial(cdata->encseq,
          gt_encseq_seqstartpos(cdata->encseq, gt_seqnumrelpos_decode_seqnum(
              snrp,trusted_char_seqnumrelpos)) + gt_seqnumrelpos_decode_relpos(
              snrp,trusted_char_seqnumrelpos) + cdata->k - 1,
          GT_READMODE_FORWARD);
      for (i = 0; i < cdata->alphasize; i++)
      {
        unsigned int j;
        if (cdata->count[i] < cdata->c)
        {
          for (j = 0; j < cdata->count[i]; j++)
          {
            GtUchar newchar = trusted_char;
            const GtUword
              seqnumrelpos = (cdata->kpositions + i * cdata->c)[j];
            GtUword abspos;
            abspos = gt_encseq_seqstartpos(cdata->encseq,
                gt_seqnumrelpos_decode_seqnum(snrp,seqnumrelpos)) +
              gt_seqnumrelpos_decode_relpos(snrp,seqnumrelpos) + cdata->k - 1;
            if (abspos >= cdata->firstmirrorpos)
            {
              abspos = cdata->totallength - 1UL - abspos;
              newchar = (GtUchar)3 - newchar;
            }
            gt_assert(abspos <= (ULONG_MAX >> 2));
            gt_assert(newchar < (GtUchar)4);
            abspos <<= 2;
            abspos += newchar;
            gt_xfwrite(&abspos, sizeof (abspos), (size_t)1, cdata->outfile);
            cdata->nofcorrections++;
          }
        }
      }
    }
  }
  gt_randomcodes_correct_data_reset(cdata);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
incq 0x48(%rsi)
cmpb $0x0, 0x45(%rsi)
jne 0x16c228
movq %rdi, %r14
movl 0x8(%rbx), %ecx
xorl %edx, %edx
xorl %eax, %eax
xorl %esi, %esi
cmpq %rdx, %rcx
je 0x16c221
movq 0x28(%rbx), %rdi
movl (%rdi,%rdx,4), %edi
cmpl %esi, %edi
cmoval %edx, %eax
cmoval %edi, %esi
incq %rdx
jmp 0x16c208
movl 0x24(%rbx), %ecx
cmpl %ecx, %esi
jae 0x16c23f
movq %rbx, %rdi
callq 0x16c544
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %r15
movq 0x30(%rbx), %rdx
imull %eax, %ecx
movq (%rdx,%rcx,8), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x191c9c
movq %r15, %rdi
movq %rax, %rsi
callq 0x74d9c
movq %rax, %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0x191ca6
movl 0x20(%rbx), %ecx
addq %r13, %rax
leaq (%rcx,%rax), %rsi
decq %rsi
xorl %r13d, %r13d
movq %r15, %rdi
xorl %edx, %edx
callq 0x70bf6
movb $0x3, %cl
movb %al, 0xf(%rsp)
subb %al, %cl
movb %cl, 0xe(%rsp)
movl 0x8(%rbx), %eax
cmpq %rax, %r13
jae 0x16c228
movq 0x28(%rbx), %rax
movl (%rax,%r13,4), %eax
cmpl 0x24(%rbx), %eax
jae 0x16c368
xorl %ebp, %ebp
movl %eax, %eax
cmpq %rax, %rbp
jae 0x16c368
movl 0x24(%rbx), %eax
imull %r13d, %eax
shlq $0x3, %rax
addq 0x30(%rbx), %rax
movq (%rax,%rbp,8), %r15
movq (%rbx), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x191c9c
movq %r12, %rdi
movq %rax, %rsi
callq 0x74d9c
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x191ca6
addq %r12, %rax
movl 0x20(%rbx), %esi
leaq (%rsi,%rax), %rcx
decq %rcx
movq %rcx, 0x10(%rsp)
movb 0xf(%rsp), %dl
cmpq 0x10(%rbx), %rcx
jb 0x16c326
addq %rsi, %rax
movq 0x18(%rbx), %rcx
subq %rax, %rcx
movq %rcx, 0x10(%rsp)
movb 0xe(%rsp), %dl
movq %rcx, %rax
shrq $0x3e, %rax
jne 0x16c370
cmpb $0x4, %dl
jae 0x16c39a
movzbl %dl, %eax
leaq (%rax,%rcx,4), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rcx
leaq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0xb302c
incq 0x60(%rbx)
incq %rbp
movq 0x28(%rbx), %rax
movl (%rax,%r13,4), %eax
jmp 0x16c2b2
incq %r13
jmp 0x16c297
movq 0x2cbbf1(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x178c92(%rip), %rsi    # 0x2e5013
leaq 0x1dff14(%rip), %rdx    # 0x34c29c
leaq 0x1dff28(%rip), %rcx    # 0x34c2b7
leaq 0x1dfe58(%rip), %r8     # 0x34c1ee
pushq $0x79
jmp 0x16c3c2
movq 0x2cbbc7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x178c68(%rip), %rsi    # 0x2e5013
leaq 0x1dff32(%rip), %rdx    # 0x34c2e4
leaq 0x1dfefe(%rip), %rcx    # 0x34c2b7
leaq 0x1dfe2e(%rip), %r8     # 0x34c1ee
pushq $0x7a
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390