// File: /workspace/github_c_makefile_star2_O3/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__zbuild_huffman
static int stbi__zbuild_huffman(stbi__zhuffman *z, stbi_uc *sizelist, int num)
{
   int i,k=0;
   int code, next_code[16], sizes[17];

   // DEFLATE spec for generating codes
   memset(sizes, 0, sizeof(sizes));
   memset(z->fast, 255, sizeof(z->fast));
   for (i=0; i < num; ++i) 
      ++sizes[sizelist[i]];
   sizes[0] = 0;
   for (i=1; i < 16; ++i)
      STBI_ASSERT(sizes[i] <= (1 << i));
   code = 0;
   for (i=1; i < 16; ++i) {
      next_code[i] = code;
      z->firstcode[i] = (stbi__uint16) code;
      z->firstsymbol[i] = (stbi__uint16) k;
      code = (code + sizes[i]);
      if (sizes[i])
         if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt JPEG");
      z->maxcode[i] = code << (16-i); // preshift for inner loop
      code <<= 1;
      k += sizes[i];
   }
   z->maxcode[16] = 0x10000; // sentinel
   for (i=0; i < num; ++i) {
      int s = sizelist[i];
      if (s) {
         int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
         z->size [c] = (stbi_uc     ) s;
         z->value[c] = (stbi__uint16) i;
         if (s <= STBI__ZFAST_BITS) {
            int k = stbi__bit_reverse(next_code[s],s);
            while (k < (1 << STBI__ZFAST_BITS)) {
               z->fast[k] = (stbi__uint16) c;
               k += (1 << s);
            }
         }
         ++next_code[s];
      }
   }
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
pxor %xmm0, %xmm0
movdqa %xmm0, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
movdqa %xmm0, 0x30(%rsp)
movdqa %xmm0, 0x20(%rsp)
movl $0x0, 0x60(%rsp)
movl $0x400, %edx            # imm = 0x400
movl $0xff, %esi
callq 0x4010e0
testl %ebp, %ebp
jle 0x4130d8
movl %ebp, %eax
xorl %ecx, %ecx
movzbl (%rbx,%rcx), %edx
incl 0x20(%rsp,%rdx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x4130c8
movl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
cmpl %eax, 0x20(%rsp,%rcx,4)
jg 0x413597
incq %rcx
cmpq $0x10, %rcx
jne 0x4130dd
xorl %edx, %edx
movl $0xf, %eax
xorl %esi, %esi
xorl %edi, %edi
movl %esi, 0x74(%rsp,%rdx,4)
movw %si, 0x402(%r14,%rdx,2)
movw %di, 0x466(%r14,%rdx,2)
movl 0x24(%rsp,%rdx,4), %r8d
addl %r8d, %esi
leal 0x1(%rdx), %ecx
movl $0x1, %r9d
shll %cl, %r9d
testl %r8d, %r8d
je 0x41313a
cmpl %r9d, %esi
jg 0x413575
movl %esi, %r9d
movl %eax, %ecx
shll %cl, %r9d
movl %r9d, 0x424(%r14,%rdx,4)
addl %esi, %esi
addl %r8d, %edi
decl %eax
incq %rdx
cmpq $0xf, %rdx
jne 0x413102
movl $0x10000, 0x460(%r14) # imm = 0x10000
movl $0x1, %eax
testl %ebp, %ebp
jle 0x413585
movl %ebp, %eax
movq %rax, 0x10(%rsp)
xorl %edi, %edi
movdqa 0xc52cd(%rip), %xmm0    # 0x4d8450
movdqa 0xc52d5(%rip), %xmm1    # 0x4d8460
movdqa 0xc4b9d(%rip), %xmm2    # 0x4d7d30
movdqa 0xc47a5(%rip), %xmm3    # 0x4d7940
movdqa 0xc47ad(%rip), %xmm4    # 0x4d7950
pcmpeqd %xmm5, %xmm5
movq %rbx, 0x8(%rsp)
movzbl (%rbx,%rdi), %edx
testl %edx, %edx
je 0x413560
movslq 0x70(%rsp,%rdx,4), %rcx
movzwl 0x400(%r14,%rdx,2), %eax
movq %rcx, (%rsp)
subq %rax, %rcx
movzwl 0x464(%r14,%rdx,2), %r12d
addq %rcx, %r12
movb %dl, 0x484(%r14,%r12)
movw %di, 0x5a4(%r14,%r12,2)
cmpb $0x9, %dl
ja 0x413551
movq (%rsp), %rax
rolw $0x8, %ax
movl %eax, %ecx
shrl $0x4, %ecx
movl $0xf0f, %esi            # imm = 0xF0F
andl %esi, %ecx
andl %esi, %eax
shll $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
movl $0x3333, %esi           # imm = 0x3333
andl %esi, %ecx
shrl $0x2, %eax
andl %esi, %eax
leal (%rax,%rcx,4), %eax
movl %eax, %ecx
movl $0x5555, %esi           # imm = 0x5555
andl %esi, %ecx
shrl %eax
andl %esi, %eax
leal (%rax,%rcx,2), %eax
movb $0x10, %cl
subb %dl, %cl
shrl %cl, %eax
cmpl $0x1ff, %eax            # imm = 0x1FF
ja 0x413551
movl $0x1, %r13d
movl %edx, %ecx
shlq %cl, %r13
movl %eax, %ebp
movq %rbp, %rax
addq %r13, %rax
xorl %esi, %esi
movl $0x200, %ecx            # imm = 0x200
cmpq %rcx, %rax
setb %sil
cmpq $0x201, %rax            # imm = 0x201
movl $0x200, %r8d            # imm = 0x200
cmovaeq %rax, %r8
subq %rsi, %r8
subq %rax, %r8
movl %edx, %ecx
shrq %cl, %r8
leaq (%rsi,%r8), %r9
leaq (%rsi,%r8), %r11
addq $0x8, %r11
andq $-0x8, %r11
movl $0x3, %r8d
shlq %cl, %r8
movl $0x5, %eax
shlq %cl, %rax
movq %r9, %xmm6
pshufd $0x44, %xmm6, %xmm6     # xmm6 = xmm6[0,1,0,1]
movl $0x6, %r9d
shlq %cl, %r9
movl $0x7, %r10d
shlq %cl, %r10
leaq (,%r13,2), %rcx
movq %rcx, 0x18(%rsp)
leaq (,%r13,4), %rbx
pxor %xmm4, %xmm6
xorl %esi, %esi
movq %rsi, %r15
movl %edx, %ecx
shlq %cl, %r15
addq %rbp, %r15
movq %rsi, %xmm7
pshufd $0x44, %xmm7, %xmm7     # xmm7 = xmm7[0,1,0,1]
movdqa %xmm7, %xmm8
por %xmm3, %xmm8
pxor %xmm4, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm6, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm6, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm5, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %ecx
testb $0x1, %cl
je 0x41334e
movw %r12w, (%r14,%r15,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm5, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %ecx
shrl $0x10, %ecx
testb $0x1, %cl
je 0x41337d
leaq (%r15,%r13), %rcx
movw %r12w, (%r14,%rcx,2)
movdqa %xmm7, %xmm9
por %xmm2, %xmm9
pxor %xmm4, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm6, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm6, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm5, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %ecx
testb $0x1, %cl
je 0x4133e3
movq 0x18(%rsp), %rcx
addq %r15, %rcx
movw %r12w, (%r14,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm5, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %ecx
testb $0x1, %cl
je 0x41341d
leaq (%r15,%r8), %rcx
movw %r12w, (%r14,%rcx,2)
movdqa %xmm7, %xmm8
por %xmm1, %xmm8
pxor %xmm4, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm6, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm6, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm5, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %ecx
testb $0x1, %cl
je 0x413487
leaq (%r15,%rbx), %rcx
movw %r12w, (%r14,%rcx,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm5, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %ecx
testb $0x1, %cl
je 0x4134b4
leaq (%r15,%rax), %rcx
movw %r12w, (%r14,%rcx,2)
por %xmm0, %xmm7
pxor %xmm4, %xmm7
movdqa %xmm7, %xmm9
pcmpgtd %xmm6, %xmm9
pshufd $0xa0, %xmm9, %xmm8     # xmm8 = xmm9[0,0,2,2]
pcmpeqd %xmm6, %xmm7
pshufd $0xf5, %xmm7, %xmm7     # xmm7 = xmm7[1,1,3,3]
movdqa %xmm7, %xmm10
pand %xmm8, %xmm10
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
por %xmm9, %xmm10
packssdw %xmm10, %xmm10
pxor %xmm5, %xmm10
packssdw %xmm10, %xmm10
pextrw $0x6, %xmm10, %ecx
testb $0x1, %cl
je 0x41350d
leaq (%r15,%r9), %rcx
movw %r12w, (%r14,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm7, %xmm7     # xmm7 = xmm7[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm7
pshufhw $0x84, %xmm9, %xmm8     # xmm8 = xmm9[0,1,2,3,4,5,4,6]
por %xmm7, %xmm8
pxor %xmm5, %xmm8
packssdw %xmm8, %xmm7
pextrw $0x7, %xmm7, %ecx
testb $0x1, %cl
je 0x413544
addq %r10, %r15
movw %r12w, (%r14,%r15,2)
addq $0x8, %rsi
cmpq %rsi, %r11
jne 0x4132d4
movq (%rsp), %rax
incl %eax
movl %eax, 0x70(%rsp,%rdx,4)
movq 0x8(%rsp), %rbx
incq %rdi
cmpq 0x10(%rsp), %rdi
jne 0x4131ac
movl $0x1, %eax
jmp 0x413585
leaq 0xc5ae7(%rip), %rax     # 0x4d9063
movq %rax, 0x108f9d(%rip)    # 0x51c520
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc5a75(%rip), %rdi     # 0x4d9013
leaq 0xc54f9(%rip), %rsi     # 0x4d8a9e
leaq 0xc5a7c(%rip), %rcx     # 0x4d9028
movl $0x6a7, %edx            # imm = 0x6A7
callq 0x4209d0