// File: /workspace/github_c_makefile_star2_O2/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__convert_format(unsigned char*, int, int, unsigned int, unsigned int)
static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)
{
   int i,j;
   unsigned char *good;

   if (req_comp == img_n) return data;
   STBI_ASSERT(req_comp >= 1 && req_comp <= 4);

   good = (unsigned char *) stbi__malloc_mad3(req_comp, x, y, 0);
   if (good == NULL) {
      STBI_FREE(data);
      return stbi__errpuc("outofmem", "Out of memory");
   }

   for (j=0; j < (int) y; ++j) {
      unsigned char *src  = data + j * x * img_n   ;
      unsigned char *dest = good + j * x * req_comp;

      #define STBI__COMBO(a,b)  ((a)*8+(b))
      #define STBI__CASE(a,b)   case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
      // convert source image with img_n components to one with req_comp components;
      // avoid switch per pixel, so use switch per scanline and massive macros
      switch (STBI__COMBO(img_n, req_comp)) {
         STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255;                                     } break;
         STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0];                                  } break;
         STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255;                     } break;
         STBI__CASE(2,1) { dest[0]=src[0];                                                  } break;
         STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0];                                  } break;
         STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1];                  } break;
         STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255;        } break;
         STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]);                   } break;
         STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255;    } break;
         STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]);                   } break;
         STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break;
         STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];                    } break;
         default: STBI_ASSERT(0);
      }
      #undef STBI__CASE
   }

   STBI_FREE(data);
   return good;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movq %rsi, 0x20(%rsp)
