// File: /workspace/github_c_makefile_star2_O3/patriciogonzalezvivo[P]tprint/include/std/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) return stbi__err("bad component count","Corrupt JPEG");    // JFIF requires
   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");

   for (i=0; i < s->img_n; ++i) {
      z->img_comp[i].id = stbi__get8(s);
      if (z->img_comp[i].id != i+1)   // JFIF requires
         if (z->img_comp[i].id != i)  // some version of jpegtran outputs non-JFIF-compliant files!
            return stbi__err("bad component ID","Corrupt JPEG");
      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 ((1 << 30) / s->img_x / s->img_n < s->img_y) 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;
   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
      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].raw_data = stbi__malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);

      if (z->img_comp[i].raw_data == NULL) {
         for(--i; i >= 0; --i) {
            STBI_FREE(z->img_comp[i].raw_data);
            z->img_comp[i].data = NULL;
         }
         return 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);
      z->img_comp[i].linebuf = NULL;
      if (z->progressive) {
         z->img_comp[i].coeff_w = (z->img_comp[i].w2 + 7) >> 3;
         z->img_comp[i].coeff_h = (z->img_comp[i].h2 + 7) >> 3;
         z->img_comp[i].raw_coeff = STBI_MALLOC(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15);
         z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15);
      } else {
         z->img_comp[i].coeff = 0;
         z->img_comp[i].raw_coeff = 0;
      }
   }

   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 0x1a2af
