// File: /workspace/github_c_makefile_star2_O0/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__jpeg_huff_decode(stbi__jpeg*, stbi__huffman*)
stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)
{
   unsigned int temp;
   int c,k;

   if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);

   // look at the top FAST_BITS and determine what symbol ID it is,
   // if the code is <= FAST_BITS
   c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
   k = h->fast[c];
   if (k < 255) {
      int s = h->size[k];
      if (s > j->code_bits)
         return -1;
      j->code_buffer <<= s;
      j->code_bits -= s;
      return h->values[k];
   }

   // naive test is to shift the code_buffer down so k bits are
   // valid, then test against maxcode. To speed this up, we've
   // preshifted maxcode left so that it has (16-k) 0s at the
   // end; in other words, regardless of the number of bits, it
   // wants to be compared against something shifted to have 16;
   // that way we don't need to shift inside the loop.
   temp = j->code_buffer >> 16;
   for (k=FAST_BITS+1 ; ; ++k)
      if (temp < h->maxcode[k])
         break;
   if (k == 17) {
      // error! code not found
      j->code_bits -= 16;
      return -1;
   }

   if (k > j->code_bits)
      return -1;

   // convert the huffman code to the symbol id
   c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];
   STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);

   // convert the id to a symbol
   j->code_bits -= k;
   j->code_buffer <<= k;
   return h->values[c];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x10, 0x4824(%rax)
jge 0x16566
movq -0x10(%rbp), %rdi
callq 0x15e10
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %eax
shrl $0x17, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x24(%rbp)
cmpl $0xff, -0x24(%rbp)
jge 0x16605
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl 0x500(%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4824(%rcx), %eax
jle 0x165c1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16766
movl -0x28(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x4820(%rax)
movl -0x28(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x4824(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4824(%rax)
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl 0x400(%rax,%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x16766
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %eax
shrl $0x10, %eax
movl %eax, -0x1c(%rbp)
movl $0xa, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
cmpl 0x604(%rcx,%rdx,4), %eax
jae 0x16632
jmp 0x1663f
jmp 0x16634
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1661c
cmpl $0x11, -0x24(%rbp)
jne 0x16664
movq -0x10(%rbp), %rax
movl 0x4824(%rax), %ecx
subl $0x10, %ecx
movl %ecx, 0x4824(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16766
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4824(%rcx), %eax
jle 0x1667f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16766
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %eax
movl $0x20, %ecx
subl -0x24(%rbp), %ecx
shrl %cl, %eax
movslq -0x24(%rbp), %rdx
leaq 0x9c42(%rip), %rcx      # 0x202e0
andl (%rcx,%rdx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
addl 0x64c(%rcx,%rdx,4), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
movzbl 0x500(%rcx,%rdx), %edx
movl $0x20, %ecx
subl %edx, %ecx
shrl %cl, %eax
movq -0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
movzbl 0x500(%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0x9bf1(%rip), %rcx      # 0x202e0
andl (%rcx,%rdx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
movzwl 0x200(%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jne 0x16708
jmp 0x16727
leaq 0xa2b5(%rip), %rdi      # 0x209c4
leaq 0xa0c0(%rip), %rsi      # 0x207d6
movl $0x7a0, %edx            # imm = 0x7A0
leaq 0xa2f4(%rip), %rcx      # 0x20a16
callq 0x2140
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x4824(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4824(%rax)
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x4820(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x4820(%rax)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl 0x400(%rax,%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop