// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rdi, %rbx
movq %rsi, 0x18(%rsp)
cmpl %esi, %edx
je 0x1222f
movl %edx, %r15d
leal -0x1(%r15), %eax
cmpl $0x4, %eax
jae 0x12241
movl %r8d, %ebp
movl %ecx, %r14d
movl %r15d, %edi
movl %ecx, %esi
movl %r8d, %edx
xorl %ecx, %ecx
callq 0xffc2
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x12217
movq %r15, 0x28(%rsp)
testl %ebp, %ebp
jle 0x12208
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
leal (%rcx,%rax,8), %r13d
cmpl $0x23, %r13d
ja 0x12260
movabsq $0xe161a1c00, %rax      # imm = 0xE161A1C00
btq %r13, %rax
jae 0x12260
leal -0x1(%r14), %eax
movl %eax, 0xc(%rsp)
movl %ebp, %eax
movq %rax, 0x40(%rsp)
movl %r14d, %esi
movl %r14d, %eax
imull %ecx, %eax
movl %eax, 0x24(%rsp)
movl %r14d, %eax
imull 0x18(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0x10(%rsp), %rax
leaq 0x3(%rax), %rcx
movq %rcx, 0x38(%rsp)
addq $0x2, %rax
movq %rax, 0x30(%rsp)
xorl %r11d, %r11d
addl $-0xa, %r13d
xorl %r10d, %r10d
xorl %r8d, %r8d
leaq 0x63b2(%rip), %r12      # 0x182dc
movl %r11d, %ebp
addq %rbx, %rbp
movl %r8d, %r15d
imull %r14d, %r15d
cmpl $0x18, %r13d
ja 0x121ba
movl %r10d, %edx
movq 0x10(%rsp), %rax
leaq (%rax,%rdx), %rcx
movq 0x38(%rsp), %rax
leaq (%rax,%rdx), %rdi
movl %r15d, %r9d
imull 0x18(%rsp), %r9d
addq %rbx, %r9
movslq (%r12,%r13,4), %rax
addq %r12, %rax
jmpq *%rax
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %eax, %eax
movb (%rbp,%rax), %dl
movb %dl, (%rcx,%rax,2)
movb $-0x1, 0x1(%rcx,%rax,2)
incq %rax
cmpl %eax, %esi
jne 0x11f78
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %edx, %edx
movzbl (%rbp,%rdx,4), %edi
movzbl 0x1(%rbp,%rdx,4), %r9d
movzbl 0x2(%rbp,%rdx,4), %eax
imull $0x4d, %edi, %edi
imull $0x96, %r9d, %r9d
addl %edi, %r9d
leal (%rax,%rax,8), %edi
leal (%rdi,%rdi,2), %edi
addl %eax, %eax
addl %edi, %eax
addl %r9d, %eax
movb %ah, (%rcx,%rdx,2)
movb 0x3(%rbp,%rdx,4), %al
movb %al, 0x1(%rcx,%rdx,2)
incq %rdx
cmpl %edx, %esi
jne 0x11f9d
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
addq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movb (%rbp,%rcx,2), %al
movb %al, (%rdx)
movb %al, -0x1(%rdx)
movb %al, -0x2(%rdx)
incq %rcx
addq $0x3, %rdx
cmpl %ecx, %esi
jne 0x11ff0
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %ecx, %ecx
movb (%rbp,%rcx,2), %al
movb %al, -0x1(%rdi,%rcx,4)
movb %al, -0x2(%rdi,%rcx,4)
movb %al, -0x3(%rdi,%rcx,4)
movb 0x1(%rbp,%rcx,2), %al
movb %al, (%rdi,%rcx,4)
incq %rcx
cmpl %ecx, %esi
jne 0x12019
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %eax, %eax
movb (%rbp,%rax,2), %dl
movb %dl, (%rcx,%rax)
incq %rax
cmpl %eax, %esi
jne 0x12049
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %eax, %eax
movb (%rbp,%rax), %cl
movb %cl, -0x1(%rdi,%rax,4)
movb %cl, -0x2(%rdi,%rax,4)
movb %cl, -0x3(%rdi,%rax,4)
movb $-0x1, (%rdi,%rax,4)
incq %rax
cmpl %eax, %esi
jne 0x12069
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
addq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movb (%rbp,%rcx), %al
movb %al, (%rdx)
movb %al, -0x1(%rdx)
movb %al, -0x2(%rdx)
incq %rcx
addq $0x3, %rdx
cmpl %ecx, %esi
jne 0x1209b
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %edx, %edx
movzbl (%r9), %edi
movzbl 0x1(%r9), %ebp
movzbl 0x2(%r9), %eax
imull $0x4d, %edi, %edi
imull $0x96, %ebp, %ebp
addl %edi, %ebp
leal (%rax,%rax,8), %edi
leal (%rdi,%rdi,2), %edi
addl %eax, %eax
addl %edi, %eax
addl %ebp, %eax
movb %ah, (%rcx,%rdx)
incq %rdx
addq $0x3, %r9
cmpl %edx, %esi
jne 0x120c4
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %edx, %edx
movzbl (%r9), %edi
movzbl 0x1(%r9), %ebp
movzbl 0x2(%r9), %eax
imull $0x4d, %edi, %edi
imull $0x96, %ebp, %ebp
addl %edi, %ebp
leal (%rax,%rax,8), %edi
leal (%rdi,%rdi,2), %edi
addl %eax, %eax
addl %edi, %eax
addl %ebp, %eax
movb %ah, (%rcx,%rdx,2)
movb $-0x1, 0x1(%rcx,%rdx,2)
incq %rdx
addq $0x3, %r9
cmpl %edx, %esi
jne 0x12109
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %edx, %edx
movzbl (%rbp,%rdx,4), %edi
movzbl 0x1(%rbp,%rdx,4), %r9d
movzbl 0x2(%rbp,%rdx,4), %eax
imull $0x4d, %edi, %edi
imull $0x96, %r9d, %r9d
addl %edi, %r9d
leal (%rax,%rax,8), %edi
leal (%rdi,%rdi,2), %edi
addl %eax, %eax
addl %edi, %eax
addl %r9d, %eax
movb %ah, (%rcx,%rdx)
incq %rdx
cmpl %edx, %esi
jne 0x12153
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
xorl %edx, %edx
movb (%r9), %al
movb %al, (%rcx,%rdx,4)
movb 0x1(%r9), %al
movb %al, 0x1(%rcx,%rdx,4)
movb 0x2(%r9), %al
movb %al, 0x2(%rcx,%rdx,4)
movb $-0x1, 0x3(%rcx,%rdx,4)
incq %rdx
addq $0x3, %r9
cmpl %edx, %esi
jne 0x12192
jmp 0x121f0
cmpl $0x0, 0xc(%rsp)
js 0x121f0
imull 0x28(%rsp), %r15d
addq 0x10(%rsp), %r15
xorl %ecx, %ecx
movb (%rbp,%rcx,4), %al
movb %al, (%r15)
movb 0x1(%rbp,%rcx,4), %al
movb %al, 0x1(%r15)
movb 0x2(%rbp,%rcx,4), %al
movb %al, 0x2(%r15)
incq %rcx
addq $0x3, %r15
cmpl %ecx, %esi
jne 0x121ce
incq %r8
addl 0x24(%rsp), %r10d
addl 0x20(%rsp), %r11d
cmpq 0x40(%rsp), %r8
jne 0x11f2a
movq %rbx, %rdi
callq 0x21d0
movq 0x10(%rsp), %rbx
jmp 0x1222f
movq %rbx, %rdi
callq 0x21d0
leaq 0x6983(%rip), %rax      # 0x18ba9
movq %rax, 0xafcb(%rip)      # 0x1d1f8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6da9(%rip), %rdi      # 0x18ff1
leaq 0x67e7(%rip), %rsi      # 0x18a36
leaq 0x6dba(%rip), %rcx      # 0x19010
movl $0x633, %edx            # imm = 0x633
callq 0x20f0
leaq 0x71d6(%rip), %rdi      # 0x1943d
leaq 0x67c8(%rip), %rsi      # 0x18a36
leaq 0x6d9b(%rip), %rcx      # 0x19010
movl $0x650, %edx            # imm = 0x650
callq 0x20f0