cmpl %esi, %edx
jne 0xc56e
movq %r14, %rax
jmp 0xc8ee
movl %edx, %r12d
leal -0x1(%r12), %eax
cmpl $0x4, %eax
jae 0xc91c
movl %r8d, %r13d
movl %ecx, %r8d
xorl %r15d, %r15d
movl %r12d, %edi
movl %ecx, %esi
movl %r13d, %edx
xorl %ecx, %ecx
movq %r8, %rbx
callq 0xb1e3
testq %rax, %rax
je 0xc8d6
testl %r13d, %r13d
cmovlel %r15d, %r13d
movq 0x20(%rsp), %rcx
leal (%r12,%rcx,8), %ebp
leal -0x1(%rbx), %edx
movl %edx, 0x4(%rsp)
movl %ebx, %edx
imull %ecx, %edx
movl %edx, 0xc(%rsp)
movq %rbx, %rcx
movq %rbx, 0x30(%rsp)
imull %r12d, %ecx
movl %ecx, 0x8(%rsp)
leaq 0x3(%rax), %rcx
movq %rcx, 0x28(%rsp)
movq %rax, 0x18(%rsp)
leaq 0x2(%rax), %rcx
movq %rcx, 0x10(%rsp)
addl $-0xa, %ebp
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq %r13, %r11
je 0xc8c7
cmpl $0x19, %ebp
ja 0xc8fd
movq %r13, %rbx
movl %r10d, %r9d
addq %r14, %r9
movl %r15d, %edx
movq 0x18(%rsp), %rax
leaq (%rax,%rdx), %rdi
movq 0x28(%rsp), %rcx
leaq (%rcx,%rdx), %rsi
movl %r11d, %ecx
imull 0x30(%rsp), %ecx
movl %ecx, %r8d
imull 0x20(%rsp), %r8d
addq %r14, %r8
imull %r12d, %ecx
addq %rax, %rcx
leaq 0x3bc7(%rip), %rax      # 0x1020c
movslq (%rax,%rbp,4), %r13
addq %rax, %r13
jmpq *%r13
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r9,%rcx), %sil
movb %sil, (%rdi,%rcx,2)
movb $-0x1, 0x1(%rdi,%rcx,2)
decl %edx
incq %rcx
jmp 0xc658
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r8), %sil
movb %sil, (%rcx)
movb 0x1(%r8), %sil
movb %sil, 0x1(%rcx)
movb 0x2(%r8), %sil
movb %sil, 0x2(%rcx)
addq $0x4, %r8
addq $0x3, %rcx
decl %edx
jmp 0xc67b
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movzbl (%r9,%rcx,4), %esi
movzbl 0x1(%r9,%rcx,4), %r8d
movzbl 0x2(%r9,%rcx,4), %ebx
imull $0x4d, %esi, %esi
imull $0x96, %r8d, %r8d
addl %esi, %r8d
imull $0x1d, %ebx, %ebx
addl %r8d, %ebx
movb %bh, (%rdi,%rcx)
decl %edx
incq %rcx
jmp 0xc6ae
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movzbl (%r9,%rcx,2), %esi
movzbl 0x1(%r9,%rcx,2), %r8d
movzbl 0x2(%r9,%rcx,2), %ebx
imull $0x4d, %esi, %esi
imull $0x96, %r8d, %r8d
addl %esi, %r8d
imull $0x1d, %ebx, %ebx
addl %r8d, %ebx
movb %bh, (%rdi,%rcx)
movb 0x3(%r9,%rcx,2), %sil
movb %sil, 0x1(%rdi,%rcx)
decl %edx
addq $0x2, %rcx
jmp 0xc6ed
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r8), %sil
movb %sil, (%rcx)
movb 0x1(%r8), %sil
movb %sil, 0x1(%rcx)
movb 0x2(%r8), %sil
movb %sil, 0x2(%rcx)
movb $-0x1, 0x3(%rcx)
addq $0x3, %r8
addq $0x4, %rcx
decl %edx
jmp 0xc735
addq 0x10(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq %rbx, %r13
testl %ecx, %ecx
js 0xc8b5
movb (%r8), %sil
movb %sil, (%rdx)
movb %sil, -0x1(%rdx)
movb %sil, -0x2(%rdx)
addq $0x2, %r8
decl %ecx
addq $0x3, %rdx
jmp 0xc76f
addq 0x10(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq %rbx, %r13
testl %ecx, %ecx
js 0xc8b5
movb (%r8), %sil
movb %sil, (%rdx)
movb %sil, -0x1(%rdx)
movb %sil, -0x2(%rdx)
incq %r8
decl %ecx
addq $0x3, %rdx
jmp 0xc79d
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r9,%rcx), %dil
movb %dil, -0x1(%rsi,%rcx,2)
movb %dil, -0x2(%rsi,%rcx,2)
movb %dil, -0x3(%rsi,%rcx,2)
movb 0x1(%r9,%rcx), %dil
movb %dil, (%rsi,%rcx,2)
decl %edx
addq $0x2, %rcx
jmp 0xc7c7
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r9,%rcx), %dil
movb %dil, -0x1(%rsi,%rcx,4)
movb %dil, -0x2(%rsi,%rcx,4)
movb %dil, -0x3(%rsi,%rcx,4)
movb $-0x1, (%rsi,%rcx,4)
decl %edx
incq %rcx
jmp 0xc7fc
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movzbl (%r8), %esi
movzbl 0x1(%r8), %edi
movzbl 0x2(%r8), %r9d
imull $0x4d, %esi, %esi
imull $0x96, %edi, %edi
addl %esi, %edi
imull $0x1d, %r9d, %ebx
addl %edi, %ebx
movb %bh, (%rcx)
movb $-0x1, 0x1(%rcx)
addq $0x3, %r8
addq $0x2, %rcx
decl %edx
jmp 0xc829
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movb (%r9,%rcx,2), %sil
movb %sil, (%rdi,%rcx)
decl %edx
incq %rcx
jmp 0xc86b
movl 0x4(%rsp), %edx
movq %rbx, %r13
testl %edx, %edx
js 0xc8b5
movzbl (%r8), %esi
movzbl 0x1(%r8), %edi
movzbl 0x2(%r8), %r9d
imull $0x4d, %esi, %esi
imull $0x96, %edi, %edi
addl %esi, %edi
imull $0x1d, %r9d, %ebx
addl %edi, %ebx
movb %bh, (%rcx)
addq $0x3, %r8
incq %rcx
decl %edx
jmp 0xc885
incq %r11
addl 0xc(%rsp), %r10d
addl 0x8(%rsp), %r15d
jmp 0xc5f3
movq %r14, %rdi
callq 0x21c0
movq 0x18(%rsp), %rax
jmp 0xc8ee
movq %r14, %rdi
callq 0x21c0
leaq 0x41f4(%rip), %rax      # 0x10ad9
movq %rax, 0x892c(%rip)      # 0x15218
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a69(%rip), %rdi      # 0x1136d
leaq 0x405b(%rip), %rsi      # 0x10966
leaq 0x462e(%rip), %rcx      # 0x10f40
movl $0x650, %edx            # imm = 0x650
callq 0x20f0
leaq 0x45fe(%rip), %rdi      # 0x10f21
leaq 0x403c(%rip), %rsi      # 0x10966
leaq 0x460f(%rip), %rcx      # 0x10f40
movl $0x633, %edx            # imm = 0x633
callq 0x20f0