// File: /workspace/github_c_makefile_star2_O0/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__process_scan_header(stbi__jpeg*)
static int stbi__process_scan_header(stbi__jpeg *z)
{
   int i;
   int Ls = stbi__get16be(z->s);
   z->scan_n = stbi__get8(z->s);
   if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG");
   if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG");
   for (i=0; i < z->scan_n; ++i) {
      int id = stbi__get8(z->s), which;
      int q = stbi__get8(z->s);
      for (which = 0; which < z->s->img_n; ++which)
         if (z->img_comp[which].id == id)
            break;
      if (which == z->s->img_n) return 0; // no match
      z->img_comp[which].hd = q >> 4;   if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG");
      z->img_comp[which].ha = q & 15;   if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG");
      z->order[i] = which;
   }

   {
      int aa;
      z->spec_start = stbi__get8(z->s);
      z->spec_end   = stbi__get8(z->s); // should be 63, but might be 0
      aa = stbi__get8(z->s);
      z->succ_high = (aa >> 4);
      z->succ_low  = (aa & 15);
      if (z->progressive) {
         if (z->spec_start > 63 || z->spec_end > 63  || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13)
            return stbi__err("bad SOS", "Corrupt JPEG");
      } else {
         if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG");
         if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG");
         z->spec_end = 63;
      }
   }

   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12fa0
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4854(%rax)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x4854(%rax)
jl 0x14ab4
movq -0x10(%rbp), %rax
cmpl $0x4, 0x4854(%rax)
jg 0x14ab4
movq -0x10(%rbp), %rax
movl 0x4854(%rax), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x8(%rcx), %eax
jle 0x14ac8
leaq 0xbeb4(%rip), %rdi      # 0x2096f
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x4854(%rcx), %ecx
shll %ecx
addl $0x6, %ecx
cmpl %ecx, %eax
je 0x14af2
leaq 0xbea2(%rip), %rdi      # 0x20987
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4854(%rcx), %eax
jge 0x14c46
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x8(%rcx), %eax
jge 0x14b71
movq -0x10(%rbp), %rax
addq $0x46a0, %rax           # imm = 0x46A0
movslq -0x20(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x14b64
jmp 0x14b71
jmp 0x14b66
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x14b37
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x8(%rcx), %eax
jne 0x14b8c
movl $0x0, -0x4(%rbp)
jmp 0x14d72
movl -0x24(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
addq $0x46a0, %rax           # imm = 0x46A0
movslq -0x20(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
addq $0x46a0, %rax           # imm = 0x46A0
movslq -0x20(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x3, 0x10(%rax)
jle 0x14bd9
leaq 0xbdc7(%rip), %rdi      # 0x20993
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movl -0x24(%rbp), %ecx
andl $0xf, %ecx
movq -0x10(%rbp), %rax
addq $0x46a0, %rax           # imm = 0x46A0
movslq -0x20(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
addq $0x46a0, %rax           # imm = 0x46A0
movslq -0x20(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x3, 0x14(%rax)
jle 0x14c26
leaq 0xbd86(%rip), %rdi      # 0x2099f
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movl -0x20(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, 0x4858(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x14af9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4834(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4838(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x483c(%rax)
movl -0x28(%rbp), %ecx
andl $0xf, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4840(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4830(%rax)
je 0x14d14
movq -0x10(%rbp), %rax
cmpl $0x3f, 0x4834(%rax)
jg 0x14d01
movq -0x10(%rbp), %rax
cmpl $0x3f, 0x4838(%rax)
jg 0x14d01
movq -0x10(%rbp), %rax
movl 0x4834(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4838(%rcx), %eax
jg 0x14d01
movq -0x10(%rbp), %rax
cmpl $0xd, 0x483c(%rax)
jg 0x14d01
movq -0x10(%rbp), %rax
cmpl $0xd, 0x4840(%rax)
jle 0x14d12
leaq 0xbca3(%rip), %rdi      # 0x209ab
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
jmp 0x14d6b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4834(%rax)
je 0x14d32
leaq 0xbc83(%rip), %rdi      # 0x209ab
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movq -0x10(%rbp), %rax
cmpl $0x0, 0x483c(%rax)
jne 0x14d4c
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4840(%rax)
je 0x14d5d
leaq 0xbc58(%rip), %rdi      # 0x209ab
callq 0x2680
movl %eax, -0x4(%rbp)
jmp 0x14d72
movq -0x10(%rbp), %rax
movl $0x3f, 0x4838(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)