leaq 0x72ef(%rip), %r13      # 0x20f25
cmpl $0xb, %eax
jb 0x19fae
movl %eax, %r15d
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jae 0x19c61
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
jmp 0x19cb4
cmpl $0x0, 0x30(%r14)
je 0x19cf9
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x19c8f
movslq %eax, %rcx
addq %r12, %rcx
movb (%r12), %al
jmp 0x19ca2
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 0x19cf9
movq %r14, %rdi
callq 0x1a2af
movl %eax, 0x4(%r14)
testl %eax, %eax
je 0x19d05
movq %r14, %rdi
callq 0x1a2af
movl %eax, (%r14)
testl %eax, %eax
je 0x19d11
movq 0xb8(%r14), %rdx
movq 0xc0(%r14), %rax
cmpq %rax, %rdx
jae 0x19d1d
leaq 0x1(%rdx), %rcx
movq %rcx, 0xb8(%r14)
movb (%rdx), %dl
jmp 0x19d6f
leaq 0x7231(%rip), %r13      # 0x20f31
jmp 0x19fae
leaq 0x7230(%rip), %r13      # 0x20f3c
jmp 0x19fae
leaq 0x7235(%rip), %r13      # 0x20f4d
jmp 0x19fae
cmpl $0x0, 0x30(%r14)
je 0x19fa7
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x19d4a
cltq
addq %r12, %rax
movb (%r12), %dl
jmp 0x19d5d
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)
movl %edx, %esi
andb $-0x3, %sil
cmpb $0x1, %sil
jne 0x19fa7
movzbl %dl, %edx
movl %edx, 0x8(%r14)
movl %edx, %esi
leaq 0x45e8(%rbx), %rdi
xorl %r8d, %r8d
movq %r8, -0x18(%rdi)
movq %r8, (%rdi)
addq $0x60, %rdi
decq %rsi
jne 0x19d92
leal (%rdx,%rdx,2), %edx
addl $0x8, %edx
cmpl %edx, %r15d
jne 0x19fae
movl %ebp, 0x10(%rsp)
leaq 0x38(%r14), %rsi
leaq 0x39(%r14), %rdx
movq %rdx, 0x8(%rsp)
leaq 0x45a0(%rbx), %rdx
movq %rdx, 0x40(%rsp)
leaq 0x45ac(%rbx), %r15
xorl %ebp, %ebp
leaq 0x719c(%rip), %r13      # 0x20f7a
movq %rbp, %r12
movslq 0x8(%r14), %rbp
cmpq %rbp, %r12
jge 0x19fca
cmpq %rax, %rcx
jae 0x19e05
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x19e5d
cmpl $0x0, 0x30(%r14)
je 0x19e31
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %rbp
callq *0x10(%r14)
testl %eax, %eax
je 0x19e35
cltq
addq %rbp, %rax
movb (%rbp), %dl
movq %rbp, %rsi
movq 0x8(%rsp), %rcx
jmp 0x19e4f
xorl %edx, %edx
jmp 0x19e5d
movl $0x0, 0x30(%r14)
movb $0x0, 0x38(%r14)
xorl %edx, %edx
movq 0x8(%rsp), %rcx
movq %rcx, %rax
movq %rbp, %rsi
movq %rax, 0xc0(%r14)
movq %rcx, 0xb8(%r14)
movzbl %dl, %edx
movl %edx, -0xc(%r15)
leaq 0x1(%r12), %rbp
cmpq %rdx, %rbp
setne %dil
cmpq %rdx, %r12
setne %dl
testb %dl, %dil
jne 0x1a002
cmpq %rax, %rcx
jae 0x19e96
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x19eef
cmpl $0x0, 0x30(%r14)
je 0x1a014
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x19ec7
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0x19ee1
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(%r15)
leal -0x50(%rdx), %edi
cmpb $-0x40, %dil
jb 0x19fae
andl $0xf, %edx
movl %edx, -0x4(%r15)
addl $-0x5, %edx
cmpl $-0x4, %edx
jb 0x1a00b
cmpq %rax, %rcx
jae 0x19f32
leaq 0x1(%rcx), %rdi
movq %rdi, 0xb8(%r14)
movb (%rcx), %dl
movq %rdi, %rcx
jmp 0x19f8b
cmpl $0x0, 0x30(%r14)
je 0x19f5f
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x19f63
cltq
addq %r12, %rax
movb (%r12), %dl
movq %r12, %rsi
movq 0x8(%rsp), %rcx
jmp 0x19f7d
xorl %edx, %edx
jmp 0x19f8b
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, (%r15)
addq $0x60, %r15
cmpb $0x3, %dl
jbe 0x19dde
leaq 0x6fe1(%rip), %r13      # 0x20f86
jmp 0x19fae
leaq 0x6fa7(%rip), %r13      # 0x20f55
movq %r13, 0xd433(%rip)      # 0x273e8
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r15d
cmpl $0x0, 0x10(%rsp)
jne 0x19fb8
movl (%r14), %ecx
movl 0x4(%r14), %esi
movl $0x40000000, %eax       # imm = 0x40000000
xorl %edx, %edx
movq %rcx, 0x10(%rsp)
divl %ecx
xorl %edx, %edx
divl %ebp
movq %rsi, 0x38(%rsp)
cmpl %esi, %eax
jae 0x1a01e
leaq 0x6f8d(%rip), %r13      # 0x20f8d
jmp 0x19fae
leaq 0x6f60(%rip), %r13      # 0x20f69
jmp 0x19fae
leaq 0x6f6e(%rip), %r13      # 0x20f80
jmp 0x19fae
movl $0x0, -0x8(%r15)
jmp 0x19fae
movl $0x1, %r8d
movl $0x1, %edi
testl %ebp, %ebp
jle 0x1a068
movq %rbp, %rax
shlq $0x5, %rax
leaq (%rax,%rax,2), %rax
movl $0x1, %edi
xorl %ecx, %ecx
movl $0x1, %r8d
movl 0x45a4(%rbx,%rcx), %edx
movl 0x45a8(%rbx,%rcx), %esi
cmpl %r8d, %edx
cmovgl %edx, %r8d
cmpl %edi, %esi
cmovgl %esi, %edi
addq $0x60, %rcx
cmpq %rcx, %rax
jne 0x1a045
leal (,%r8,8), %ecx
leal (,%rdi,8), %esi
movq 0x10(%rsp), %rax
leal (%rax,%r8,8), %eax
decl %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r9d
movq 0x38(%rsp), %rax
leal (%rax,%rdi,8), %eax
decl %eax
xorl %edx, %edx
divl %esi
movl %r8d, 0x4588(%rbx)
movl %edi, 0x458c(%rbx)
movl %ecx, 0x4598(%rbx)
movl %esi, 0x459c(%rbx)
movl %r9d, 0x24(%rsp)
movl %r9d, 0x4590(%rbx)
movl %eax, 0x20(%rsp)
movl %eax, 0x4594(%rbx)
testl %ebp, %ebp
jle 0x19fb8
leal -0x1(%r8), %eax
movl %eax, 0x1c(%rsp)
leal -0x1(%rdi), %eax
movl %eax, 0x18(%rsp)
leaq 0x45fc(%rbx), %r14
negq %rbp
movl $0x1, %ecx
movq %rdi, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, 0x8(%rsp)
movl -0x58(%r14), %r13d
movl -0x54(%r14), %r12d
movl %r13d, %eax
imull 0x10(%rsp), %eax
addl 0x1c(%rsp), %eax
xorl %edx, %edx
divl %r8d
movl %eax, -0x40(%r14)
movl %r12d, %eax
imull 0x38(%rsp), %eax
addl 0x18(%rsp), %eax
xorl %edx, %edx
divl %edi
movl %eax, -0x3c(%r14)
imull 0x24(%rsp), %r13d
leal (,%r13,8), %eax
movl %eax, -0x38(%r14)
imull 0x20(%rsp), %r12d
leal (,%r12,8), %ecx
movl %ecx, -0x34(%r14)
imull %eax, %ecx
orl $0xf, %ecx
movslq %ecx, %rdi
callq 0x8420
movq %rax, -0x24(%r14)
testq %rax, %rax
je 0x1a1ec
addq $0xf, %rax
andq $-0x10, %rax
movq %rax, -0x2c(%r14)
movq $0x0, -0x14(%r14)
cmpl $0x0, 0x4730(%rbx)
je 0x1a1b4
movl %r13d, -0x4(%r14)
movl %r12d, (%r14)
imull %r12d, %r13d
shll $0x6, %r13d
movslq %r13d, %rax
leaq 0xf(,%rax,2), %rdi
callq 0x8420
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
jmp 0x1a1b8
xorl %ecx, %ecx
xorl %eax, %eax
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %r8
movq %rcx, -0xc(%r14)
movq %rax, -0x1c(%r14)
addq $0x60, %r14
movq 0x8(%rsp), %rcx
leaq (%rcx,%rbp), %rax
incq %rax
incq %rcx
cmpq $0x1, %rax
jne 0x1a0f6
jmp 0x19fb8
leaq 0x6da4(%rip), %r13      # 0x20f97
movq 0x8(%rsp), %r15
cmpq $0x1, %r15
je 0x19fae
movq 0x40(%rsp), %r14
leal -0x2(%r15), %eax
leaq (%rax,%rax,2), %rbx
shlq $0x5, %rbx
movq 0x38(%r14,%rbx), %rdi
callq 0x83e0
movq $0x0, 0x30(%r14,%rbx)
decq %r15
cmpq $0x1, %r15
jg 0x1a207
jmp 0x19fae