// File: /workspace/github_c_makefile_star2_O3/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__create_png_image_raw
static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y)
{
   stbi__context *s = a->s;
   stbi__uint32 i,j,stride = x*out_n;
   int k;
   int img_n = s->img_n; // copy it into a local for later
   STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1);
   a->out = (stbi_uc *) stbi__malloc(x * y * out_n);
   if (!a->out) return stbi__err("outofmem", "Out of memory");
   if (s->img_x == x && s->img_y == y) {
      if (raw_len != (img_n * x + 1) * y) return stbi__err("not enough pixels","Corrupt PNG");
   } else { // interlaced:
      if (raw_len < (img_n * x + 1) * y) return stbi__err("not enough pixels","Corrupt PNG");
   }
   for (j=0; j < y; ++j) {
      stbi_uc *cur = a->out + stride*j;
      stbi_uc *prior = cur - stride;
      int filter = *raw++;
      if (filter > 4) return stbi__err("invalid filter","Corrupt PNG");
      // if first row, use special filter that doesn't sample previous row
      if (j == 0) filter = first_row_filter[filter];
      // handle first pixel explicitly
      for (k=0; k < img_n; ++k) {
         switch (filter) {
            case STBI__F_none       : cur[k] = raw[k]; break;
            case STBI__F_sub        : cur[k] = raw[k]; break;
            case STBI__F_up         : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            case STBI__F_avg        : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break;
            case STBI__F_paeth      : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break;
            case STBI__F_avg_first  : cur[k] = raw[k]; break;
            case STBI__F_paeth_first: cur[k] = raw[k]; break;
         }
      }
      if (img_n != out_n) cur[img_n] = 255;
      raw += img_n;
      cur += out_n;
      prior += out_n;
      // this is a little gross, so that we don't switch per-pixel or per-component
      if (img_n == out_n) {
         #define CASE(f) \
             case f:     \
                for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \
                   for (k=0; k < img_n; ++k)
         switch (filter) {
            CASE(STBI__F_none)         cur[k] = raw[k]; break;
            CASE(STBI__F_sub)          cur[k] = STBI__BYTECAST(raw[k] + cur[k-img_n]); break;
            CASE(STBI__F_up)           cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            CASE(STBI__F_avg)          cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-img_n])>>1)); break;
            CASE(STBI__F_paeth)        cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;
            CASE(STBI__F_avg_first)    cur[k] = STBI__BYTECAST(raw[k] + (cur[k-img_n] >> 1)); break;
            CASE(STBI__F_paeth_first)  cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-img_n],0,0)); break;
         }
         #undef CASE
      } else {
         STBI_ASSERT(img_n+1 == out_n);
         #define CASE(f) \
             case f:     \
                for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
                   for (k=0; k < img_n; ++k)
         switch (filter) {
            CASE(STBI__F_none)         cur[k] = raw[k]; break;
            CASE(STBI__F_sub)          cur[k] = STBI__BYTECAST(raw[k] + cur[k-out_n]); break;
            CASE(STBI__F_up)           cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            CASE(STBI__F_avg)          cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-out_n])>>1)); break;
            CASE(STBI__F_paeth)        cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
            CASE(STBI__F_avg_first)    cur[k] = STBI__BYTECAST(raw[k] + (cur[k-out_n] >> 1)); break;
            CASE(STBI__F_paeth_first)  cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],0,0)); break;
         }
         #undef CASE
      }
   }
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r13d
movq (%rdi), %rbx
movl 0x8(%rbx), %edx
cmpl %ecx, %edx
sete %al
movq %rdx, 0x20(%rsp)
incl %edx
movl %edx, 0x38(%rsp)
cmpl %ecx, %edx
sete %dl
orb %al, %dl
je 0x412c19
movl %r9d, %r12d
movl %r8d, %ebp
movq %rsi, %r14
movq %rdi, %r15
movl %r8d, %eax
movl %ecx, 0xc(%rsp)
imull %ecx, %eax
movl %eax, 0x10(%rsp)
movl %eax, %edi
imull %r9d, %edi
callq 0x4458c0
movq %rax, 0x18(%r15)
testq %rax, %rax
je 0x412bd2
movl 0x20(%rsp), %ecx
cmpl %ebp, (%rbx)
movl %ebp, %edi
jne 0x4125c8
cmpl %r12d, 0x4(%rbx)
jne 0x4125c8
movl %ecx, %eax
imull %edi, %eax
incl %eax
imull %r12d, %eax
cmpl %r13d, %eax
movl 0xc(%rsp), %edx
je 0x4125df
leaq 0xc66a4(%rip), %rax     # 0x4d8c67
jmp 0x412be2
movq 0x20(%rsp), %rax
imull %edi, %eax
incl %eax
imull %r12d, %eax
cmpl %r13d, %eax
movl 0xc(%rsp), %edx
ja 0x4125bc
movl $0x1, %eax
testl %r12d, %r12d
je 0x412beb
movq 0x20(%rsp), %r13
movslq %r13d, %rax
movl 0x10(%rsp), %esi
movslq %edx, %rbx
decl %edi
movl %r12d, %r8d
movq %r8, 0x58(%rsp)
movq %rax, %r12
movl %edx, %r10d
movq %rbx, %rdx
subq %rax, %rdx
movq %rdx, 0x18(%rsp)
subq %rsi, %rdx
movq %rdx, 0x50(%rsp)
negq %rsi
movq %rsi, 0x28(%rsp)
xorl %eax, %eax
leaq 0xc5ec4(%rip), %r11     # 0x4d84f4
xorl %r8d, %r8d
movl %edi, 0x3c(%rsp)
movq %r12, 0x40(%rsp)
movq %r15, 0x60(%rsp)
movq %rbx, 0x30(%rsp)
movzbl (%r14), %esi
cmpq $0x4, %rsi
ja 0x412bdb
testq %r8, %r8
jne 0x412664
leaq 0xc601c(%rip), %rdx     # 0x4d867c
movb (%rsi,%rdx), %sil
movq %r8, 0x48(%rsp)
movl %eax, %eax
movq %rax, (%rsp)
movq 0x18(%r15), %r9
incq %r14
movzbl %sil, %ebp
testl %r13d, %r13d
jle 0x4126c3
movq (%rsp), %rax
addq %r9, %rax
movq 0x28(%rsp), %rdx
leaq (%rax,%rdx), %r8
xorl %ebx, %ebx
cmpb $0x6, %sil
ja 0x4126bb
movslq (%r11,%rbp,4), %rdx
addq %r11, %rdx
jmpq *%rdx
movb (%r14,%rbx), %r15b
jmp 0x4126b7
movb (%r8,%rbx), %r15b
jmp 0x4126b3
movb (%r8,%rbx), %r15b
shrb %r15b
addb (%r14,%rbx), %r15b
movb %r15b, (%rax,%rbx)
incq %rbx
cmpq %rbx, %rcx
jne 0x412691
movl 0x10(%rsp), %eax
movl %eax, %r8d
imull 0x48(%rsp), %r8d
addq %r9, %r8
movq 0x28(%rsp), %rax
addq %r8, %rax
movl 0xc(%rsp), %edx
cmpl %edx, %ecx
jne 0x41273b
addq %r12, %r14
cmpb $0x6, %sil
movq 0x30(%rsp), %rbx
ja 0x412ba7
addq %rbx, %r8
addq %rbx, %rax
leaq 0xc5e2a(%rip), %rsi     # 0x4d852c
movslq (%rsi,%rbp,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testl %edi, %edi
je 0x412ba7
movl %edi, %eax
testl %r13d, %r13d
jle 0x41272c
xorl %edx, %edx
movb (%r14,%rdx), %sil
movb %sil, (%r8,%rdx)
incq %rdx
cmpq %rdx, %r10
jne 0x41271c
addq %r12, %r14
addq %r12, %r8
decl %eax
jne 0x412715
jmp 0x412ba7
movb $-0x1, (%r8,%r12)
cmpl %edx, 0x38(%rsp)
movq 0x30(%rsp), %rbx
jne 0x412bfa
addq %r12, %r14
cmpb $0x6, %sil
ja 0x412ba7
addq %rbx, %rax
addq %rbx, %r8
leaq 0xc5da7(%rip), %rsi     # 0x4d8510
movslq (%rsi,%rbp,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testl %edi, %edi
je 0x412ba7
movl %edi, %eax
testl %ecx, %ecx
jle 0x412792
xorl %edx, %edx
movb (%r14,%rdx), %sil
movb %sil, (%r8,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x412782
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
decl %eax
jne 0x41277c
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
movq 0x18(%rsp), %rdx
leaq (%r9,%rdx), %rsi
movq (%rsp), %rdx
addq %rdx, %rsi
addq 0x50(%rsp), %r9
addq %rdx, %r9
movl %edi, 0x14(%rsp)
testl %ecx, %ecx
jle 0x412830
xorl %ebx, %ebx
movzbl (%rsi,%rbx), %r15d
movzbl (%rax,%rbx), %r11d
movzbl (%r9,%rbx), %r13d
leal (%r11,%r15), %edx
subl %r13d, %edx
movl %edx, %edi
subl %r15d, %edi
movl %edi, %r12d
negl %r12d
cmovsl %edi, %r12d
movl %edx, %ebp
subl %r11d, %ebp
movl %ebp, %edi
negl %edi
cmovsl %ebp, %edi
subl %r13d, %edx
movl %edx, %ebp
negl %ebp
cmovsl %edx, %ebp
cmpl %ebp, %edi
ja 0x412812
movl %r11d, %r13d
cmpl %ebp, %r12d
cmoval %r13d, %r15d
cmpl %edi, %r12d
cmoval %r13d, %r15d
addb (%r14,%rbx), %r15b
movb %r15b, (%r8,%rbx)
incq %rbx
cmpq %rbx, %r10
jne 0x4127d0
movq 0x40(%rsp), %r12
addq %r12, %r14
addq %r12, %r8
addq %r12, %rax
addq %r12, %rsi
addq %r12, %r9
movl 0x14(%rsp), %edi
decl %edi
movq 0x20(%rsp), %r13
leaq 0xc5c9e(%rip), %r11     # 0x4d84f4
jne 0x4127c6
jmp 0x412ba7
movl %edi, %esi
testl %edi, %edi
je 0x412ba7
testl %ecx, %ecx
jle 0x412884
xorl %edi, %edi
movb (%rax,%rdi), %dl
addb (%r14,%rdi), %dl
movb %dl, (%r8,%rdi)
incq %rdi
cmpq %rdi, %r10
jne 0x412871
addq %r12, %r14
addq %r12, %r8
addq %r12, %rax
decl %esi
jne 0x41286b
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq 0x18(%rsp), %r9
addq (%rsp), %r9
movl %edi, %esi
testl %r13d, %r13d
jle 0x4128cf
xorl %edi, %edi
movzbl (%rax,%rdi), %edx
movzbl (%r9,%rdi), %r11d
addl %edx, %r11d
shrl %r11d
addb (%r14,%rdi), %r11b
movb %r11b, (%r8,%rdi)
incq %rdi
cmpq %rdi, %r10
jne 0x4128b0
addq %r12, %r14
addq %r12, %r8
addq %r12, %rax
addq %r12, %r9
decl %esi
leaq 0xc5c10(%rip), %r11     # 0x4d84f4
jne 0x4128a9
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq 0x18(%rsp), %r9
addq (%rsp), %r9
movl %edi, %eax
testl %ecx, %ecx
jle 0x412918
xorl %esi, %esi
movb (%r9,%rsi), %dl
addb (%r14,%rsi), %dl
movb %dl, (%r8,%rsi)
incq %rsi
cmpq %rsi, %r10
jne 0x412904
addq %r12, %r14
addq %r12, %r8
addq %r12, %r9
decl %eax
jne 0x4128fe
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq 0x18(%rsp), %r9
addq (%rsp), %r9
movl %edi, %eax
testl %ecx, %ecx
jle 0x412959
xorl %esi, %esi
movb (%r9,%rsi), %dl
shrb %dl
addb (%r14,%rsi), %dl
movb %dl, (%r8,%rsi)
incq %rsi
cmpq %rsi, %r10
jne 0x412943
addq %r12, %r14
addq %r12, %r8
addq %r12, %r9
decl %eax
jne 0x41293d
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq 0x18(%rsp), %r9
addq (%rsp), %r9
movl %edi, %eax
testl %r13d, %r13d
jle 0x412999
xorl %esi, %esi
movb (%r9,%rsi), %dl
addb (%r14,%rsi), %dl
movb %dl, (%r8,%rsi)
incq %rsi
cmpq %rsi, %r10
jne 0x412985
addq %r12, %r14
addq %r12, %r8
addq %r12, %r9
decl %eax
jne 0x41297e
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq (%rsp), %r9
movq 0x28(%rsp), %rdx
leaq (%r9,%rdx), %rsi
movl %edi, 0x14(%rsp)
testl %ecx, %ecx
jle 0x412a2a
xorl %ebx, %ebx
movzbl (%r9,%rbx), %r15d
movzbl (%rax,%rbx), %r11d
movzbl (%rsi,%rbx), %r13d
leal (%r11,%r15), %edx
subl %r13d, %edx
movl %edx, %edi
subl %r15d, %edi
movl %edi, %r12d
negl %r12d
cmovsl %edi, %r12d
movl %edx, %ebp
subl %r11d, %ebp
movl %ebp, %edi
negl %edi
cmovsl %ebp, %edi
subl %r13d, %edx
movl %edx, %ebp
negl %ebp
cmovsl %edx, %ebp
cmpl %ebp, %edi
ja 0x412a0c
movl %r11d, %r13d
cmpl %ebp, %r12d
cmoval %r13d, %r15d
cmpl %edi, %r12d
cmoval %r13d, %r15d
addb (%r14,%rbx), %r15b
movb %r15b, (%r8,%rbx)
incq %rbx
cmpq %rbx, %rcx
jne 0x4129ca
movq 0x40(%rsp), %r12
movb $-0x1, (%r8,%r12)
addq %r12, %r14
movq 0x30(%rsp), %rbx
addq %rbx, %r8
addq %rbx, %rax
addq %rbx, %r9
addq %rbx, %rsi
movl 0x14(%rsp), %edi
decl %edi
movq 0x20(%rsp), %r13
leaq 0xc5a9a(%rip), %r11     # 0x4d84f4
jne 0x4129c0
jmp 0x412ba7
movl %edi, %eax
testl %edi, %edi
je 0x412ba7
testl %r13d, %r13d
jle 0x412a92
movq 0x28(%rsp), %rdx
leaq (%r8,%rdx), %rsi
xorl %edi, %edi
movb (%rsi,%rdi), %dl
addb (%r14,%rdi), %dl
movb %dl, (%r8,%rdi)
incq %rdi
cmpq %rdi, %rcx
jne 0x412a7f
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
decl %eax
jne 0x412a6f
jmp 0x412ba7
movl %edi, %esi
testl %edi, %edi
je 0x412ba7
testl %ecx, %ecx
jle 0x412adb
xorl %r9d, %r9d
movzbl (%rax,%r9), %edx
movq %r9, %rdi
subq %rbx, %rdi
movzbl (%r8,%rdi), %edi
addl %edx, %edi
shrl %edi
addb (%r14,%r9), %dil
movb %dil, (%r8,%r9)
incq %r9
cmpq %rcx, %r9
jne 0x412ab7
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
addq %rbx, %rax
decl %esi
jne 0x412ab0
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq (%rsp), %r9
movl %edi, %eax
testl %ecx, %ecx
jle 0x412b1d
leaq (%r9,%rbx), %rsi
xorl %edi, %edi
movb (%r9,%rdi), %dl
addb (%r14,%rdi), %dl
movb %dl, (%rsi,%rdi)
incq %rdi
cmpq %rdi, %rcx
jne 0x412b0a
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
addq %rbx, %r9
decl %eax
jne 0x412b00
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq (%rsp), %r9
movl %edi, %eax
testl %ecx, %ecx
jle 0x412b5a
leaq (%r9,%rbx), %rsi
xorl %edi, %edi
movb (%r9,%rdi), %dl
shrb %dl
addb (%r14,%rdi), %dl
movb %dl, (%rsi,%rdi)
incq %rdi
cmpq %rdi, %rcx
jne 0x412b45
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
addq %rbx, %r9
decl %eax
jne 0x412b3b
jmp 0x412ba7
testl %edi, %edi
je 0x412ba7
addq (%rsp), %r9
movl %edi, %eax
testl %ecx, %ecx
jle 0x412b95
leaq (%r9,%rbx), %rsi
xorl %edi, %edi
movb (%r9,%rdi), %dl
addb (%r14,%rdi), %dl
movb %dl, (%rsi,%rdi)
incq %rdi
cmpq %rdi, %rcx
jne 0x412b82
movb $-0x1, (%r8,%r12)
addq %r12, %r14
addq %rbx, %r8
addq %rbx, %r9
decl %eax
jne 0x412b78
movq 0x48(%rsp), %r8
incq %r8
movq (%rsp), %rax
addl 0x10(%rsp), %eax
cmpq 0x58(%rsp), %r8
movl 0x3c(%rsp), %edi
movq 0x60(%rsp), %r15
jne 0x412646
movl $0x1, %eax
jmp 0x412beb
leaq 0xc5df6(%rip), %rax     # 0x4d89cf
jmp 0x412be2
leaq 0xc6097(%rip), %rax     # 0x4d8c79
movq %rax, 0x109937(%rip)    # 0x51c520
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc6087(%rip), %rdi     # 0x4d8c88
leaq 0xc5e96(%rip), %rsi     # 0x4d8a9e
leaq 0xc5ff2(%rip), %rcx     # 0x4d8c01
movl $0x89b, %edx            # imm = 0x89B
callq 0x4209d0
leaq 0xc5fb8(%rip), %rdi     # 0x4d8bd8
leaq 0xc5e77(%rip), %rsi     # 0x4d8a9e
leaq 0xc5fd3(%rip), %rcx     # 0x4d8c01
movl $0x86b, %edx            # imm = 0x86B
callq 0x4209d0