// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-seqblocktranslate.c
// Function: gt_initCompositionList
int
gt_initCompositionList(struct compList *newList, unsigned blockSize,
                    unsigned alphabetSize)
{
  unsigned *composition = NULL;
  Symbol maxSym = alphabetSize - 1;
  BitOffset bitsPerComp, bitsPerCount, bitsPerPerm;
  size_t numCompositions, cmpIdx = 0;
  size_t maxNumPermutations = 0, numTotalPermutations;
  gt_assert(newList);
  newList->permutations = NULL;
  newList->catCompsPerms = NULL;
  if (!(composition = gt_malloc(sizeof (composition[0]) * alphabetSize)))
    gt_initCompositionListErrRet();
  bitsPerComp = alphabetSize * (bitsPerCount = gt_requiredUIntBits(blockSize));
  newList->bitsPerCount = bitsPerCount;
  numCompositions = newList->numCompositions =
    gt_combinatorics_binomial_simple(blockSize + maxSym, maxSym);
  numTotalPermutations = gt_combinatorics_i_pow(alphabetSize, blockSize);
  newList->compositionIdxBits = gt_requiredUInt64Bits(numCompositions - 1);
  newList->bitsPerSymbol = gt_requiredUIntBits(maxSym);
  bitsPerPerm = newList->bitsPerSymbol * blockSize;
  {
    size_t size = bitElemsAllocSize(numCompositions * bitsPerComp
                                    + numTotalPermutations * bitsPerPerm)
      * sizeof (BitElem);
    if (size == SIZE_MAX)
      gt_initCompositionListErrRet();
    newList->catCompsPerms = gt_malloc(size);
  }
  newList->permutations = gt_calloc(sizeof (struct permList), numCompositions);
  {
    unsigned symRMNZ;
    BitOffset offset = 0, permOffset =
      compListPermStartOffset(newList, alphabetSize);
#ifndef NDEBUG
    size_t permSum = 0;
#endif
    initComposition(maxSym, blockSize, composition, &symRMNZ);
    do
    {
#ifdef EIS_DEBUG
      printComposition(stderr, composition, alphabetSize, blockSize);
#endif /* EIS_DEBUG */
      gt_bsStoreUniformUIntArray(newList->catCompsPerms, offset,
                              bitsPerCount, alphabetSize, composition);
      gt_assert(cmpIdx > 1?(gt_bsCompare(newList->catCompsPerms, offset,
                                      bitsPerComp,
                              newList->catCompsPerms, offset - bitsPerComp,
                              bitsPerComp)>0):1);
      if (initPermutationsList(composition, newList->permutations + cmpIdx,
                               newList->catCompsPerms, permOffset, blockSize,
                               alphabetSize, newList->bitsPerSymbol))
        gt_initCompositionListErrRet();
#if defined(EIS_DEBUG) && !defined(NDEBUG)
      gt_log_log(""GT_WU"",
              (GtUword)newList->permutations[cmpIdx].numPermutations);
#endif
#ifndef NDEBUG
      permSum += newList->permutations[cmpIdx].numPermutations;
#endif
      permOffset += newList->permutations[cmpIdx].numPermutations * bitsPerPerm;
      if (newList->permutations[cmpIdx].numPermutations > maxNumPermutations)
        maxNumPermutations = newList->permutations[cmpIdx].numPermutations;
      if (++cmpIdx < numCompositions)
        ;
      else
        break;
      offset += bitsPerComp;
      nextComposition(composition, maxSym, &symRMNZ);
    } while (1);
    /* verify that the last composition is indeed the lexically maximally */
    gt_assert(composition[0] == blockSize);
#if defined(EIS_DEBUG) && !defined(NDEBUG)
    gt_log_log("permSum="GT_WU", alphabetSize="GT_WU", blockSize=%d, "
            "pow(alphabetSize, blockSize)=%f",
            (GtUword)permSum, (GtUword)alphabetSize, blockSize,
            gt_power_for_small_exponents(alphabetSize, blockSize));
#endif
    gt_assert(permSum == gt_power_for_small_exponents(alphabetSize, blockSize));
  }
  newList->maxPermIdxBits = gt_requiredUInt64Bits(maxNumPermutations - 1);
  gt_free(composition);
  return 1;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movl %esi, 0xa4(%rsp)
movl %edx, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movl 0xa0(%rsp), %eax
subl $0x1, %eax
movb %al, 0x97(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x60(%rsp)
cmpq $0x0, 0xa8(%rsp)
jne 0x4ae6af
movq 0x18d922(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6798b(%rip), %rsi     # 0x516013
leaq 0x10887c(%rip), %rdx    # 0x5b6f0b
leaq 0x10887d(%rip), %rcx    # 0x5b6f13
leaq 0x10888d(%rip), %r8     # 0x5b6f2a
movl $0xa3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4ae6b1
movq 0xa8(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0xa8(%rsp), %rax
movq $0x0, 0x10(%rax)
movl 0xa0(%rsp), %eax
movl %eax, %edi
shlq $0x2, %rdi
leaq 0x108845(%rip), %rsi    # 0x5b6f2a
movl $0xa6, %edx
callq 0xe80f0
movq %rax, 0x98(%rsp)
cmpq $0x0, %rax
jne 0x4ae7cb
jmp 0x4ae703
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4ae76b
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpq 0x68(%rsp), %rax
jae 0x4ae74e
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x54(%rsp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x4aee10
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x4ae71a
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x1087c9(%rip), %rsi    # 0x5b6f2a
movl $0xa7, %edx
callq 0xe88c0
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4ae797
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x10879d(%rip), %rsi    # 0x5b6f2a
movl $0xa7, %edx
callq 0xe88c0
cmpq $0x0, 0x98(%rsp)
je 0x4ae7bb
movq 0x98(%rsp), %rdi
leaq 0x108779(%rip), %rsi    # 0x5b6f2a
movl $0xa7, %edx
callq 0xe88c0
movl $0x0, 0xb4(%rsp)
jmp 0x4aee00
movl 0xa0(%rsp), %eax
movq %rax, 0x18(%rsp)
movl 0xa4(%rsp), %edi
callq 0x46ec00
movl %eax, %ecx
movq 0x18(%rsp), %rax
movslq %ecx, %rcx
movq %rcx, 0x80(%rsp)
imulq %rcx, %rax
movq %rax, 0x88(%rsp)
movq 0x80(%rsp), %rax
movl %eax, %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x18(%rax)
movl 0xa4(%rsp), %eax
movzbl 0x97(%rsp), %ecx
addl %ecx, %eax
movl %eax, %eax
movl %eax, %edi
movzbl 0x97(%rsp), %eax
movl %eax, %esi
callq 0xa1b40
movq 0xa8(%rsp), %rcx
movq %rax, (%rcx)
movq %rax, 0x70(%rsp)
movl 0xa0(%rsp), %eax
movl %eax, %edi
movl 0xa4(%rsp), %esi
callq 0x4aee20
movq %rax, 0x58(%rsp)
movq 0x70(%rsp), %rdi
subq $0x1, %rdi
callq 0x46ec80
movl %eax, %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x20(%rax)
movzbl 0x97(%rsp), %edi
callq 0x46ec00
movl %eax, %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq 0xa8(%rsp), %rax
movl 0x1c(%rax), %eax
imull 0xa4(%rsp), %eax
movl %eax, %eax
movq %rax, 0x78(%rsp)
movq 0x70(%rsp), %rdi
imulq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rax
imulq 0x78(%rsp), %rax
addq %rax, %rdi
callq 0x4aeea0
shlq $0x0, %rax
movq %rax, 0x48(%rsp)
cmpq $-0x1, 0x48(%rsp)
jne 0x4ae9b3
jmp 0x4ae8eb
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4ae953
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
cmpq 0x68(%rsp), %rax
jae 0x4ae936
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x44(%rsp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x4aee10
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x4ae902
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x1085e1(%rip), %rsi    # 0x5b6f2a
movl $0xb5, %edx
callq 0xe88c0
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4ae97f
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x1085b5(%rip), %rsi    # 0x5b6f2a
movl $0xb5, %edx
callq 0xe88c0
cmpq $0x0, 0x98(%rsp)
je 0x4ae9a3
movq 0x98(%rsp), %rdi
leaq 0x108591(%rip), %rsi    # 0x5b6f2a
movl $0xb5, %edx
callq 0xe88c0
movl $0x0, 0xb4(%rsp)
jmp 0x4aee00
movq 0x48(%rsp), %rdi
leaq 0x10856b(%rip), %rsi    # 0x5b6f2a
movl $0xb6, %edx
callq 0xe80f0
movq %rax, %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x70(%rsp), %rsi
movl $0x18, %edi
leaq 0x108541(%rip), %rdx    # 0x5b6f2a
movl $0xb8, %ecx
callq 0xe83c0
movq %rax, %rcx
movq 0xa8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, 0x38(%rsp)
movq 0xa8(%rsp), %rdi
movl 0xa0(%rsp), %esi
callq 0x4aef00
movq %rax, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movb 0x97(%rsp), %al
movl 0xa4(%rsp), %esi
movq 0x98(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movzbl %al, %edi
callq 0x4aef30
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rsp), %rsi
movq 0x80(%rsp), %rax
movl %eax, %edx
movl 0xa0(%rsp), %eax
movl %eax, %ecx
movq 0x98(%rsp), %r8
callq 0x475070
cmpq $0x1, 0x68(%rsp)
jbe 0x4aeacf
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x38(%rsp), %r8
subq 0x88(%rsp), %r8
movq 0x88(%rsp), %r9
callq 0x46ed30
cmpl $0x0, %eax
jg 0x4aeb0f
jmp 0x4aead7
movb $0x1, %al
testb $0x1, %al
jne 0x4aeb0f
jmp 0x4aead7
movq 0x18d4c2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6752b(%rip), %rsi     # 0x516013
leaq 0x10845d(%rip), %rdx    # 0x5b6f4c
leaq 0x10841d(%rip), %rcx    # 0x5b6f13
leaq 0x10842d(%rip), %r8     # 0x5b6f2a
movl $0xcb, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4aeb11
movq 0x98(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rsi
imulq $0x18, 0x68(%rsp), %rax
addq %rax, %rsi
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x30(%rsp), %rcx
movl 0xa4(%rsp), %r8d
movl 0xa0(%rsp), %r9d
movq 0xa8(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, (%rsp)
callq 0x4aef80
cmpl $0x0, %eax
je 0x4aec35
jmp 0x4aeb6d
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4aebd5
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpq 0x68(%rsp), %rax
jae 0x4aebb8
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x24(%rsp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x4aee10
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x4aeb84
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x10835f(%rip), %rsi    # 0x5b6f2a
movl $0xcf, %edx
callq 0xe88c0
movq 0xa8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4aec01
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x108333(%rip), %rsi    # 0x5b6f2a
movl $0xcf, %edx
callq 0xe88c0
cmpq $0x0, 0x98(%rsp)
je 0x4aec25
movq 0x98(%rsp), %rdi
leaq 0x10830f(%rip), %rsi    # 0x5b6f2a
movl $0xcf, %edx
callq 0xe88c0
movl $0x0, 0xb4(%rsp)
jmp 0x4aee00
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x18, 0x68(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x18, 0x68(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq 0x78(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x18, 0x68(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rax
cmpq 0x60(%rsp), %rax
jbe 0x4aecbb
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x18, 0x68(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
cmpq 0x70(%rsp), %rax
jae 0x4aecd2
jmp 0x4aecd4
jmp 0x4aed0c
movq 0x88(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x98(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movzbl 0x97(%rsp), %esi
callq 0x4af170
movb $0x1, %al
testb $0x1, %al
jne 0x4aea50
jmp 0x4aed0c
jmp 0x4aed0e
movq 0x98(%rsp), %rax
movl (%rax), %eax
cmpl 0xa4(%rsp), %eax
je 0x4aed59
movq 0x18d278(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x672e1(%rip), %rsi     # 0x516013
leaq 0x108299(%rip), %rdx    # 0x5b6fd2
leaq 0x1081d3(%rip), %rcx    # 0x5b6f13
leaq 0x1081e3(%rip), %r8     # 0x5b6f2a
movl $0xe2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4aed5b
jmp 0x4aed5d
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0xa0(%rsp), %edi
movl 0xa4(%rsp), %esi
callq 0xec720
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
je 0x4aedbf
movq 0x18d212(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x6727b(%rip), %rsi     # 0x516013
leaq 0x10824f(%rip), %rdx    # 0x5b6fee
leaq 0x10816d(%rip), %rcx    # 0x5b6f13
leaq 0x10817d(%rip), %r8     # 0x5b6f2a
movl $0xe9, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4aedc1
movq 0x60(%rsp), %rdi
subq $0x1, %rdi
callq 0x46ec80
movl %eax, %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x24(%rax)
movq 0x98(%rsp), %rdi
leaq 0x10813f(%rip), %rsi    # 0x5b6f2a
movl $0xec, %edx
callq 0xe88c0
movl $0x1, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nop