// File: /workspace/github_cpp_makefile_star2_O2/srajangarg[P]raytracer/src/core/stb_image.hpp
// Function: stbi__jpeg_decode_block(stbi__jpeg*, short*, stbi__huffman*, stbi__huffman*, short*, int, unsigned char*)
static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant)
{
   int diff,dc,k;
   int t;

   if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
   t = stbi__jpeg_huff_decode(j, hdc);
   if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG");

   // 0 all the ac values now so we can do it 32-bits at a time
   memset(data,0,64*sizeof(data[0]));

   diff = t ? stbi__extend_receive(j, t) : 0;
   dc = j->img_comp[b].dc_pred + diff;
   j->img_comp[b].dc_pred = dc;
   data[0] = (short) (dc * dequant[0]);

   // decode AC components, see JPEG spec
   k = 1;
   do {
      unsigned int zig;
      int c,r,s;
      if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
      c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
      r = fac[c];
      if (r) { // fast-AC path
         k += (r >> 4) & 15; // run
         s = r & 15; // combined length
         j->code_buffer <<= s;
         j->code_bits -= s;
         // decode into unzigzag'd location
         zig = stbi__jpeg_dezigzag[k++];
         data[zig] = (short) ((r >> 8) * dequant[zig]);
      } else {
         int rs = stbi__jpeg_huff_decode(j, hac);
         if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
         s = rs & 15;
         r = rs >> 4;
         if (s == 0) {
            if (rs != 0xf0) break; // end block
            k += 16;
         } else {
            k += r;
            // decode into unzigzag'd location
            zig = stbi__jpeg_dezigzag[k++];
            data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]);
         }
      }
   } while (k < 64);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %r8, %rbx
movq %rcx, (%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
cmpl $0xf, 0x4724(%rdi)
jg 0x17e08
movq %r12, %rdi
callq 0x17f6f
movq %r12, %rdi
movq %r13, %rsi
callq 0x180aa
testl %eax, %eax
js 0x17f50
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%r15)
movups %xmm0, 0x60(%r15)
movups %xmm0, 0x50(%r15)
movups %xmm0, 0x40(%r15)
movups %xmm0, 0x30(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
je 0x17e53
movq %r12, %rdi
movl %eax, %esi
callq 0x181d1
jmp 0x17e55
xorl %eax, %eax
movslq %ebp, %rcx
imulq $0x60, %rcx, %rcx
addl 0x45b8(%r12,%rcx), %eax
movl %eax, 0x45b8(%r12,%rcx)
movq 0x40(%rsp), %rcx
movzbl (%rcx), %ecx
imull %eax, %ecx
movw %cx, (%r15)
pushq $0x1
popq %r14
leaq 0x9eaa(%rip), %rbp      # 0x21d30
cmpl $0xf, 0x4724(%r12)
jg 0x17e99
movq %r12, %rdi
callq 0x17f6f
movl 0x4720(%r12), %eax
movl %eax, %ecx
shrl $0x17, %ecx
movzwl (%rbx,%rcx,2), %ecx
movslq %r14d, %r13
testl %ecx, %ecx
je 0x17ef3
movswl %cx, %edx
movl %ecx, %esi
shrl $0x4, %esi
andl $0xf, %ecx
shll %cl, %eax
movl %eax, 0x4720(%r12)
subl %ecx, 0x4724(%r12)
andl $0xf, %esi
addq %r13, %rsi
leal 0x1(%rsi), %r14d
movzbl (%rbp,%rsi), %eax
sarl $0x8, %edx
movq 0x40(%rsp), %rcx
movzbl (%rcx,%rax), %ecx
imull %edx, %ecx
movw %cx, (%r15,%rax,2)
jmp 0x17f41
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x180aa
testl %eax, %eax
js 0x17f50
movl %eax, %esi
andl $0xf, %esi
je 0x17f36
shrl $0x4, %eax
addq %r13, %rax
leal 0x1(%rax), %r14d
movzbl (%rbp,%rax), %r13d
movq %r12, %rdi
callq 0x181d1
movq 0x40(%rsp), %rcx
movzbl (%rcx,%r13), %ecx
imull %eax, %ecx
movw %cx, (%r15,%r13,2)
jmp 0x17f41
cmpl $0xf0, %eax
jne 0x17f4b
addl $0x10, %r14d
cmpl $0x40, %r14d
jl 0x17e86
pushq $0x1
popq %rax
jmp 0x17f60
leaq 0xa2df(%rip), %rax      # 0x22236
movq %rax, 0x17472(%rip)     # 0x2f3d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq