// File: /workspace/github_cpp_makefile_star2_O3/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__process_frame_header(stbi__jpeg*, int)
static int stbi__process_frame_header(stbi__jpeg *z, int scan)
{
   stbi__context *s = z->s;
   int Lf,p,i,q, h_max=1,v_max=1,c;
   Lf = stbi__get16be(s);         if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG
   p  = stbi__get8(s);            if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline
   s->img_y = stbi__get16be(s);   if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG
   s->img_x = stbi__get16be(s);   if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires
   c = stbi__get8(s);
   if (c != 3 && c != 1 && c != 4) return stbi__err("bad component count","Corrupt JPEG");
   s->img_n = c;
   for (i=0; i < c; ++i) {
      z->img_comp[i].data = NULL;
      z->img_comp[i].linebuf = NULL;
   }

   if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG");

   z->rgb = 0;
   for (i=0; i < s->img_n; ++i) {
      static const unsigned char rgb[3] = { 'R', 'G', 'B' };
      z->img_comp[i].id = stbi__get8(s);
      if (s->img_n == 3 && z->img_comp[i].id == rgb[i])
         ++z->rgb;
      q = stbi__get8(s);
      z->img_comp[i].h = (q >> 4);  if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG");
      z->img_comp[i].v = q & 15;    if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG");
      z->img_comp[i].tq = stbi__get8(s);  if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG");
   }

   if (scan != STBI__SCAN_load) return 1;

   if (!stbi__mad3sizes_valid(s->img_x, s->img_y, s->img_n, 0)) return stbi__err("too large", "Image too large to decode");

   for (i=0; i < s->img_n; ++i) {
      if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;
      if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;
   }

   // compute interleaved mcu info
   z->img_h_max = h_max;
   z->img_v_max = v_max;
   z->img_mcu_w = h_max * 8;
   z->img_mcu_h = v_max * 8;
   // these sizes can't be more than 17 bits
   z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
   z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;

   for (i=0; i < s->img_n; ++i) {
      // number of effective pixels (e.g. for non-interleaved MCU)
      z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;
      z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;
      // to simplify generation, we'll allocate enough memory to decode
      // the bogus oversized data from using interleaved MCUs and their
      // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
      // discard the extra data until colorspace conversion
      //
      // img_mcu_x, img_mcu_y: <=17 bits; comp[i].h and .v are <=4 (checked earlier)
      // so these muls can't overflow with 32-bit ints (which we require)
      z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
      z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
      z->img_comp[i].coeff = 0;
      z->img_comp[i].raw_coeff = 0;
      z->img_comp[i].linebuf = NULL;
      z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15);
      if (z->img_comp[i].raw_data == NULL)
         return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory"));
      // align blocks for idct using mmx/sse
      z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
      if (z->progressive) {
         // w2, h2 are multiples of 8 (see above)
         z->img_comp[i].coeff_w = z->img_comp[i].w2 / 8;
         z->img_comp[i].coeff_h = z->img_comp[i].h2 / 8;
         z->img_comp[i].raw_coeff = stbi__malloc_mad3(z->img_comp[i].w2, z->img_comp[i].h2, sizeof(short), 15);
         if (z->img_comp[i].raw_coeff == NULL)
            return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory"));
         z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15);
      }
   }

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %r14
movq %r14, %rdi
callq 0x31b23
cmpl $0xa, %eax
ja 0x31490
leaq 0xe4a0(%rip), %rax      # 0x3f92b
jmp 0x31a60
movl %eax, %r15d
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jae 0x314b2
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
jmp 0x31505
cmpl $0x0, 0x30(%r14)
je 0x3154a
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x314e0
movslq %eax, %rcx
addq %r12, %rcx
movb (%r12), %al
jmp 0x314f3
movl $0x0, 0x30(%r14)
leaq 0x39(%r14), %rcx
movb $0x0, 0x38(%r14)
xorl %eax, %eax
movq %rcx, 0xc0(%r14)
leaq 0x39(%r14), %rcx
movq %rcx, 0xb8(%r14)
cmpb $0x8, %al
jne 0x3154a
movq %r14, %rdi
callq 0x31b23
movl %eax, 0x4(%r14)
testl %eax, %eax
je 0x31556
movq %r14, %rdi
callq 0x31b23
movl %eax, (%r14)
testl %eax, %eax
je 0x31562
movq 0xb8(%r14), %rdx
movq 0xc0(%r14), %rax
cmpq %rax, %rdx
jae 0x3156e
leaq 0x1(%rdx), %rcx
movq %rcx, 0xb8(%r14)
movb (%rdx), %dl
jmp 0x315c0
leaq 0xe3e6(%rip), %rax      # 0x3f937
jmp 0x31a60
leaq 0xe3e5(%rip), %rax      # 0x3f942
jmp 0x31a60
leaq 0xe3ea(%rip), %rax      # 0x3f953
jmp 0x31a60
cmpl $0x0, 0x30(%r14)
je 0x31a36
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x3159b
cltq
addq %r12, %rax
movb (%r12), %dl
jmp 0x315ae
movl $0x0, 0x30(%r14)
leaq 0x39(%r14), %rax
movb $0x0, 0x38(%r14)
xorl %edx, %edx
movq %rax, 0xc0(%r14)
leaq 0x39(%r14), %rcx
movq %rcx, 0xb8(%r14)
cmpb $0x4, %dl
ja 0x31a36
movzbl %dl, %r12d
movl $0x1a, %edx
btl %r12d, %edx
jae 0x31a36
movl %r12d, 0x8(%r14)
movl %r12d, %edx
leaq 0x46d0(%rbx), %rsi
xorl %edi, %edi
movq %rdi, (%rsi)
movq %rdi, 0x18(%rsi)
addq $0x60, %rsi
decq %rdx
jne 0x315ec
leal (%r12,%r12,2), %edx
addl $0x8, %edx
cmpl %edx, %r15d
jne 0x31484
movl $0x0, 0x4850(%rbx)
leaq 0x38(%r14), %rsi
leaq 0x39(%r14), %rdx
movq %rdx, 0x8(%rsp)
leaq 0x46ac(%rbx), %r13
xorl %r15d, %r15d
cmpq %rax, %rcx
jae 0x31644
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x316a1
cmpl $0x0, 0x30(%r14)
je 0x31671
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x31675
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0x3168f
xorl %edx, %edx
jmp 0x316a1
movl $0x0, 0x30(%r14)
movb $0x0, 0x38(%r14)
xorl %edx, %edx
movq 0x8(%rsp), %rcx
movq %rcx, %rax
movq %r12, %rsi
movq %rax, 0xc0(%r14)
movq %rcx, 0xb8(%r14)
movl 0x8(%r14), %r12d
movzbl %dl, %edi
movl %edi, -0xc(%r13)
cmpl $0x3, %r12d
jne 0x316c1
leaq 0xc26a(%rip), %rdi      # 0x3d91f
cmpb (%r15,%rdi), %dl
jne 0x316c1
incl 0x4850(%rbx)
cmpq %rax, %rcx
jae 0x316d8
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x31731
cmpl $0x0, 0x30(%r14)
je 0x31a51
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x31709
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0x31723
movl $0x0, 0x30(%r14)
movb $0x0, 0x38(%r14)
xorl %edx, %edx
movq 0x8(%rsp), %rcx
movq %rcx, %rax
movq %r12, %rsi
movq %rax, 0xc0(%r14)
movq %rcx, 0xb8(%r14)
movzbl %dl, %edx
movl %edx, %edi
shrl $0x4, %edi
movl %edi, -0x8(%r13)
leal -0x50(%rdx), %edi
cmpb $-0x41, %dil
jbe 0x31a59
andl $0xf, %edx
movl %edx, -0x4(%r13)
addl $-0x5, %edx
cmpl $-0x5, %edx
jbe 0x31a3f
cmpq %rax, %rcx
jae 0x31774
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x317d3
cmpl $0x0, 0x30(%r14)
je 0x317a1
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x317ab
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0x317c5
movl $0x0, (%r13)
jmp 0x317e3
movl $0x0, 0x30(%r14)
movb $0x0, 0x38(%r14)
xorl %edx, %edx
movq 0x8(%rsp), %rcx
movq %rcx, %rax
movq %r12, %rsi
movq %rax, 0xc0(%r14)
movq %rcx, 0xb8(%r14)
movzbl %dl, %edx
movl %edx, (%r13)
cmpb $0x4, %dl
jae 0x31a48
incq %r15
movslq 0x8(%r14), %r12
addq $0x60, %r13
cmpq %r12, %r15
jl 0x3162d
movl $0x1, %r13d
testl %ebp, %ebp
jne 0x31a6a
movl (%r14), %edi
movl 0x4(%r14), %esi
xorl %r13d, %r13d
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x31db0
testl %eax, %eax
je 0x31a7c
movl $0x1, %r13d
movl $0x1, %r15d
movl $0x1, %edi
testl %r12d, %r12d
jle 0x3187c
movq %r12, %rax
shlq $0x5, %rax
leaq (%rax,%rax,2), %rax
movl $0x1, %edi
xorl %ecx, %ecx
movl $0x1, %r15d
movl 0x46a4(%rbx,%rcx), %edx
movl 0x46a8(%rbx,%rcx), %esi
cmpl %r15d, %edx
cmovgl %edx, %r15d
cmpl %edi, %esi
cmovgl %esi, %edi
addq $0x60, %rcx
cmpq %rcx, %rax
jne 0x31859
leal (,%r15,8), %ecx
leal (,%rdi,8), %esi
movq 0x30(%rsp), %rax
leal (%rax,%r15,8), %eax
decl %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r8d
movq 0x28(%rsp), %rax
leal (%rax,%rdi,8), %eax
decl %eax
xorl %edx, %edx
divl %esi
movl %r15d, 0x4688(%rbx)
movl %edi, 0x468c(%rbx)
movl %ecx, 0x4698(%rbx)
movl %esi, 0x469c(%rbx)
movl %r8d, 0x20(%rsp)
movl %r8d, 0x4690(%rbx)
movl %eax, 0x1c(%rsp)
movl %eax, 0x4694(%rbx)
testl %r12d, %r12d
jle 0x31a6a
leal -0x1(%r15), %eax
movl %eax, 0x18(%rsp)
leal -0x1(%rdi), %eax
movl %eax, 0x14(%rsp)
shlq $0x5, %r12
leaq (%r12,%r12,2), %rax
movq %rax, 0x38(%rsp)
movl $0x1, %eax
xorl %r12d, %r12d
movq %rdi, 0x40(%rsp)
movl %eax, 0x8(%rsp)
movl 0x46a4(%rbx,%r12), %ebp
movl 0x46a8(%rbx,%r12), %r13d
movl %ebp, %eax
imull 0x30(%rsp), %eax
addl 0x18(%rsp), %eax
xorl %edx, %edx
divl %r15d
movl %eax, 0x46bc(%rbx,%r12)
movl %r13d, %eax
imull 0x28(%rsp), %eax
addl 0x14(%rsp), %eax
xorl %edx, %edx
divl %edi
movl %eax, 0x46c0(%rbx,%r12)
imull 0x20(%rsp), %ebp
leal (,%rbp,8), %edi
movl %edi, 0x46c4(%rbx,%r12)
imull 0x1c(%rsp), %r13d
leal (,%r13,8), %r14d
movl %r14d, 0x46c8(%rbx,%r12)
movl %edi, 0x24(%rsp)
movl %r14d, %esi
movl $0xf, %edx
callq 0x31e0d
xorps %xmm0, %xmm0
movups %xmm0, 0x46e0(%rbx,%r12)
movq $0x0, 0x46f0(%rbx,%r12)
movq %rax, 0x46d8(%rbx,%r12)
testq %rax, %rax
je 0x31a8c
addq $0xf, %rax
andq $-0x10, %rax
movq %rax, 0x46d0(%rbx,%r12)
cmpl $0x0, 0x4830(%rbx)
je 0x31a14
movl %ebp, 0x46f8(%rbx,%r12)
movl %r13d, 0x46fc(%rbx,%r12)
movl 0x24(%rsp), %edi
movl %r14d, %esi
movl $0x2, %edx
movl $0xf, %ecx
callq 0x31ec4
movq %rax, 0x46e0(%rbx,%r12)
testq %rax, %rax
je 0x31a8c
addq $0xf, %rax
andq $-0x10, %rax
movq %rax, 0x46f0(%rbx,%r12)
movl 0x8(%rsp), %eax
incl %eax
addq $0x60, %r12
movl $0x1, %r13d
cmpq %r12, 0x38(%rsp)
movq 0x40(%rsp), %rdi
jne 0x3190c
jmp 0x31a6a
leaq 0xdf1e(%rip), %rax      # 0x3f95b
jmp 0x31a60
leaq 0xdf2f(%rip), %rax      # 0x3f975
jmp 0x31a60
leaq 0xdf2c(%rip), %rax      # 0x3f97b
jmp 0x31a60
movl $0x0, -0x8(%r13)
leaq 0xdf0f(%rip), %rax      # 0x3f96f
movq %rax, 0x1da61(%rip)     # 0x4f4c8
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdeff(%rip), %rax      # 0x3f982
movq %rax, 0x1da3e(%rip)     # 0x4f4c8
jmp 0x31a6a
leaq 0xdef9(%rip), %rax      # 0x3f98c
movq %rax, 0x1da2e(%rip)     # 0x4f4c8
movq %rbx, %rdi
movl 0x8(%rsp), %esi
callq 0x31e41
jmp 0x31a67