// File: /workspace/github_c_makefile_star2_O3/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 $0xd8, %rsp
movq %rsi, 0x60(%rsp)
testq %rdi, %rdi
je 0x30e1d9
movl %edx, %eax
movq %rdi, %r14
leaq 0x8(%rdi), %r13
movl %edx, %ebp
leaq (,%rbp,4), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
leaq 0xd3e7e(%rip), %rsi     # 0x3e191f
movl $0xa6, %edx
movq %rax, %r15
callq 0x104226
testq %rax, %rax
je 0x30db11
movq %rax, 0x8(%rsp)
leal -0x1(%r15), %ebx
movq 0x60(%rsp), %r12
movl %r12d, %edi
callq 0x2f09a0
movslq %eax, %rcx
movq %rbp, 0x10(%rsp)
imulq %rbp, %rcx
movq %rcx, 0x48(%rsp)
movl %eax, 0x6c(%rsp)
movl %eax, 0x18(%r14)
movzbl %bl, %esi
leal (%rsi,%r12), %edi
movq %rsi, 0x20(%rsp)
callq 0xe3960
movq %rax, %rbp
movq %rax, (%r14)
cmpl $0x2, %r15d
movq %r15, 0x40(%rsp)
jne 0x30db50
movl $0x1, %ebx
movl %r12d, %ecx
shlq %cl, %rbx
jmp 0x30db8d
movq (%r13), %rdi
testq %rdi, %rdi
je 0x30db2b
leaq 0xd3dfe(%rip), %rsi     # 0x3e191f
movl $0xa7, %edx
callq 0x1045eb
movq 0x10(%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x30e1b1
leaq 0xd3dde(%rip), %rsi     # 0x3e191f
movl $0xa7, %edx
callq 0x1045eb
jmp 0x30e1b1
testl %r12d, %r12d
je 0x30db88
movl $0x1, %eax
movl $0x1, %ebx
movl %r12d, %esi
movq 0x10(%rsp), %rcx
movl %r12d, %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 0x30db6a
jmp 0x30db8d
movl $0x1, %ebx
leaq -0x1(%rbp), %rdi
callq 0x2f09dd
movl %eax, 0x20(%r14)
movq 0x20(%rsp), %rdi
movq %rdi, %r15
callq 0x2f09a0
movl %eax, 0x1c(%r14)
imull %r12d, %eax
movq %rbp, %rcx
imulq 0x48(%rsp), %rcx
movq %rax, 0xb0(%rsp)
imulq %rax, %rbx
addq %rcx, %rbx
movq %rbx, %rdi
shrq $0x3, %rdi
andl $0x7, %ebx
cmpq $0x1, %rbx
sbbq $-0x1, %rdi
leaq 0xd3d3f(%rip), %rbx     # 0x3e191f
movq %rbx, %rsi
movl $0xb6, %edx
callq 0x104226
movq %rax, 0x10(%r14)
movl $0x18, %edi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0xb8, %ecx
callq 0x10436a
movq %rax, 0x8(%r14)
movl 0x18(%r14), %eax
movq (%r14), %rcx
movq 0x10(%rsp), %r12
imulq %r12, %rcx
imulq %rax, %rcx
movq %rcx, 0x50(%rsp)
leal (,%r15,4), %ebx
movq $0x0, 0x28(%rsp)
movq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq %r12, %rcx
movq %r15, %r8
movq 0x60(%rsp), %r15
movl %r15d, (%r8,%rbx)
movl %r15d, %r12d
addl $-0x1, %r12d
setb %al
cmpl $0x0, 0x40(%rsp)
setne %dl
andb %al, %dl
movb %dl, 0x7(%rsp)
movl %r15d, %ebx
cmpq $0x1, %rbp
adcq $-0x1, %rbp
movq %rbp, 0xb8(%rsp)
movq %rbx, %rax
negq %rax
movq %rax, 0xc8(%rsp)
movq 0x20(%rsp), %rdx
movq $0x0, 0x88(%rsp)
xorl %esi, %esi
movq $0x0, 0x80(%rsp)
movq %r14, 0x38(%rsp)
movq %r13, 0x70(%rsp)
movq %r12, 0xa8(%rsp)
movl %edx, %eax
movl %edx, %edx
movq %rdx, 0x78(%rsp)
leal -0x1(%rax), %edx
movq %rdx, 0xc0(%rsp)
movq 0x10(%r14), %rdi
movq %rsi, 0x90(%rsp)
movl 0x6c(%rsp), %edx
callq 0x2f2c61
movq 0x28(%rsp), %rcx
cmpq $0x2, %rcx
jb 0x30dd22
movq 0x10(%r14), %rcx
movq 0x90(%rsp), %rsi
movq %rsi, %r8
movq 0x48(%rsp), %rdx
subq %rdx, %r8
movq %rcx, %rdi
movq %rdx, %r9
callq 0x2f0a3b
movq 0x28(%rsp), %rcx
testl %eax, %eax
jle 0x30e1d4
cmpb $0x0, 0x7(%rsp)
je 0x30e1cf
leaq (%rcx,%rcx,2), %r11
leaq (,%r11,8), %rbp
addq 0x8(%r14), %rbp
movq 0x10(%r14), %rax
movq %rax, 0xa0(%rsp)
movl 0x1c(%r14), %eax
movl %eax, 0x1c(%rsp)
xorl %esi, %esi
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %edi, %edi
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
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, %r10
jne 0x30dd64
cmpq %rbx, %rsi
ja 0x30e1ca
cmpq %rbx, %r8
movl $0x1, %r8d
movq 0xc8(%rsp), %rsi
jae 0x30ddbe
cmpq %rax, %rdx
cmovaq %rdx, %rax
incq %rax
imulq %rax, %r8
leaq (%rsi,%rax), %rdx
incq %rdx
incq %rax
cmpq $0x1, %rdx
jne 0x30ddaa
xorl %esi, %esi
cmpq %rcx, %rsi
je 0x30dded
movl (%r9,%rsi,4), %eax
movl $0x1, %edi
cmpq $0x2, %rax
jb 0x30dde2
imulq %rax, %rdi
decq %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jne 0x30ddd4
movq %r8, %rax
xorl %edx, %edx
divq %rdi
movq %rax, %r8
incq %rsi
cmpq %r10, %rsi
jne 0x30ddc0
movq %r11, 0xd0(%rsp)
movq %r8, (%rbp)
xorl %eax, %eax
movq %r8, 0x30(%rsp)
cmpq $0x2, %r8
jb 0x30de1c
movq 0x30(%rsp), %rax
leaq -0x1(%rax), %rdi
callq 0x2f09dd
movl %eax, 0x8(%rbp)
movq %rbx, %rdi
leaq 0xd3af6(%rip), %rsi     # 0x3e191f
movl $0x149, %edx            # imm = 0x149
callq 0x104226
testq %rax, %rax
je 0x30e10d
movq %rax, %r13
movl 0x1c(%rsp), %eax
imull %r15d, %eax
movq %rax, 0x98(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rbp)
xorl %eax, %eax
movq %r13, %rcx
movq 0x8(%rsp), %rdi
movq 0x40(%rsp), %r8
movq 0xa0(%rsp), %r14
movzbl %al, %edx
cmpl $0x0, (%rdi,%rdx,4)
je 0x30de88
xorl %esi, %esi
movb %al, (%rcx,%rsi)
incq %rsi
cmpl (%rdi,%rdx,4), %esi
jb 0x30de7a
addq %rsi, %rcx
incb %al
movzbl %al, %edx
cmpl %r8d, %edx
jb 0x30de6f
movq 0x30(%rsp), %rax
cmpq $0x1, %rax
adcq $-0x1, %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x50(%rsp), %rsi
movq 0x98(%rsp), %rbp
movq %r14, %rdi
movl 0x1c(%rsp), %edx
movq %rbx, %rcx
movq %r13, %r8
movq %rsi, %r12
callq 0x2f4f1a
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x30df00
movq %r12, %r8
subq %rbp, %r8
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbp, %r9
callq 0x2f0a3b
testl %eax, %eax
movq 0x58(%rsp), %rax
jle 0x30e1c5
cmpq 0x30(%rsp), %rax
je 0x30e023
incq %rax
movq %rax, 0x58(%rsp)
movq %r12, %rsi
addq %rbp, %rsi
movq 0xa8(%rsp), %rax
movb (%r13,%rax), %cl
movl %eax, %edx
subq $0x1, %rax
jb 0x30df3f
decl %edx
movb (%r13,%rdx), %r12b
cmpb %r12b, %cl
movl %r12d, %ecx
jbe 0x30df28
jmp 0x30df45
movb (%r13), %r12b
xorl %edx, %edx
movl %edx, %eax
leaq 0x1(%rax), %rdi
movb 0x1(%r13,%rax), %r8b
addl $0x2, %edx
movl %edx, %ecx
cmpl %r15d, %edx
jae 0x30dfa9
leaq (%rcx,%r13), %r9
movl %edi, %r10d
movb (%r9), %r11b
cmpb %r12b, %r11b
seta %bpl
cmpb %r8b, %r11b
setb %r15b
movzbl %r8b, %r14d
movzbl %r11b, %r8d
testb %r15b, %bpl
movq 0x60(%rsp), %r15
cmovel %r14d, %r8d
cmovnel %edx, %r10d
incl %edx
incq %r9
cmpl %edx, %r15d
jne 0x30df61
movl %r10d, %edx
movq 0xa0(%rsp), %r14
movq 0x98(%rsp), %rbp
jmp 0x30dfac
movq %rdi, %rdx
movb %r8b, (%r13,%rax)
movb %r12b, (%r13,%rdx)
movq 0xa8(%rsp), %r12
cmpl %r12d, %edi
jae 0x30deba
incq %rax
movb (%r13,%rax), %r11b
leaq 0x1(%rax), %rdx
cmpq %rbx, %rdx
jae 0x30e000
movq %rcx, %r9
movl %r11d, %edi
movl %eax, %r8d
movzbl (%r13,%r9), %r10d
cmpb %dil, %r10b
cmovbl %r9d, %r8d
movzbl %dil, %edi
cmovbl %r10d, %edi
incq %r9
cmpq %rbx, %r9
jb 0x30dfe1
jmp 0x30e006
movl %eax, %r8d
movl %r11d, %edi
movl %r8d, %r8d
movb %r11b, (%r13,%r8)
movb %dil, (%r13,%rax)
incq %rcx
movq %rdx, %rax
cmpl %edx, %r12d
jne 0x30dfca
jmp 0x30deba
movq %r13, %rdi
leaq 0xd38f2(%rip), %rsi     # 0x3e191f
movl $0x163, %edx            # imm = 0x163
callq 0x1045eb
movq 0x70(%rsp), %r13
movq (%r13), %rax
movq 0xd0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x80(%rsp), %rdx
addq %rax, %rdx
movq 0x88(%rsp), %r14
cmpq %r14, %rax
cmovaq %rax, %r14
movq 0x28(%rsp), %rcx
cmpq 0xb8(%rsp), %rcx
je 0x30e164
movq %rdx, 0x80(%rsp)
movq %r14, 0x88(%rsp)
imulq 0xb0(%rsp), %rax
addq %rax, 0x50(%rsp)
incq %rcx
movq %rcx, 0x28(%rsp)
movq 0x8(%rsp), %r8
movq 0xc0(%rsp), %rdx
incl (%r8,%rdx,4)
movq 0x90(%rsp), %rsi
addq 0x48(%rsp), %rsi
movq 0x78(%rsp), %rcx
movl (%r8,%rcx,4), %eax
decl %eax
movl %eax, (%r8,%rcx,4)
movq 0x38(%rsp), %r14
je 0x30e103
movq 0x20(%rsp), %rcx
cmpl $0x0, (%r8,%rcx,4)
movq 0x10(%rsp), %rcx
jne 0x30dcd3
movq 0x20(%rsp), %rdx
movl %eax, (%r8,%rdx,4)
movq 0x78(%rsp), %rax
movl $0x0, (%r8,%rax,4)
jmp 0x30dcbf
movq 0x10(%rsp), %rcx
jmp 0x30dcbf
movq 0x70(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x30e12b
leaq 0xd37fe(%rip), %rsi     # 0x3e191f
movl $0xcf, %edx
callq 0x1045eb
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x30e14a
leaq 0xd37df(%rip), %rsi     # 0x3e191f
movl $0xcf, %edx
callq 0x1045eb
leaq 0xd37ce(%rip), %rsi     # 0x3e191f
movq 0x8(%rsp), %rdi
movl $0xcf, %edx
callq 0x1045eb
xorl %ebx, %ebx
jmp 0x30e1b1
movq 0x8(%rsp), %rax
cmpl %r15d, (%rax)
movq 0x38(%rsp), %rbx
jne 0x30e1de
movq %rdx, %r12
movq 0x40(%rsp), %rdi
movl %r15d, %esi
callq 0x105ed6
cmpq %rax, %r12
jne 0x30e1e3
movq %r14, %rdi
decq %rdi
callq 0x2f09dd
movl %eax, 0x24(%rbx)
leaq 0xd3782(%rip), %rsi     # 0x3e191f
movq 0x8(%rsp), %rdi
movl $0xec, %edx
callq 0x1045eb
movl $0x1, %ebx
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x902a4
callq 0x9034f
callq 0x9026d
callq 0x90234
callq 0x90386
callq 0x902dd
callq 0x90316