// File: /workspace/github_c_makefile_star2_O1/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 0x1aea1
leaq 0x772e(%rip), %r13      # 0x21f15
cmpl $0xb, %eax
jb 0x1ab8c
movl %eax, %r15d
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x1a860
cmpl $0x0, 0x30(%r14)
je 0x1a8d6
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x1a83a
movq %r12, 0xb8(%r14)
cltq
addq %r12, %rax
movq %rax, 0xc0(%r14)
jmp 0x1a859
movl $0x0, 0x30(%r14)
movq %r12, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
cmpb $0x8, (%rax)
jne 0x1a8d6
movq %r14, %rdi
callq 0x1aea1
movl %eax, 0x4(%r14)
testl %eax, %eax
je 0x1a8e2
movq %r14, %rdi
callq 0x1aea1
movl %eax, (%r14)
testl %eax, %eax
je 0x1a8ee
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x1a924
cmpl $0x0, 0x30(%r14)
je 0x1a8fa
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r12
movl 0x34(%r14), %edx
movq %r12, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x1a8fe
movq %r12, 0xb8(%r14)
cltq
addq %r12, %rax
movq %rax, 0xc0(%r14)
jmp 0x1a91d
leaq 0x7644(%rip), %r13      # 0x21f21
jmp 0x1ab8c
leaq 0x7643(%rip), %r13      # 0x21f2c
jmp 0x1ab8c
leaq 0x7648(%rip), %r13      # 0x21f3d
jmp 0x1ab8c
xorl %eax, %eax
jmp 0x1a931
movl $0x0, 0x30(%r14)
movq %r12, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
movl %eax, %ecx
andb $-0x3, %cl
cmpb $0x1, %cl
jne 0x1ab85
movzbl %al, %eax
movl %eax, 0x8(%r14)
testl %eax, %eax
je 0x1a970
movl %eax, %ecx
shll $0x5, %ecx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq %rdx, 0x45d0(%rbx,%rsi)
movq %rdx, 0x45e8(%rbx,%rsi)
addq $0x60, %rsi
cmpq %rsi, %rcx
jne 0x1a957
leal (%rax,%rax,2), %eax
addl $0x8, %eax
cmpl %eax, %r15d
jne 0x1ab8c
movl %ebp, 0x10(%rsp)
leaq 0x38(%r14), %rsi
leaq 0x39(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x45ac(%rbx), %r15
xorl %r12d, %r12d
leaq 0x75b8(%rip), %r13      # 0x21f59
movslq 0x8(%r14), %rbp
cmpq %rbp, %r12
jge 0x1aba8
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x1aa1b
cmpl $0x0, 0x30(%r14)
je 0x1a9ed
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %rbp
callq *0x10(%r14)
testl %eax, %eax
je 0x1a9f1
movq %rbp, 0xb8(%r14)
cltq
addq %rbp, %rax
movq %rax, 0xc0(%r14)
jmp 0x1aa11
xorl %eax, %eax
jmp 0x1aa28
movl $0x0, 0x30(%r14)
movq %rbp, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq %rbp, %rsi
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
movzbl %al, %eax
movl %eax, -0xc(%r15)
leaq 0x1(%r12), %rbp
cmpq %rax, %rbp
setne %cl
cmpq %rax, %r12
setne %al
testb %al, %cl
jne 0x1ab8c
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x1aab5
cmpl $0x0, 0x30(%r14)
je 0x1aa87
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x1aa8b
movq %r12, 0xb8(%r14)
cltq
addq %r12, %rax
movq %rax, 0xc0(%r14)
jmp 0x1aaab
xorl %eax, %eax
jmp 0x1aac2
movl $0x0, 0x30(%r14)
movq %r12, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq %r12, %rsi
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
movzbl %al, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movl %ecx, -0x8(%r15)
leal -0x50(%rax), %ecx
cmpb $-0x40, %cl
jb 0x1abe0
andl $0xf, %eax
movl %eax, -0x4(%r15)
addl $-0x5, %eax
cmpl $-0x4, %eax
jb 0x1abe9
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x1ab5a
cmpl $0x0, 0x30(%r14)
je 0x1ab2c
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %rsi, %r12
callq *0x10(%r14)
testl %eax, %eax
je 0x1ab30
movq %r12, 0xb8(%r14)
cltq
addq %r12, %rax
movq %rax, 0xc0(%r14)
jmp 0x1ab50
xorl %eax, %eax
jmp 0x1ab67
movl $0x0, 0x30(%r14)
movq %r12, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq %r12, %rsi
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %al
movzbl %al, %eax
movl %eax, (%r15)
addq $0x60, %r15
movq %rbp, %r12
cmpb $0x3, %al
jbe 0x1a9a1
leaq 0x73f3(%rip), %r13      # 0x21f76
jmp 0x1ab8c
leaq 0x73b9(%rip), %r13      # 0x21f45
movq %r13, 0xd875(%rip)      # 0x28408
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 0x1ab96
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 0x1abf2
leaq 0x739f(%rip), %r13      # 0x21f7d
jmp 0x1ab8c
leaq 0x7383(%rip), %r13      # 0x21f6a
jmp 0x1ab8c
leaq 0x7380(%rip), %r13      # 0x21f70
jmp 0x1ab8c
movl $0x1, %r8d
movl $0x1, %edi
testl %ebp, %ebp
jle 0x1ac3c
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 0x1ac19
movl %r8d, 0x4588(%rbx)
movl %edi, 0x458c(%rbx)
leal (,%r8,8), %ecx
movl %ecx, 0x4598(%rbx)
leal (,%rdi,8), %esi
movl %esi, 0x459c(%rbx)
movq 0x10(%rsp), %rax
leal (%rax,%r8,8), %eax
decl %eax
xorl %edx, %edx
divl %ecx
movl %eax, 0x24(%rsp)
movl %eax, 0x4590(%rbx)
movq 0x38(%rsp), %rax
leal (%rax,%rdi,8), %eax
decl %eax
xorl %edx, %edx
divl %esi
movl %eax, 0x20(%rsp)
movl %eax, 0x4594(%rbx)
testl %ebp, %ebp
jle 0x1ab96
leaq 0x45a0(%rbx), %rax
movq %rax, 0x40(%rsp)
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 0x8430
movq %rax, -0x24(%r14)
testq %rax, %rax
je 0x1add5
addq $0xf, %rax
andq $-0x10, %rax
movq %rax, -0x2c(%r14)
movq $0x0, -0x14(%r14)
cmpl $0x0, 0x4730(%rbx)
je 0x1ad95
movl %r13d, -0x4(%r14)
movl %r12d, (%r14)
imull %r12d, %r13d
shll $0x6, %r13d
movslq %r13d, %rax
leaq 0xf(,%rax,2), %rdi
callq 0x8430
movq %rax, -0x1c(%r14)
addq $0xf, %rax
andq $-0x10, %rax
movl $0x50, %ecx
jmp 0x1ada4
movq $0x0, -0xc(%r14)
movl $0x40, %ecx
xorl %eax, %eax
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %r8
movq %rax, -0x5c(%r14,%rcx)
addq $0x60, %r14
movq 0x8(%rsp), %rcx
leaq (%rcx,%rbp), %rax
incq %rax
incq %rcx
cmpq $0x1, %rax
jne 0x1acd1
jmp 0x1ab96
leaq 0x71ab(%rip), %r13      # 0x21f87
movq 0x8(%rsp), %r15
cmpq $0x1, %r15
je 0x1ab8c
movq 0x40(%rsp), %r14
leal -0x2(%r15), %eax
leaq (%rax,%rax,2), %rbx
shlq $0x5, %rbx
movq 0x38(%r14,%rbx), %rdi
callq 0x83f0
movq $0x0, 0x30(%r14,%rbx)
decq %r15
cmpq $0x1, %r15
jg 0x1adf0
jmp 0x1ab8c