// File: /workspace/github_c_makefile_star2_O2/DavidSM64[P]n64graphics_ci/./stb/stb_image_write.h
// Function: stbiw__encode_png_line
static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer)
{
   static int mapping[] = { 0,1,2,3,4 };
   static int firstmap[] = { 0,1,0,5,6 };
   int *mymap = (y != 0) ? mapping : firstmap;
   int i;
   int type = mymap[filter_type];
   unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y);
   int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes;
   for (i = 0; i < n; ++i) {
      switch (type) {
         case 0: line_buffer[i] = z[i]; break;
         case 1: line_buffer[i] = z[i]; break;
         case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break;
         case 3: line_buffer[i] = z[i] - (z[i-signed_stride]>>1); break;
         case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break;
         case 5: line_buffer[i] = z[i]; break;
         case 6: line_buffer[i] = z[i]; break;
      }
   }
   for (i=n; i < width*n; ++i) {
      switch (type) {
         case 0: line_buffer[i] = z[i]; break;
         case 1: line_buffer[i] = z[i] - z[i-n]; break;
         case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break;
         case 3: line_buffer[i] = z[i] - ((z[i-n] + z[i-signed_stride])>>1); break;
         case 4: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-signed_stride], z[i-signed_stride-n]); break;
         case 5: line_buffer[i] = z[i] - (z[i-n]>>1); break;
         case 6: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, -0x3c(%rbp)
movq 0x18(%rbp), %r10
movslq 0x10(%rbp), %rax
testl %r8d, %r8d
leaq 0xbb43(%rip), %rdx      # 0x11a60
leaq 0xbb1c(%rip), %r11      # 0x11a40
cmoveq %rdx, %r11
movl %r8d, %edx
notl %edx
addl %ecx, %edx
movl %esi, %ecx
negl %ecx
cmpl $0x0, 0x122ca(%rip)     # 0x18204
cmovel %r8d, %edx
movl (%r11,%rax,4), %r8d
cmovel %esi, %ecx
imull %esi, %edx
movslq %edx, %r13
addq %rdi, %r13
movslq %ecx, %rax
xorl %r14d, %r14d
testl %r9d, %r9d
movl $0x0, %r15d
movl %r9d, -0x40(%rbp)
cmovgl %r9d, %r15d
movq %r13, %rcx
movq %rax, -0x50(%rbp)
subq %rax, %rcx
movl %r8d, %edx
leaq 0xb2d7(%rip), %rbx      # 0x11250
movl %r8d, -0x2c(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x38(%rbp)
cmpq %r14, %r15
je 0x5fe7
cmpl $0x6, %r8d
ja 0x5fe2
movslq (%rbx,%rdx,4), %rax
addq %rbx, %rax
jmpq *%rax
movb (%r13,%r14), %r12b
jmp 0x5fde
movb (%r13,%r14), %r12b
movzbl (%rcx,%r14), %esi
xorl %edi, %edi
xorl %edx, %edx
callq 0xfea7
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %rdx
movl -0x2c(%rbp), %r8d
movq 0x18(%rbp), %r10
jmp 0x5fdb
movb (%r13,%r14), %r12b
subb (%rcx,%r14), %r12b
jmp 0x5fde
movb (%r13,%r14), %r12b
movb (%rcx,%r14), %al
shrb %al
subb %al, %r12b
movb %r12b, (%r10,%r14)
incq %r14
jmp 0x5f85
movl -0x40(%rbp), %eax
movl -0x3c(%rbp), %ecx
imull %eax, %ecx
movslq %eax, %r12
movslq %ecx, %rsi
leaq 0xb26f(%rip), %rdi      # 0x1126c
movq %r12, %r14
movq -0x50(%rbp), %rbx
movq %rsi, -0x38(%rbp)
cmpq %rsi, %r14
jge 0x60d8
cmpl $0x6, %r8d
ja 0x60d0
movslq (%rdi,%rdx,4), %rax
addq %rdi, %rax
jmpq *%rax
movb (%r13,%r14), %r15b
movq %r14, %rax
subq %r12, %rax
jmp 0x60c7
movb (%r13,%r14), %r15b
movq %r14, %rax
subq %r12, %rax
movb (%r13,%rax), %al
shrb %al
jmp 0x60b0
movb (%r13,%r14), %r15b
movq %r14, %rax
subq %r12, %rax
movzbl (%r13,%rax), %eax
movq %r14, %rcx
subq %rbx, %rcx
movzbl (%r13,%rcx), %ecx
addl %eax, %ecx
shrl %ecx
subb %cl, %r15b
jmp 0x60cc
movb (%r13,%r14), %r15b
movq %r14, %rax
subq %r12, %rax
movzbl (%r13,%rax), %edi
movq %r14, %rax
subq %rbx, %rax
movzbl (%r13,%rax), %esi
subq %r12, %rax
movzbl (%r13,%rax), %edx
callq 0xfea7
leaq 0xb1cc(%rip), %rdi      # 0x1126c
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl -0x2c(%rbp), %r8d
movq 0x18(%rbp), %r10
subb %al, %r15b
jmp 0x60cc
movb (%r13,%r14), %r15b
jmp 0x60cc
movb (%r13,%r14), %r15b
movq %r14, %rax
subq %rbx, %rax
subb (%r13,%rax), %r15b
movb %r15b, (%r10,%r14)
incq %r14
jmp 0x6008
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq