// File: /workspace/github_c_makefile_star2_O0/patriciogonzalezvivo[P]tprint/include/std/stb_image.h
// Function: stbi__gif_load_next(stbi__context*, stbi__gif*, int*, int)
static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp)
{
   int i;
   stbi_uc *old_out = 0;

   if (g->out == 0) {
      if (!stbi__gif_header(s, g, comp,0))     return 0; // stbi__g_failure_reason set by stbi__gif_header
      g->out = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
      if (g->out == 0)                      return stbi__errpuc("outofmem", "Out of memory");
      stbi__fill_gif_background(g);
   } else {
      // animated-gif-only path
      if (((g->eflags & 0x1C) >> 2) == 3) {
         old_out = g->out;
         g->out = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
         if (g->out == 0)                   return stbi__errpuc("outofmem", "Out of memory");
         memcpy(g->out, old_out, g->w*g->h*4);
      }
   }

   for (;;) {
      switch (stbi__get8(s)) {
         case 0x2C: /* Image Descriptor */
         {
            stbi__int32 x, y, w, h;
            stbi_uc *o;

            x = stbi__get16le(s);
            y = stbi__get16le(s);
            w = stbi__get16le(s);
            h = stbi__get16le(s);
            if (((x + w) > (g->w)) || ((y + h) > (g->h)))
               return stbi__errpuc("bad Image Descriptor", "Corrupt GIF");

            g->line_size = g->w * 4;
            g->start_x = x * 4;
            g->start_y = y * g->line_size;
            g->max_x   = g->start_x + w * 4;
            g->max_y   = g->start_y + h * g->line_size;
            g->cur_x   = g->start_x;
            g->cur_y   = g->start_y;

            g->lflags = stbi__get8(s);

            if (g->lflags & 0x40) {
               g->step = 8 * g->line_size; // first interlaced spacing
               g->parse = 3;
            } else {
               g->step = g->line_size;
               g->parse = 0;
            }

            if (g->lflags & 0x80) {
               stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1);
               g->color_table = (stbi_uc *) g->lpal;
            } else if (g->flags & 0x80) {
               for (i=0; i < 256; ++i)  // @OPTIMIZE: stbi__jpeg_reset only the previous transparent
                  g->pal[i][3] = 255;
               if (g->transparent >= 0 && (g->eflags & 0x01))
                  g->pal[g->transparent][3] = 0;
               g->color_table = (stbi_uc *) g->pal;
            } else
               return stbi__errpuc("missing color table", "Corrupt GIF");

            o = stbi__process_gif_raster(s, g);
            if (o == NULL) return NULL;

            if (req_comp && req_comp != 4)
               o = stbi__convert_format(o, 4, req_comp, g->w, g->h);
            return o;
         }

         case 0x21: // Comment Extension.
         {
            int len;
            if (stbi__get8(s) == 0xF9) { // Graphic Control Extension.
               len = stbi__get8(s);
               if (len == 4) {
                  g->eflags = stbi__get8(s);
                  stbi__get16le(s); // delay
                  g->transparent = stbi__get8(s);
               } else {
                  stbi__skip(s, len);
                  break;
               }
            }
            while ((len = stbi__get8(s)) != 0)
               stbi__skip(s, len);
            break;
         }

         case 0x3B: // gif stream termination code
            return (stbi_uc *) s; // using '1' causes warning on some compilers

         default:
            return stbi__errpuc("unknown code", "Corrupt GIF");
      }
   }
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movl %ecx, 0x54(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x28cec
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
xorl %ecx, %ecx
callq 0x29210
cmpl $0x0, %eax
jne 0x28c89
movq $0x0, 0x70(%rsp)
jmp 0x29202
movq 0x60(%rsp), %rax
movl (%rax), %eax
shll $0x2, %eax
movq 0x60(%rsp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdi
callq 0x1ac80
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x28cdd
leaq 0x4e80(%rip), %rdi      # 0x2db43
callq 0x1a190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
movq 0x60(%rsp), %rdi
callq 0x293e0
jmp 0x28d90
movq 0x60(%rsp), %rax
movl 0x20(%rax), %eax
andl $0x1c, %eax
sarl $0x2, %eax
cmpl $0x3, %eax
jne 0x28d8e
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rax
movl (%rax), %eax
shll $0x2, %eax
movq 0x60(%rsp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdi
callq 0x1ac80
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x28d65
leaq 0x4df8(%rip), %rdi      # 0x2db43
callq 0x1a190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x48(%rsp), %rsi
movq 0x60(%rsp), %rax
movl (%rax), %eax
movq 0x60(%rsp), %rcx
imull 0x4(%rcx), %eax
shll $0x2, %eax
movslq %eax, %rdx
callq 0xd330
jmp 0x28d90
jmp 0x28d92
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %ecx
movl %ecx, 0x28(%rsp)
subb $0x21, %al
je 0x29135
jmp 0x28dad
movl 0x28(%rsp), %eax
subl $0x2c, %eax
je 0x28dca
jmp 0x28db8
movl 0x28(%rsp), %eax
subl $0x3b, %eax
je 0x291d3
jmp 0x291df
movq 0x68(%rsp), %rdi
callq 0x28960
movl %eax, 0x44(%rsp)
movq 0x68(%rsp), %rdi
callq 0x28960
movl %eax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
callq 0x28960
movl %eax, 0x3c(%rsp)
movq 0x68(%rsp), %rdi
callq 0x28960
movl %eax, 0x38(%rsp)
movl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl (%rcx), %eax
jg 0x28e25
movl 0x40(%rsp), %eax
addl 0x38(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x28e46
leaq 0x5248(%rip), %rdi      # 0x2e074
callq 0x1a190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
movq 0x60(%rsp), %rax
movl (%rax), %ecx
shll $0x2, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4854(%rax)
movl 0x44(%rsp), %ecx
shll $0x2, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x483c(%rax)
movl 0x40(%rsp), %ecx
movq 0x60(%rsp), %rax
imull 0x4854(%rax), %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4840(%rax)
movq 0x60(%rsp), %rax
movl 0x483c(%rax), %ecx
movl 0x3c(%rsp), %eax
shll $0x2, %eax
addl %eax, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4844(%rax)
movq 0x60(%rsp), %rax
movl 0x4840(%rax), %ecx
movl 0x38(%rsp), %eax
movq 0x60(%rsp), %rdx
imull 0x4854(%rdx), %eax
addl %eax, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4848(%rax)
movq 0x60(%rsp), %rax
movl 0x483c(%rax), %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x484c(%rax)
movq 0x60(%rsp), %rax
movl 0x4840(%rax), %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4850(%rax)
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4838(%rax)
movq 0x60(%rsp), %rax
movl 0x4838(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x28f50
movq 0x60(%rsp), %rax
movl 0x4854(%rax), %ecx
shll $0x3, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4834(%rax)
movq 0x60(%rsp), %rax
movl $0x3, 0x4830(%rax)
jmp 0x28f75
movq 0x60(%rsp), %rax
movl 0x4854(%rax), %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x4834(%rax)
movq 0x60(%rsp), %rax
movl $0x0, 0x4830(%rax)
movq 0x60(%rsp), %rax
movl 0x4838(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x2901e
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rax
addq $0x424, %rax            # imm = 0x424
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
movl 0x4838(%rax), %ecx
andl $0x7, %ecx
movl $0x2, %eax
shll %cl, %eax
movl %eax, 0x24(%rsp)
movq 0x60(%rsp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x28fdf
movq 0x60(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0xc(%rsp)
jmp 0x28fea
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xc(%rsp)
jmp 0x28fea
movl 0x24(%rsp), %edx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %ecx
callq 0x29490
movq 0x60(%rsp), %rcx
addq $0x424, %rcx            # imm = 0x424
movq 0x60(%rsp), %rax
movq %rcx, 0x4828(%rax)
jmp 0x290c6
movq 0x60(%rsp), %rax
movl 0x10(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x290a3
movl $0x0, 0x50(%rsp)
cmpl $0x100, 0x50(%rsp)      # imm = 0x100
jge 0x2905e
movq 0x60(%rsp), %rax
movslq 0x50(%rsp), %rcx
movb $-0x1, 0x27(%rax,%rcx,4)
movl 0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50(%rsp)
jmp 0x29038
movq 0x60(%rsp), %rax
cmpl $0x0, 0x1c(%rax)
jl 0x2908c
movq 0x60(%rsp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2908c
movq 0x60(%rsp), %rax
movq 0x60(%rsp), %rcx
movslq 0x1c(%rcx), %rcx
movb $0x0, 0x27(%rax,%rcx,4)
movq 0x60(%rsp), %rcx
addq $0x24, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x4828(%rax)
jmp 0x290c4
leaq 0x4fdf(%rip), %rdi      # 0x2e089
callq 0x1a190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
jmp 0x290c6
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x29550
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x290f0
movq $0x0, 0x70(%rsp)
jmp 0x29202
cmpl $0x0, 0x54(%rsp)
je 0x29126
cmpl $0x4, 0x54(%rsp)
je 0x29126
movq 0x30(%rsp), %rdi
movl 0x54(%rsp), %edx
movq 0x60(%rsp), %rax
movl (%rax), %ecx
movq 0x60(%rsp), %rax
movl 0x4(%rax), %r8d
movl $0x4, %esi
callq 0x25b30
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %eax
cmpl $0xf9, %eax
jne 0x291a9
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %eax
movl %eax, 0x2c(%rsp)
cmpl $0x4, 0x2c(%rsp)
jne 0x29197
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0x68(%rsp), %rdi
callq 0x28960
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x291a7
movq 0x68(%rsp), %rdi
movl 0x2c(%rsp), %esi
callq 0x21ab0
jmp 0x291fd
jmp 0x291a9
jmp 0x291ab
movq 0x68(%rsp), %rdi
callq 0x21530
movzbl %al, %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, %eax
je 0x291d1
movq 0x68(%rsp), %rdi
movl 0x2c(%rsp), %esi
callq 0x21ab0
jmp 0x291ab
jmp 0x291fd
movq 0x68(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
leaq 0x4eb7(%rip), %rdi      # 0x2e09d
callq 0x1a190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, 0x70(%rsp)
jmp 0x29202
jmp 0x28d92
movq 0x70(%rsp), %rax
addq $0x78, %rsp
retq
nopl (%rax)