// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
testq %rdi, %rdi
je 0x318393
movl %edx, %eax
movl %esi, %r13d
movq %rdi, %r14
leaq 0x8(%rdi), %r12
movl %edx, %ebp
leaq (,%rbp,4), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
leaq 0xd33bc(%rip), %rsi     # 0x3eb00f
movl $0xa6, %edx
movq %rax, %r15
callq 0x1092b2
testq %rax, %rax
je 0x317cbe
movq %rax, 0x10(%rsp)
leal -0x1(%r15), %ebx
movl %r13d, %edi
callq 0x2f9d04
movslq %eax, %rcx
movq %rbp, 0x18(%rsp)
imulq %rbp, %rcx
movq %rcx, 0x48(%rsp)
movl %eax, 0x64(%rsp)
movl %eax, 0x18(%r14)
movzbl %bl, %esi
leal (%rsi,%r13), %edi
movq %rsi, 0x30(%rsp)
callq 0xe7e20
movq %rax, %rbp
movq %rax, (%r14)
cmpl $0x2, %r15d
movq %r15, 0x40(%rsp)
jne 0x317cfd
movl $0x1, %ebx
movl %r13d, %ecx
shlq %cl, %rbx
jmp 0x317d3a
movq (%r12), %rdi
testq %rdi, %rdi
je 0x317cd8
leaq 0xd3341(%rip), %rsi     # 0x3eb00f
movl $0xa7, %edx
callq 0x109670
movq 0x10(%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x31836b
leaq 0xd3321(%rip), %rsi     # 0x3eb00f
movl $0xa7, %edx
callq 0x109670
jmp 0x31836b
testl %r13d, %r13d
je 0x317d35
movl $0x1, %eax
movl $0x1, %ebx
movl %r13d, %esi
movq 0x18(%rsp), %rcx
movl %r13d, %edx
testb $0x1, %sil
movq %rcx, %rdi
cmoveq %rax, %rdi
imulq %rdi, %rbx
imulq %rcx, %rcx
shrl %edx
cmpl $0x1, %esi
movl %edx, %esi
ja 0x317d17
jmp 0x317d3a
movl $0x1, %ebx
leaq -0x1(%rbp), %rdi
callq 0x2f9d41
movl %eax, 0x20(%r14)
movq 0x30(%rsp), %r15
movl %r15d, %edi
callq 0x2f9d04
movl %eax, 0x1c(%r14)
imull %r13d, %eax
movq %rbp, %rcx
imulq 0x48(%rsp), %rcx
movq %rax, 0xa8(%rsp)
imulq %rax, %rbx
addq %rcx, %rbx
movq %rbx, %rdi
shrq $0x3, %rdi
andl $0x7, %ebx
cmpq $0x1, %rbx
sbbq $-0x1, %rdi
leaq 0xd3282(%rip), %rbx     # 0x3eb00f
movq %rbx, %rsi
movl $0xb6, %edx
callq 0x1092b2
movq %rax, 0x10(%r14)
movl $0x18, %edi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0xb8, %ecx
callq 0x1093ef
movq %rax, 0x8(%r14)
movl 0x18(%r14), %eax
movq (%r14), %rcx
imulq 0x18(%rsp), %rcx
imulq %rax, %rcx
movq %rcx, 0x50(%rsp)
leal (,%r15,4), %ebx
movq $0x0, 0x38(%rsp)
movq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq %r15, %r8
movq 0x18(%rsp), %r15
movl %r13d, (%r8,%rbx)
movl %r13d, %eax
addl $-0x1, %eax
movq %rax, 0x90(%rsp)
setb %al
cmpl $0x0, 0x40(%rsp)
setne %cl
andb %al, %cl
movb %cl, 0xf(%rsp)
movl %r13d, %ebx
cmpq $0x1, %r15
movq %r15, %rax
adcq $0x0, %rax
movq %rax, 0xc8(%rsp)
cmpq $0x1, %rbp
adcq $-0x1, %rbp
movq %rbp, 0xb0(%rsp)
movq %rbx, %rax
negq %rax
movq %rax, 0xc0(%rsp)
movq 0x30(%rsp), %rdx
xorl %ebp, %ebp
xorl %esi, %esi
movq $0x0, 0x78(%rsp)
movq %r14, 0x28(%rsp)
movq %r12, 0x70(%rsp)
movl %edx, %eax
movl %edx, %ecx
movq %rcx, 0x68(%rsp)
leal -0x1(%rax), %edx
movq %rdx, 0xb8(%rsp)
movq 0x10(%r14), %rdi
movq %rsi, 0x88(%rsp)
movl 0x64(%rsp), %edx
movq %r15, %rcx
callq 0x2fc0ab
movq 0x38(%rsp), %rcx
cmpq $0x2, %rcx
jb 0x317ed1
movq 0x10(%r14), %rcx
movq 0x88(%rsp), %rsi
movq %rsi, %r8
movq 0x48(%rsp), %rdx
subq %rdx, %r8
movq %rcx, %rdi
movq %rdx, %r9
callq 0x2f9d9f
movq 0x38(%rsp), %rcx
testl %eax, %eax
jle 0x31838e
movq %rbp, 0x80(%rsp)
cmpb $0x0, 0xf(%rsp)
je 0x318389
leaq (%rcx,%rcx,2), %r10
leaq (,%r10,8), %rbp
addq 0x8(%r14), %rbp
movq 0x10(%r14), %r12
movl 0x1c(%r14), %eax
movl %eax, 0x24(%rsp)
xorl %esi, %esi
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %edi, %edi
movq 0x10(%rsp), %r9
movq %r8, %rdx
movl (%r9,%rdi,4), %eax
addq %rax, %rsi
cmpq %rax, %r8
movq %rax, %r8
cmovaq %rdx, %r8
cmovbq %rdi, %rcx
incq %rdi
cmpq %rdi, %r15
jne 0x317f0e
cmpq %rbx, %rsi
ja 0x318384
movl $0x1, %r15d
cmpq %rbx, %r8
movq 0xc0(%rsp), %rsi
jae 0x317f68
cmpq %rax, %rdx
cmovaq %rdx, %rax
incq %rax
imulq %rax, %r15
leaq (%rsi,%rax), %rdx
incq %rdx
incq %rax
cmpq $0x1, %rdx
jne 0x317f54
xorl %esi, %esi
movq 0xc8(%rsp), %r8
cmpq %rcx, %rsi
je 0x317f9f
movl (%r9,%rsi,4), %eax
movl $0x1, %edi
cmpq $0x2, %rax
jb 0x317f94
imulq %rax, %rdi
decq %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jne 0x317f86
movq %r15, %rax
xorl %edx, %edx
divq %rdi
movq %rax, %r15
incq %rsi
cmpq %r8, %rsi
jne 0x317f72
movq %r10, 0xd0(%rsp)
movq %r15, (%rbp)
xorl %eax, %eax
cmpq $0x2, %r15
jb 0x317fc4
leaq -0x1(%r15), %rdi
callq 0x2f9d41
movq %r15, 0x58(%rsp)
movl %eax, 0x8(%rbp)
movq %rbx, %rdi
leaq 0xd3039(%rip), %rsi     # 0x3eb00f
movl $0x149, %edx            # imm = 0x149
callq 0x1092b2
movq %rax, %r15
testq %rax, %rax
movq 0x90(%rsp), %r14
je 0x3182bb
movl 0x24(%rsp), %eax
imull %r13d, %eax
movq %rax, 0x98(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rbp)
xorl %eax, %eax
movq %r15, %rcx
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %r8
movzbl %al, %edx
cmpl $0x0, (%rdi,%rdx,4)
je 0x318035
xorl %esi, %esi
movb %al, (%rcx,%rsi)
incq %rsi
cmpl (%rdi,%rdx,4), %esi
jb 0x318027
addq %rsi, %rcx
incb %al
movzbl %al, %edx
cmpl %r8d, %edx
jb 0x31801c
movq 0x58(%rsp), %rbp
cmpq $0x1, %rbp
adcq $-0x1, %rbp
movq %rbp, 0x58(%rsp)
xorl %ebp, %ebp
movq 0x50(%rsp), %rsi
movq %r12, 0xa0(%rsp)
movq %r12, %rdi
movl 0x24(%rsp), %edx
movq %rbx, %rcx
movq %r15, %r8
movq %rsi, %r12
callq 0x2fe3fd
testq %rbp, %rbp
je 0x3180a6
movq %r12, %r8
movq 0x98(%rsp), %rdx
subq %rdx, %r8
movq 0xa0(%rsp), %rcx
movq %rcx, %rdi
movq %r12, %rsi
movq %rdx, %r9
callq 0x2f9d9f
testl %eax, %eax
jle 0x31837f
cmpq 0x58(%rsp), %rbp
je 0x3181cf
incq %rbp
addq 0x98(%rsp), %r12
movb (%r15,%r14), %cl
movl %r14d, %edx
movq %r14, %rax
subq $0x1, %rax
jb 0x3180db
decl %edx
movb (%r15,%rdx), %sil
cmpb %sil, %cl
movl %esi, %ecx
jbe 0x3180c6
jmp 0x3180dd
xorl %edx, %edx
movq %r12, 0xd8(%rsp)
movq %rbp, 0xe0(%rsp)
movl %edx, %edi
movb (%r15,%rdi), %sil
movb 0x1(%r15,%rdi), %r8b
leaq 0x1(%rdi), %rax
addl $0x2, %edx
movl %edx, %ecx
cmpl %r13d, %edx
jae 0x318143
leaq (%r15,%rcx), %r10
movl %eax, %r9d
movb (%r10), %r11b
cmpb %sil, %r11b
seta %bpl
cmpb %r8b, %r11b
movq %r13, %r12
setb %r13b
movzbl %r8b, %r14d
movzbl %r11b, %r8d
testb %r13b, %bpl
movq %r12, %r13
cmovel %r14d, %r8d
cmovnel %edx, %r9d
incl %edx
incq %r10
cmpl %edx, %r13d
jne 0x31810d
jmp 0x318146
movl %eax, %r9d
movb %r8b, (%r15,%rdi)
movl %r9d, %edx
movb %sil, (%r15,%rdx)
movq 0x90(%rsp), %r14
cmpl %r14d, %eax
movq 0xa0(%rsp), %r12
movq 0xe0(%rsp), %rbp
movq 0xd8(%rsp), %rsi
jae 0x318060
movb (%r15,%rax), %r11b
leaq 0x1(%rax), %rdx
cmpq %rbx, %rdx
jae 0x3181ae
movq %rcx, %r9
movl %r11d, %edi
movl %eax, %r8d
movzbl (%r15,%r9), %r10d
cmpb %dil, %r10b
cmovbl %r9d, %r8d
movzbl %dil, %edi
cmovbl %r10d, %edi
incq %r9
cmpq %rbx, %r9
jb 0x318190
jmp 0x3181b4
movl %eax, %r8d
movl %r11d, %edi
movl %r8d, %r8d
movb %r11b, (%r15,%r8)
movb %dil, (%r15,%rax)
incq %rcx
movq %rdx, %rax
cmpl %edx, %r14d
jne 0x31817a
jmp 0x318060
movq %r15, %rdi
leaq 0xd2e36(%rip), %rsi     # 0x3eb00f
movl $0x163, %edx            # imm = 0x163
callq 0x109670
testq %r15, %r15
je 0x3182bb
movq 0x70(%rsp), %r12
movq (%r12), %rax
movq 0xd0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x78(%rsp), %r14
addq %rax, %r14
movq 0x80(%rsp), %rbp
cmpq %rbp, %rax
cmovaq %rax, %rbp
movq 0x38(%rsp), %rcx
cmpq 0xb0(%rsp), %rcx
je 0x318318
movq %r14, 0x78(%rsp)
imulq 0xa8(%rsp), %rax
addq %rax, 0x50(%rsp)
incq %rcx
movq %rcx, 0x38(%rsp)
movq 0x10(%rsp), %r8
movq 0xb8(%rsp), %rdx
incl (%r8,%rdx,4)
movq 0x88(%rsp), %rsi
addq 0x48(%rsp), %rsi
movq 0x68(%rsp), %rcx
movl (%r8,%rcx,4), %eax
decl %eax
movl %eax, (%r8,%rcx,4)
je 0x3182ac
movq 0x30(%rsp), %rcx
cmpl $0x0, (%r8,%rcx,4)
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %r15
jne 0x317e7f
movq 0x30(%rsp), %rcx
movl %eax, (%r8,%rcx,4)
movq 0x68(%rsp), %rax
movl $0x0, (%r8,%rax,4)
movl %ecx, %edx
jmp 0x317e6b
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %r15
jmp 0x317e6b
movq 0x70(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3182d9
leaq 0xd2d40(%rip), %rsi     # 0x3eb00f
movl $0xcf, %edx
callq 0x109670
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x3182f8
leaq 0xd2d21(%rip), %rsi     # 0x3eb00f
movl $0xcf, %edx
callq 0x109670
leaq 0xd2d10(%rip), %rsi     # 0x3eb00f
movq 0x10(%rsp), %rdi
movl $0xcf, %edx
callq 0x109670
movq 0x80(%rsp), %rbp
jmp 0x318334
movq 0x10(%rsp), %rax
cmpl %r13d, (%rax)
jne 0x318398
movq 0x40(%rsp), %rdi
movl %r13d, %esi
callq 0x10af8d
cmpq %rax, %r14
jne 0x31839d
testq %r15, %r15
je 0x318369
decq %rbp
movq %rbp, %rdi
callq 0x2f9d41
movq 0x28(%rsp), %rcx
movl %eax, 0x24(%rcx)
leaq 0xd2cbc(%rip), %rsi     # 0x3eb00f
movq 0x10(%rsp), %rdi
movl $0xec, %edx
callq 0x109670
movl $0x1, %ebx
jmp 0x31836b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x92063
callq 0x9210e
callq 0x9202c
callq 0x91ff3
callq 0x92145
callq 0x9209c
callq 0x920d5