// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x48(%rax)
movq 0x68(%rsp), %rax
testb $0x1, 0x45(%rax)
jne 0x26bad0
movl $0x0, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x26b805
movq 0x68(%rsp), %rax
movq 0x28(%rax), %rax
movl 0x64(%rsp), %ecx
movl (%rax,%rcx,4), %eax
cmpl 0x60(%rsp), %eax
jbe 0x26b7f6
movq 0x68(%rsp), %rax
movq 0x28(%rax), %rax
movl 0x64(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, 0x60(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0x5c(%rsp)
jmp 0x26b7f8
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x26b7b6
movl 0x60(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl 0x24(%rcx), %eax
jb 0x26bace
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rax
movl 0x5c(%rsp), %ecx
movq 0x68(%rsp), %rdx
imull 0x24(%rdx), %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2b1230
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xb0530
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2b1250
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdi
addq %rax, %rsi
movq 0x68(%rsp), %rax
movl 0x20(%rax), %eax
addq %rax, %rsi
subq $0x1, %rsi
xorl %edx, %edx
callq 0xaa7f0
movb %al, 0x4f(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x26bacc
movq 0x68(%rsp), %rax
movq 0x28(%rax), %rax
movl 0x64(%rsp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x68(%rsp), %rcx
cmpl 0x24(%rcx), %eax
jae 0x26baba
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
movq 0x68(%rsp), %rcx
movq 0x28(%rcx), %rcx
movl 0x64(%rsp), %edx
cmpl (%rcx,%rdx,4), %eax
jae 0x26bab8
movb 0x4f(%rsp), %al
movb %al, 0x47(%rsp)
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rax
movl 0x64(%rsp), %ecx
movq 0x68(%rsp), %rdx
imull 0x24(%rdx), %ecx
movl %ecx, %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movl 0x48(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x2b1230
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xb0530
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x2b1250
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq %rcx, %rax
movq 0x68(%rsp), %rcx
movl 0x20(%rcx), %ecx
addq %rcx, %rax
subq $0x1, %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x68(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x26b9ca
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rax
subq $0x1, %rax
subq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movzbl 0x47(%rsp), %ecx
movl $0x3, %eax
subl %ecx, %eax
movb %al, 0x47(%rsp)
jmp 0x26b9cc
movabsq $0x3fffffffffffffff, %rax # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rax, 0x30(%rsp)
jbe 0x26ba15
movq 0x3d05bc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2aa625(%rip), %rsi    # 0x516013
leaq 0x312f8f(%rip), %rdx    # 0x57e984
leaq 0x312fa3(%rip), %rcx    # 0x57e99f
leaq 0x312ed3(%rip), %r8     # 0x57e8d6
movl $0x79, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x26ba17
jmp 0x26ba19
movzbl 0x47(%rsp), %eax
cmpl $0x4, %eax
jl 0x26ba5b
movq 0x3d0576(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2aa5df(%rip), %rsi    # 0x516013
leaq 0x312f91(%rip), %rdx    # 0x57e9cc
leaq 0x312f5d(%rip), %rcx    # 0x57e99f
leaq 0x312e8d(%rip), %r8     # 0x57e8d6
movl $0x7a, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x26ba5d
movq 0x30(%rsp), %rax
shlq $0x2, %rax
movq %rax, 0x30(%rsp)
movzbl 0x47(%rsp), %eax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x68(%rsp), %rax
movq 0x38(%rax), %rcx
leaq 0x30(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x26b8e9
jmp 0x26baba
jmp 0x26babc
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x26b8b1
jmp 0x26bace
jmp 0x26bad0
movq 0x68(%rsp), %rdi
callq 0x26bd40
addq $0x78, %rsp
retq
nop