// File: /workspace/github_c_makefile_star2_O0/patriciogonzalezvivo[P]tprint/include/std/stb_image.h
// Function: stbi__build_huffman(stbi__huffman*, int*)
static int stbi__build_huffman(stbi__huffman *h, int *count)
{
   int i,j,k=0,code;
   // build size list for each symbol (from JPEG spec)
   for (i=0; i < 16; ++i)
      for (j=0; j < count[i]; ++j)
         h->size[k++] = (stbi_uc) (i+1);
   h->size[k] = 0;

   // compute actual symbols (from jpeg spec)
   code = 0;
   k = 0;
   for(j=1; j <= 16; ++j) {
      // compute delta to add to code to compute symbol id
      h->delta[j] = k - code;
      if (h->size[k] == j) {
         while (h->size[k] == j)
            h->code[k++] = (stbi__uint16) (code++);
         if (code-1 >= (1 << j)) return stbi__err("bad code lengths","Corrupt JPEG");
      }
      // compute largest code + 1 for this size, preshifted as needed later
      h->maxcode[j] = code << (16-j);
      code <<= 1;
   }
   h->maxcode[j] = 0xffffffff;

   // build non-spec acceleration table; 255 is flag for not-accelerated
   memset(h->fast, 255, 1 << FAST_BITS);
   for (i=0; i < k; ++i) {
      int s = h->size[i];
      if (s <= FAST_BITS) {
         int c = h->code[i] << (FAST_BITS-s);
         int m = 1 << (FAST_BITS-s);
         for (j=0; j < m; ++j) {
            h->fast[c+j] = (stbi_uc) i;
         }
      }
   }
   return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x1c(%rsp)
cmpl $0x10, 0x1c(%rsp)
jge 0x21741
movl $0x0, 0x18(%rsp)
movl 0x18(%rsp), %eax
movq 0x20(%rsp), %rcx
movslq 0x1c(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x21732
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movb %al, %dl
movq 0x28(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x14(%rsp)
movslq %ecx, %rcx
movb %dl, 0x500(%rax,%rcx)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x216ed
jmp 0x21734
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x216de
movq 0x28(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb $0x0, 0x500(%rax,%rcx)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x1, 0x18(%rsp)
cmpl $0x10, 0x18(%rsp)
jg 0x21859
movl 0x14(%rsp), %edx
subl 0x10(%rsp), %edx
movq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
movl %edx, 0x64c(%rax,%rcx,4)
movq 0x28(%rsp), %rax
movslq 0x14(%rsp), %rcx
movzbl 0x500(%rax,%rcx), %eax
cmpl 0x18(%rsp), %eax
jne 0x2181f
jmp 0x217a9
movq 0x28(%rsp), %rax
movslq 0x14(%rsp), %rcx
movzbl 0x500(%rax,%rcx), %eax
cmpl 0x18(%rsp), %eax
jne 0x217f0
movl 0x10(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rsp)
movw %ax, %dx
movq 0x28(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x14(%rsp)
movslq %ecx, %rcx
movw %dx, 0x200(%rax,%rcx,2)
jmp 0x217a9
movl 0x10(%rsp), %eax
subl $0x1, %eax
movl 0x18(%rsp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jl 0x2181d
leaq 0xc2b1(%rip), %rdi      # 0x2dac0
callq 0x1a190
movl %eax, 0x34(%rsp)
jmp 0x2193e
jmp 0x2181f
movl 0x10(%rsp), %edx
movl $0x10, %ecx
subl 0x18(%rsp), %ecx
shll %cl, %edx
movq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
movl %edx, 0x604(%rax,%rcx,4)
movl 0x10(%rsp), %eax
shll %eax
movl %eax, 0x10(%rsp)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x2176b
movq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
movl $0xffffffff, 0x604(%rax,%rcx,4) # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rdi
movl $0xff, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xd200
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x21936
movq 0x28(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movzbl 0x500(%rax,%rcx), %eax
movl %eax, 0xc(%rsp)
cmpl $0x9, 0xc(%rsp)
jg 0x21924
movq 0x28(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movzwl 0x200(%rax,%rcx,2), %eax
movl $0x9, %ecx
subl 0xc(%rsp), %ecx
shll %cl, %eax
movl %eax, 0x8(%rsp)
movl $0x9, %ecx
subl 0xc(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x4(%rsp)
movl $0x0, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x21922
movl 0x1c(%rsp), %eax
movb %al, %dl
movq 0x28(%rsp), %rax
movl 0x8(%rsp), %ecx
addl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x218f2
jmp 0x21924
jmp 0x21926
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2188a
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)