// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rsi, %rbx
incq 0x48(%rsi)
movq %rdi, 0x18(%rsp)
movl 0x8(%rsi), %eax
cmpb $0x0, 0x45(%rsi)
jne 0x1bc9f1
testl %eax, %eax
je 0x1bc887
movq 0x28(%rbx), %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
movl (%rsi,%rdi,4), %r8d
cmpl %edx, %r8d
cmoval %edi, %ecx
cmoval %r8d, %edx
incq %rdi
cmpq %rdi, %rax
jne 0x1bc86f
jmp 0x1bc88b
xorl %ecx, %ecx
xorl %edx, %edx
movl 0x24(%rbx), %esi
cmpl %esi, %edx
jb 0x1bc9f1
movq (%rbx), %r15
movq 0x30(%rbx), %rax
imull %ecx, %esi
movq (%rax,%rsi,8), %r12
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x1e2c2e
movq %r15, %rdi
movq %rax, %rsi
callq 0xeb6ee
movq %rax, %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0x1e2c38
movl 0x20(%rbx), %ecx
addq %r13, %rax
leaq (%rcx,%rax), %rsi
decq %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0xe7fcb
movl %eax, %r14d
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x1bca29
movb $0x3, %cl
subb %r14b, %cl
movb %cl, 0xf(%rsp)
movq 0x28(%rbx), %rcx
xorl %esi, %esi
movq 0x18(%rsp), %r15
movl (%rcx,%rsi,4), %edx
cmpl 0x24(%rbx), %edx
jae 0x1bc9e3
cmpl $0x0, (%rcx,%rsi,4)
je 0x1bc9e3
xorl %ebp, %ebp
movq %rsi, 0x20(%rsp)
movl 0x24(%rbx), %eax
imull %esi, %eax
shlq $0x3, %rax
addq 0x30(%rbx), %rax
movq (%rax,%rbp,8), %r12
movq (%rbx), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x1e2c2e
movq %r13, %rdi
movq %rax, %rsi
callq 0xeb6ee
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x1e2c38
addq %r13, %rax
movl 0x20(%rbx), %esi
leaq (%rsi,%rax), %rcx
decq %rcx
movq %rcx, 0x10(%rsp)
movl %r14d, %edx
cmpq 0x10(%rbx), %rcx
jb 0x1bc98a
addq %rsi, %rax
movq 0x18(%rbx), %rcx
subq %rax, %rcx
movq %rcx, 0x10(%rsp)
movb 0xf(%rsp), %dl
movq %rcx, %rax
shrq $0x3e, %rax
jne 0x1bca3d
cmpb $0x4, %dl
jae 0x1bca38
movzbl %dl, %eax
leaq (%rax,%rcx,4), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rcx
movl $0x8, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
callq 0x11f89c
incq 0x60(%rbx)
incq %rbp
movq 0x28(%rbx), %rcx
movq 0x20(%rsp), %rsi
movl (%rcx,%rsi,4), %eax
cmpq %rax, %rbp
jb 0x1bc923
movl 0x8(%rbx), %eax
incq %rsi
movl %eax, %edx
cmpq %rdx, %rsi
jb 0x1bc906
movw $0x100, 0x44(%rbx)      # imm = 0x100
movl $0x0, 0x40(%rbx)
testl %eax, %eax
je 0x1bca1a
movq 0x28(%rbx), %rax
xorl %ecx, %ecx
movl $0x0, (%rax,%rcx,4)
incq %rcx
movl 0x8(%rbx), %edx
cmpq %rdx, %rcx
jb 0x1bca08
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movw $0x100, 0x44(%rbx)      # imm = 0x100
movl $0x0, 0x40(%rbx)
jmp 0x1bca1a
callq 0x6839d
callq 0x68366