// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/huffman.c
// Function: BZ2_hbCreateDecodeTables
void BZ2_hbCreateDecodeTables ( Int32 *limit,
                                Int32 *base,
                                Int32 *perm,
                                UChar *length,
                                Int32 minLen,
                                Int32 maxLen,
                                Int32 alphaSize )
{
   Int32 pp, i, j, vec;

   pp = 0;
   for (i = minLen; i <= maxLen; i++)
      for (j = 0; j < alphaSize; j++)
         if (length[j] == i) { perm[pp] = j; pp++; };

   for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
   for (i = 0; i < alphaSize; i++) base[length[i]+1]++;

   for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];

   for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
   vec = 0;

   for (i = minLen; i <= maxLen; i++) {
      vec += (base[i+1] - base[i]);
      limit[i] = vec-1;
      vec <<= 1;
   }
   for (i = minLen + 1; i <= maxLen; i++)
      base[i] = ((limit[i-1] + 1) << 1) - base[i];
}

// Assembly:
movl 0x8(%rsp), %eax
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movq %rcx, -0x20(%rsp)
movl %r8d, -0x24(%rsp)
movl %r9d, -0x28(%rsp)
movl $0x0, -0x2c(%rsp)
movl -0x24(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x30(%rsp), %eax
cmpl -0x28(%rsp), %eax
jg 0x1569ec
movl $0x0, -0x34(%rsp)
movl -0x34(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x1569dd
movq -0x20(%rsp), %rax
movslq -0x34(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl -0x30(%rsp), %eax
jne 0x1569ce
movl -0x34(%rsp), %edx
movq -0x18(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0x1569d0
movl -0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rsp)
jmp 0x156994
jmp 0x1569df
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156982
movl $0x0, -0x30(%rsp)
cmpl $0x17, -0x30(%rsp)
jge 0x156a19
movq -0x10(%rsp), %rax
movslq -0x30(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x1569f4
movl $0x0, -0x30(%rsp)
movl -0x30(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x156a5a
movq -0x10(%rsp), %rax
movq -0x20(%rsp), %rcx
movslq -0x30(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156a21
movl $0x1, -0x30(%rsp)
cmpl $0x17, -0x30(%rsp)
jge 0x156a98
movq -0x10(%rsp), %rax
movl -0x30(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x30(%rsp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156a62
movl $0x0, -0x30(%rsp)
cmpl $0x17, -0x30(%rsp)
jge 0x156ac5
movq -0x8(%rsp), %rax
movslq -0x30(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156aa0
movl $0x0, -0x38(%rsp)
movl -0x24(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x30(%rsp), %eax
cmpl -0x28(%rsp), %eax
jg 0x156b31
movq -0x10(%rsp), %rax
movl -0x30(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
movslq -0x30(%rsp), %rdx
subl (%rcx,%rdx,4), %eax
addl -0x38(%rsp), %eax
movl %eax, -0x38(%rsp)
movl -0x38(%rsp), %edx
subl $0x1, %edx
movq -0x8(%rsp), %rax
movslq -0x30(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rsp), %eax
shll %eax
movl %eax, -0x38(%rsp)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156ad5
movl -0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
movl -0x30(%rsp), %eax
cmpl -0x28(%rsp), %eax
jg 0x156b84
movq -0x8(%rsp), %rax
movl -0x30(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
shll %edx
movq -0x10(%rsp), %rax
movslq -0x30(%rsp), %rcx
subl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x30(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rsp)
jmp 0x156b3c
retq
nopw %cs:(%rax,%rax)
nop