// File: alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__out_gif_code(stbi__gif*, unsigned short)
static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
{
   stbi_uc *p, *c;
   int idx; 

   // recurse to decode the prefixes, since the linked-list is backwards,
   // and working backwards through an interleaved image would be nasty
   if (g->codes[code].prefix >= 0)
      stbi__out_gif_code(g, g->codes[code].prefix);

   if (g->cur_y >= g->max_y) return;

   idx = g->cur_x + g->cur_y; 
   p = &g->out[idx];
   g->history[idx / 4] = 1;  

   c = &g->color_table[g->codes[code].suffix * 4];
   if (c[3] > 128) { // don't render transparent pixels; 
      p[0] = c[2];
      p[1] = c[1];
      p[2] = c[0];
      p[3] = c[3];
   }
   g->cur_x += 4;

   if (g->cur_x >= g->max_x) {
      g->cur_x = g->start_x;
      g->cur_y += g->step;

      while (g->cur_y >= g->max_y && g->parse > 0) {
         g->step = (1 << g->parse) * g->line_size;
         g->cur_y = g->start_y + (g->step >> 1);
         --g->parse;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rax
movzwl -0xa(%rbp), %ecx
movswl 0x834(%rax,%rcx,4), %eax
cmpl $0x0, %eax
jl 0x6eb41
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movzwl -0xa(%rbp), %ecx
movzwl 0x834(%rax,%rcx,4), %esi
callq 0x6eb00
movq -0x8(%rbp), %rax
movl 0x8860(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8858(%rcx), %eax
jl 0x6eb5c
jmp 0x6ed0b
movq -0x8(%rbp), %rax
movl 0x885c(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x8860(%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x8838(%rax), %rax
movq -0x8(%rbp), %rcx
movzwl -0xa(%rbp), %edx
movzbl 0x837(%rcx,%rdx,4), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x80, %eax
jle 0x6ec17
movq -0x20(%rbp), %rax
movb 0x2(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x20(%rbp), %rax
movb 0x1(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x20(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x8(%rbp), %rax
movl 0x885c(%rax), %ecx
addl $0x4, %ecx
movl %ecx, 0x885c(%rax)
movq -0x8(%rbp), %rax
movl 0x885c(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8854(%rcx), %eax
jl 0x6ed0b
movq -0x8(%rbp), %rax
movl 0x884c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x885c(%rax)
movq -0x8(%rbp), %rax
movl 0x8844(%rax), %ecx
movq -0x8(%rbp), %rax
addl 0x8860(%rax), %ecx
movl %ecx, 0x8860(%rax)
movq -0x8(%rbp), %rax
movl 0x8860(%rax), %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpl 0x8858(%rdx), %ecx
movb %al, -0x31(%rbp)
jl 0x6ec9e
movq -0x8(%rbp), %rax
cmpl $0x0, 0x8840(%rax)
setg %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x6eca7
jmp 0x6ed09
movq -0x8(%rbp), %rax
movl 0x8840(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movq -0x8(%rbp), %rax
imull 0x8864(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8844(%rax)
movq -0x8(%rbp), %rax
movl 0x8850(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x8844(%rax), %eax
sarl %eax
addl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8860(%rax)
movq -0x8(%rbp), %rax
movl 0x8840(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8840(%rax)
jmp 0x6ec72
jmp 0x6ed0b
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)