// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-mrangealphabet.c
// Function: gt_MRAEncSecondaryMapping
MRAEnc *
gt_MRAEncSecondaryMapping(const MRAEnc *srcAlpha, int selection,
                       const int *rangeSel, Symbol fallback)
{
  MRAEnc *newAlpha;
  switch (srcAlpha->encType)
  {
  case sourceUInt8:
    {
      GT_UNUSED const MRAEncUInt8 *ui8alpha;
      uint8_t *mappings, destSym;
      AlphabetRangeSize *newRanges, sym;
      AlphabetRangeID range, numRanges = MRAEncGetNumRanges(srcAlpha);
      ui8alpha = constMRAEnc2MRAEncUInt8(srcAlpha);
      mappings = gt_malloc(sizeof (uint8_t) * (UINT8_MAX + 1));
      memset(mappings, UNDEF_UCHAR, UINT8_MAX+1);
      newRanges = gt_malloc(sizeof (newRanges[0]) * numRanges);
      sym = 0;
      destSym = 0;
      for (range = 0; range < numRanges; ++range)
      {
        if (rangeSel[range] == selection)
        {
          for (; sym < srcAlpha->rangeEndIndices[range]; ++sym)
            mappings[sym] = destSym++;
          newRanges[range] = srcAlpha->symbolsPerRange[range];
        }
        else
        {
          for (; sym < srcAlpha->rangeEndIndices[range]; ++sym)
            mappings[sym] = fallback;
          newRanges[range] = 0;
        }
      }
      newAlpha = gt_newMultiRangeAlphabetEncodingUInt8(numRanges, newRanges,
                                                    mappings);
      gt_free(mappings);
      gt_free(newRanges);
    }
    break;
  default:
    abort();
    break;
  }
  return newAlpha;
}

// Assembly:
subq $0x58, %rsp
movb %cl, %al
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq %rdx, 0x40(%rsp)
movb %al, 0x3f(%rsp)
movq 0x50(%rsp), %rax
movl (%rax), %eax
subl $0x1, %eax
jne 0x22b0e2
jmp 0x22af3a
movq 0x50(%rsp), %rdi
callq 0x22b100
movl %eax, 0x4(%rsp)
movq 0x50(%rsp), %rdi
callq 0x22ae50
movq %rax, 0x28(%rsp)
movl $0x100, %edi            # imm = 0x100
leaq 0x34af1b(%rip), %rsi    # 0x575e7e
movl $0xbd, %edx
callq 0xe80f0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movl $0xff, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x19360
movl 0x4(%rsp), %eax
movl %eax, %edi
shlq %rdi
leaq 0x34aee8(%rip), %rsi    # 0x575e7e
movl $0xbf, %edx
callq 0xe80f0
movq %rax, 0x10(%rsp)
movw $0x0, 0xe(%rsp)
movb $0x0, 0x1f(%rsp)
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0x4(%rsp), %eax
jae 0x22b09c
movq 0x40(%rsp), %rax
movl 0x8(%rsp), %ecx
movl (%rax,%rcx,4), %eax
cmpl 0x4c(%rsp), %eax
jne 0x22b03e
jmp 0x22afdb
movzwl 0xe(%rsp), %eax
movq 0x50(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl 0x8(%rsp), %edx
movzwl (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jge 0x22b01e
movb 0x1f(%rsp), %dl
movb %dl, %al
addb $0x1, %al
movb %al, 0x1f(%rsp)
movq 0x20(%rsp), %rax
movzwl 0xe(%rsp), %ecx
movb %dl, (%rax,%rcx)
movw 0xe(%rsp), %ax
addw $0x1, %ax
movw %ax, 0xe(%rsp)
jmp 0x22afdb
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rsp), %ecx
movw (%rax,%rcx,2), %dx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
movw %dx, (%rax,%rcx,2)
jmp 0x22b08a
jmp 0x22b040
movzwl 0xe(%rsp), %eax
movq 0x50(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl 0x8(%rsp), %edx
movzwl (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jge 0x22b07b
movb 0x3f(%rsp), %dl
movq 0x20(%rsp), %rax
movzwl 0xe(%rsp), %ecx
movb %dl, (%rax,%rcx)
movw 0xe(%rsp), %ax
addw $0x1, %ax
movw %ax, 0xe(%rsp)
jmp 0x22b040
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
movw $0x0, (%rax,%rcx,2)
jmp 0x22b08c
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x22afb9
movl 0x4(%rsp), %edi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x22a810
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x34adbe(%rip), %rsi    # 0x575e7e
movl $0xd3, %edx
callq 0xe88c0
movq 0x10(%rsp), %rdi
leaq 0x34ada8(%rip), %rsi    # 0x575e7e
movl $0xd4, %edx
callq 0xe88c0
jmp 0x22b0e7
callq 0x19370
movq 0x30(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)