// File: /workspace/github_c_makefile_star2_O0/patriciogonzalezvivo[P]tprint/include/std/stb_image.h
// Function: stbi__expand_png_palette(stbi__png*, unsigned char*, int, int)
static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n)
{
   stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y;
   stbi_uc *p, *temp_out, *orig = a->out;

   p = (stbi_uc *) stbi__malloc(pixel_count * pal_img_n);
   if (p == NULL) return stbi__err("outofmem", "Out of memory");

   // between here and free(out) below, exitting would leak
   temp_out = p;

   if (pal_img_n == 3) {
      for (i=0; i < pixel_count; ++i) {
         int n = orig[i]*4;
         p[0] = palette[n  ];
         p[1] = palette[n+1];
         p[2] = palette[n+2];
         p += 3;
      }
   } else {
      for (i=0; i < pixel_count; ++i) {
         int n = orig[i]*4;
         p[0] = palette[n  ];
         p[1] = palette[n+1];
         p[2] = palette[n+2];
         p[3] = palette[n+3];
         p += 4;
      }
   }
   STBI_FREE(a->out);
   a->out = temp_out;

   STBI_NOTUSED(len);

   return 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movl %edx, 0x2c(%rsp)
movl %ecx, 0x28(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq 0x38(%rsp), %rcx
movq (%rcx), %rcx
imull 0x4(%rcx), %eax
movl %eax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x20(%rsp), %eax
imull 0x28(%rsp), %eax
movl %eax, %eax
movl %eax, %edi
callq 0x1ac80
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x26bb2
leaq 0x6f9f(%rip), %rdi      # 0x2db43
callq 0x1a190
movl %eax, 0x44(%rsp)
jmp 0x26d23
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpl $0x3, 0x28(%rsp)
jne 0x26c58
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x20(%rsp), %eax
jae 0x26c53
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
movzbl (%rax,%rcx), %eax
shll $0x2, %eax
movl %eax, 0x4(%rsp)
movq 0x30(%rsp), %rax
movslq 0x4(%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, (%rax)
movq 0x30(%rsp), %rax
movl 0x4(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x1(%rax)
movq 0x30(%rsp), %rax
movl 0x4(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x2(%rax)
movq 0x18(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x18(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x26bcf
jmp 0x26cff
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x20(%rsp), %eax
jae 0x26cfd
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
movzbl (%rax,%rcx), %eax
shll $0x2, %eax
movl %eax, (%rsp)
movq 0x30(%rsp), %rax
movslq (%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, (%rax)
movq 0x30(%rsp), %rax
movl (%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x1(%rax)
movq 0x30(%rsp), %rax
movl (%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x2(%rax)
movq 0x30(%rsp), %rax
movl (%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x3(%rax)
movq 0x18(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x18(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x26c60
jmp 0x26cff
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0xd4e0
movq 0x10(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)