// File: /workspace/github_c_makefile_star2_O2/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 $0x98, %rsp
movl %edx, %r13d
movq (%rdi), %rbx
movl 0x8(%rbx), %edx
cmpl %ecx, %edx
sete %al
movq %rdx, 0x40(%rsp)
incl %edx
movl %edx, 0x64(%rsp)
cmpl %ecx, %edx
sete %dl
orb %al, %dl
je 0x40ff0e
movl %r9d, %r12d
movl %r8d, %ebp
movq %rsi, %r14
movq %rdi, %r15
movl %r8d, %edi
movl %ecx, 0x2c(%rsp)
imull %ecx, %edi
movq %rdi, 0x48(%rsp)
imull %r9d, %edi
callq 0x442160
movq %rax, 0x18(%r15)
testq %rax, %rax
je 0x40febf
cmpl %ebp, (%rbx)
jne 0x40f91e
cmpl %r12d, 0x4(%rbx)
jne 0x40f91e
movq 0x40(%rsp), %rcx
movl %ecx, %eax
imull %ebp, %eax
incl %eax
imull %r12d, %eax
cmpl %r13d, %eax
movq %r14, %r10
je 0x40f936
leaq 0xc51be(%rip), %rax     # 0x4d4ad7
jmp 0x40fed4
movq 0x40(%rsp), %rcx
movl %ecx, %eax
imull %ebp, %eax
incl %eax
imull %r12d, %eax
cmpl %r13d, %eax
movq %r14, %r10
ja 0x40f912
movq %r15, 0x78(%rsp)
movl %ebp, 0x4(%rsp)
movslq %ecx, %rdi
movq %rcx, %rdx
movl 0x48(%rsp), %ecx
movq %rcx, %rax
negq %rax
movq %rax, 0x58(%rsp)
movslq 0x2c(%rsp), %r8
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %r15d
cmovgl %edx, %r15d
movl %r12d, %edx
movq %rdx, 0x80(%rsp)
movq %r8, %rsi
subq %rdi, %rsi
movq %rsi, 0x18(%rsp)
subq %rcx, %rsi
movq %rsi, 0x70(%rsp)
xorl %r9d, %r9d
movq %r15, 0x68(%rsp)
movq %rdi, 0x38(%rsp)
movq %r8, 0x50(%rsp)
cmpq 0x80(%rsp), %r9
je 0x40fec8
movzbl (%r10), %edx
cmpq $0x4, %rdx
ja 0x40fecd
testq %r9, %r9
jne 0x40f9c2
leaq 0xc4b2d(%rip), %rcx     # 0x4d44ec
movb (%rdx,%rcx), %dl
movl %eax, %ecx
movq 0x78(%rsp), %rax
movq 0x18(%rax), %r12
movq 0x48(%rsp), %rbx
movq %r9, 0x30(%rsp)
imull %r9d, %ebx
addq %r12, %rbx
movq 0x58(%rsp), %rax
leaq (%rbx,%rax), %rbp
incq %r10
movq %rcx, 0x8(%rsp)
leaq (%r12,%rcx), %rsi
leaq (%rsi,%rax), %rdi
xorl %r13d, %r13d
leaq 0xc4967(%rip), %rcx     # 0x4d4368
movq %rsi, 0x20(%rsp)
movq %rdx, 0x90(%rsp)
movq %rdi, 0x88(%rsp)
movzbl %dl, %eax
cmpq %r13, %r15
je 0x40fa89
cmpb $0x6, %dl
ja 0x40fa84
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb (%r10,%r13), %al
jmp 0x40fa80
movb (%r10,%r13), %al
movb %al, 0x10(%rsp)
movzbl (%rdi,%r13), %esi
xorl %edi, %edi
xorl %edx, %edx
movq %r10, %r14
callq 0x40ff2d
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rdx
movq 0x20(%rsp), %rsi
movq %r14, %r10
leaq 0xc48fe(%rip), %rcx     # 0x4d4368
addb 0x10(%rsp), %al
jmp 0x40fa80
movb (%rdi,%r13), %al
jmp 0x40fa7c
movb (%rdi,%r13), %al
shrb %al
addb (%r10,%r13), %al
movb %al, (%rsi,%r13)
incq %r13
jmp 0x40fa16
movl 0x2c(%rsp), %ecx
cmpl %ecx, 0x40(%rsp)
jne 0x40faeb
movq 0x38(%rsp), %rdi
addq %rdi, %r10
cmpb $0x6, %dl
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %r9
ja 0x40fd95
addq %r8, %rbx
addq %r8, %rbp
leaq 0xc48e5(%rip), %rcx     # 0x4d43a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fae3
movb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fad2
addq %rdi, %r10
addq %rdi, %rbx
jmp 0x40fac8
movq 0x38(%rsp), %rdi
movb $-0x1, (%rbx,%rdi)
cmpl %ecx, 0x64(%rsp)
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %r9
jne 0x40feef
addq %rdi, %r10
cmpb $0x6, %dl
ja 0x40fd95
addq %r8, %rbp
addq %r8, %rbx
leaq 0xc4863(%rip), %rcx     # 0x4d4384
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fb49
movb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fb38
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
jmp 0x40fb2e
movq 0x18(%rsp), %rax
leaq (%r12,%rax), %rcx
movq 0x8(%rsp), %rax
addq %rax, %rcx
movq %rcx, 0x10(%rsp)
addq 0x70(%rsp), %r12
addq %rax, %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd90
movl %eax, 0x20(%rsp)
movq %r12, %r14
movq %rbp, %r12
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x40fbc5
movb (%r10,%r13), %bpl
movq 0x10(%rsp), %rax
movzbl (%rax,%r13), %edi
movzbl (%r12,%r13), %esi
movzbl (%r14,%r13), %edx
movq %r10, %r15
callq 0x40ff2d
movq %r15, %r10
movq 0x68(%rsp), %r15
addb %bpl, %al
movb %al, (%rbx,%r13)
incq %r13
jmp 0x40fb8c
movq 0x38(%rsp), %rdi
addq %rdi, %r10
addq %rdi, %rbx
movq %r12, %rbp
addq %rdi, %rbp
addq %rdi, 0x10(%rsp)
movq %r14, %r12
addq %rdi, %r12
movl 0x20(%rsp), %eax
jmp 0x40fb77
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fc0a
movb (%rbp,%rcx), %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fbf5
addq %rdi, %r10
addq %rdi, %rbx
addq %rdi, %rbp
jmp 0x40fbeb
addq 0x18(%rsp), %r12
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fc4d
movzbl (%rbp,%rcx), %edx
movzbl (%r12,%rcx), %esi
addl %edx, %esi
shrl %esi
addb (%r10,%rcx), %sil
movb %sil, (%rbx,%rcx)
incq %rcx
jmp 0x40fc2d
addq %rdi, %r10
addq %rdi, %rbx
addq %rdi, %rbp
addq %rdi, %r12
jmp 0x40fc23
addq 0x18(%rsp), %r12
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fc88
movb (%r12,%rcx), %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fc73
addq %rdi, %r10
addq %rdi, %rbx
addq %rdi, %r12
jmp 0x40fc69
addq 0x18(%rsp), %r12
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fcc2
movb (%r12,%rcx), %dl
shrb %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fcab
addq %rdi, %r10
addq %rdi, %rbx
addq %rdi, %r12
jmp 0x40fca1
addq 0x18(%rsp), %r12
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fcfa
movb (%r12,%rcx), %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fce5
addq %rdi, %r10
addq %rdi, %rbx
addq %rdi, %r12
jmp 0x40fcdb
addq 0x8(%rsp), %r12
movq 0x58(%rsp), %rax
addq %r12, %rax
movq %rax, 0x10(%rsp)
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd90
movl %eax, 0x20(%rsp)
movq %r12, %r14
movq %rbp, %r12
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x40fd65
movb (%r10,%r13), %bpl
movzbl (%r14,%r13), %edi
movzbl (%r12,%r13), %esi
movq 0x10(%rsp), %rax
movzbl (%rax,%r13), %edx
movq %r10, %r15
callq 0x40ff2d
movq %r15, %r10
movq 0x68(%rsp), %r15
addb %bpl, %al
movb %al, (%rbx,%r13)
incq %r13
jmp 0x40fd2c
movq 0x38(%rsp), %rdi
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
movq 0x50(%rsp), %r8
addq %r8, %rbx
movq %r12, %rbp
addq %r8, %rbp
movq %r14, %r12
addq %r8, %r12
addq %r8, 0x10(%rsp)
movl 0x20(%rsp), %eax
jmp 0x40fd1b
movq 0x30(%rsp), %r9
incq %r9
movq 0x48(%rsp), %rax
movq 0x8(%rsp), %rcx
addl %ecx, %eax
jmp 0x40f997
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
movq 0x58(%rsp), %rcx
addq %rbx, %rcx
xorl %edx, %edx
cmpq %rdx, %r15
je 0x40fdd1
movb (%rcx,%rdx), %sil
addb (%r10,%rdx), %sil
movb %sil, (%rbx,%rdx)
incq %rdx
jmp 0x40fdbb
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
jmp 0x40fdad
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fe0c
movzbl (%rbp,%rcx), %edx
movzbl (%r12,%rcx), %esi
addl %edx, %esi
shrl %esi
addb (%r10,%rcx), %sil
movb %sil, (%rbx,%rcx)
incq %rcx
jmp 0x40fdec
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
addq %r8, %rbp
addq %r8, %r12
jmp 0x40fde6
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fe46
movb (%r12,%rcx), %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fe31
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
addq %r8, %r12
jmp 0x40fe27
addq 0x8(%rsp), %r12
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40fe7f
movb (%r12,%rcx), %dl
shrb %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fe68
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
addq %r8, %r12
jmp 0x40fe5e
movl 0x4(%rsp), %eax
decl %eax
je 0x40fd95
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x40feb0
movb (%rsi,%rcx), %dl
addb (%r10,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x40fe9c
movb $-0x1, (%rbx,%rdi)
addq %rdi, %r10
addq %r8, %rbx
addq %r8, %rsi
jmp 0x40fe92
leaq 0xc4979(%rip), %rax     # 0x4d483f
jmp 0x40fed4
pushq $0x1
popq %rax
jmp 0x40fedd
leaq 0xc4c15(%rip), %rax     # 0x4d4ae9
movq %rax, 0x109665(%rip)    # 0x519540
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc4c02(%rip), %rdi     # 0x4d4af8
leaq 0xc4a11(%rip), %rsi     # 0x4d490e
leaq 0xc4b6d(%rip), %rcx     # 0x4d4a71
movl $0x89b, %edx            # imm = 0x89B
callq 0x41d270
leaq 0xc4b33(%rip), %rdi     # 0x4d4a48
leaq 0xc49f2(%rip), %rsi     # 0x4d490e
leaq 0xc4b4e(%rip), %rcx     # 0x4d4a71
movl $0x86b, %edx            # imm = 0x86B
callq 0x41d270