// File: /workspace/github_c_makefile_star2_O0/ggerganov[P]font-rasterizer/./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;
    
   if (type==0) {
      memcpy(line_buffer, z, width*n);
      return;
   }

   // first loop isn't optimized since it's just one pixel    
   for (i = 0; i < n; ++i) {
      switch (type) {
         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;
      }
   }
   switch (type) {
      case 1: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-n]; break;
      case 2: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-signed_stride]; break;
      case 3: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - ((z[i-n] + z[i-signed_stride])>>1); break;
      case 4: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-signed_stride], z[i-signed_stride-n]); break;
      case 5: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - (z[i-n]>>1); break;
      case 6: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0x18(%rbp), %edx
leaq 0x17ee2(%rip), %rax     # 0x1b200
leaq 0x17ebb(%rip), %rcx     # 0x1b1e0
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq 0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, 0x182d1(%rip)     # 0x1b624
je 0x3363
movl -0x14(%rbp), %eax
subl $0x1, %eax
subl -0x18(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x3369
movl -0x18(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movl -0x40(%rbp), %ecx
movl -0x4c(%rbp), %edx
imull %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0x1829d(%rip)     # 0x1b624
je 0x3393
xorl %eax, %eax
subl -0xc(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x3399
movl -0xc(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x33c1
movq 0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x10(%rbp), %eax
imull -0x1c(%rbp), %eax
movslq %eax, %rdx
callq 0x1130
jmp 0x375a
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x34f8
movl -0x30(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x5, %eax
ja 0x34e8
movq -0x58(%rbp), %rax
leaq 0x11c35(%rip), %rcx     # 0x15028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34e8
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x3c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34e8
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x3c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
sarl %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34e8
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x5c(%rbp)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %esi
xorl %edx, %edx
movl %edx, %edi
callq 0xe2b0
movb %al, %cl
movl -0x5c(%rbp), %eax
movzbl %cl, %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34e8
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34e8
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x34ea
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x33c8
movl -0x30(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x5, %eax
ja 0x375a
movq -0x68(%rbp), %rax
leaq 0x11af9(%rip), %rcx     # 0x15010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x356b
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x1c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3526
jmp 0x375a
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x35bb
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x3c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3576
jmp 0x375a
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x3620
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x1c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movq -0x38(%rbp), %rdx
movl -0x2c(%rbp), %esi
subl -0x3c(%rbp), %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
addl %edx, %ecx
sarl %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x35c6
jmp 0x375a
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x36a5
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x6c(%rbp)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edi
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %esi
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl -0x3c(%rbp), %ecx
subl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
callq 0xe2b0
movb %al, %cl
movl -0x6c(%rbp), %eax
movzbl %cl, %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x362b
jmp 0x375a
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x36f7
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
subl -0x1c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
sarl %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36b0
jmp 0x375a
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x3758
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edi
xorl %edx, %edx
movl %edx, %esi
callq 0xe2b0
movb %al, %cl
movl -0x70(%rbp), %eax
movzbl %cl, %ecx
subl %ecx, %eax
movb %al, %dl
movq 0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36ff
jmp 0x375a
addq $0x70, %rsp
popq %rbp
retq