// File: /workspace/github_c_makefile_star2_O3/zhiyb[P]png2tlg/./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 0xfc21
cmpl $0xa, %eax
ja 0xf58e
leaq 0x95bf(%rip), %rax      # 0x18b48
jmp 0xfb5e
movl %eax, %r15d
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jae 0xf5b0
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
jmp 0xf603
cmpl $0x0, 0x30(%r14)
je 0xf648
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0xf5de
movslq %eax, %rcx
addq %r12, %rcx
movb (%r12), %al
jmp 0xf5f1
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 0xf648
movq %r14, %rdi
callq 0xfc21
movl %eax, 0x4(%r14)
testl %eax, %eax
je 0xf654
movq %r14, %rdi
callq 0xfc21
movl %eax, (%r14)
testl %eax, %eax
je 0xf660
movq 0xb8(%r14), %rdx
movq 0xc0(%r14), %rax
cmpq %rax, %rdx
jae 0xf66c
leaq 0x1(%rdx), %rcx
movq %rcx, 0xb8(%r14)
movb (%rdx), %dl
jmp 0xf6be
leaq 0x9505(%rip), %rax      # 0x18b54
jmp 0xfb5e
leaq 0x9504(%rip), %rax      # 0x18b5f
jmp 0xfb5e
leaq 0x9509(%rip), %rax      # 0x18b70
jmp 0xfb5e
cmpl $0x0, 0x30(%r14)
je 0xfb34
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0xf699
cltq
addq %r12, %rax
movb (%r12), %dl
jmp 0xf6ac
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 0xfb34
movzbl %dl, %r12d
movl $0x1a, %edx
btl %r12d, %edx
jae 0xfb34
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 0xf6ea
leal (%r12,%r12,2), %edx
addl $0x8, %edx
cmpl %edx, %r15d
jne 0xf582
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 0xf742
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0xf79f
cmpl $0x0, 0x30(%r14)
je 0xf76f
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0xf773
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0xf78d
xorl %edx, %edx
jmp 0xf79f
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 0xf7bf
leaq 0x8d1c(%rip), %rdi      # 0x184cf
cmpb (%r15,%rdi), %dl
jne 0xf7bf
incl 0x4850(%rbx)
cmpq %rax, %rcx
jae 0xf7d6
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0xf82f
cmpl $0x0, 0x30(%r14)
je 0xfb4f
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0xf807
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0xf821
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 0xfb57
andl $0xf, %edx
movl %edx, -0x4(%r13)
addl $-0x5, %edx
cmpl $-0x5, %edx
jbe 0xfb3d
cmpq %rax, %rcx
jae 0xf872
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0xf8d1
cmpl $0x0, 0x30(%r14)
je 0xf89f
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0xf8a9
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0xf8c3
movl $0x0, (%r13)
jmp 0xf8e1
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 0xfb46
incq %r15
movslq 0x8(%r14), %r12
addq $0x60, %r13
cmpq %r12, %r15
jl 0xf72b
movl $0x1, %r13d
testl %ebp, %ebp
jne 0xfb68
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 0xfeae
testl %eax, %eax
je 0xfb7a
movl $0x1, %r13d
movl $0x1, %r15d
movl $0x1, %edi
testl %r12d, %r12d
jle 0xf97a
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 0xf957
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 0xfb68
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 0xff0b
xorps %xmm0, %xmm0
movups %xmm0, 0x46e0(%rbx,%r12)
movq $0x0, 0x46f0(%rbx,%r12)
movq %rax, 0x46d8(%rbx,%r12)
testq %rax, %rax
je 0xfb8a
addq $0xf, %rax
andq $-0x10, %rax
movq %rax, 0x46d0(%rbx,%r12)
cmpl $0x0, 0x4830(%rbx)
je 0xfb12
movl %ebp, 0x46f8(%rbx,%r12)
movl %r13d, 0x46fc(%rbx,%r12)
movl 0x24(%rsp), %edi
movl %r14d, %esi
movl $0x2, %edx
movl $0xf, %ecx
callq 0xffc2
movq %rax, 0x46e0(%rbx,%r12)
testq %rax, %rax
je 0xfb8a
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 0xfa0a
jmp 0xfb68
leaq 0x903d(%rip), %rax      # 0x18b78
jmp 0xfb5e
leaq 0x904e(%rip), %rax      # 0x18b92
jmp 0xfb5e
leaq 0x904b(%rip), %rax      # 0x18b98
jmp 0xfb5e
movl $0x0, -0x8(%r13)
leaq 0x902e(%rip), %rax      # 0x18b8c
movq %rax, 0xd693(%rip)      # 0x1d1f8
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x901e(%rip), %rax      # 0x18b9f
movq %rax, 0xd670(%rip)      # 0x1d1f8
jmp 0xfb68
leaq 0x9018(%rip), %rax      # 0x18ba9
movq %rax, 0xd660(%rip)      # 0x1d1f8
movq %rbx, %rdi
movl 0x8(%rsp), %esi
callq 0xff3f
jmp 0xfb65