// File: /workspace/github_c_makefile_star2_O0/nilesr[P]dotter/./stb/stb_image_write.h
// Function: stbi_write_tga_core
static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, void *data)
{
   int has_alpha = (comp == 2 || comp == 4);
   int colorbytes = has_alpha ? comp-1 : comp;
   int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3

   if (y < 0 || x < 0)
      return 0;

   if (!stbi_write_tga_with_rle) {
      return stbiw__outfile(s, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0,
         "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8);
   } else {
      int i,j,k;

      stbiw__writef(s, "111 221 2222 11", 0,0,format+8, 0,0,0, 0,0,x,y, (colorbytes + has_alpha) * 8, has_alpha * 8);

      for (j = y - 1; j >= 0; --j) {
          unsigned char *row = (unsigned char *) data + j * x * comp;
         int len;

         for (i = 0; i < x; i += len) {
            unsigned char *begin = row + i * comp;
            int diff = 1;
            len = 1;

            if (i < x - 1) {
               ++len;
               diff = memcmp(begin, row + (i + 1) * comp, comp);
               if (diff) {
                  const unsigned char *prev = begin;
                  for (k = i + 2; k < x && len < 128; ++k) {
                     if (memcmp(prev, row + k * comp, comp)) {
                        prev += comp;
                        ++len;
                     } else {
                        --len;
                        break;
                     }
                  }
               } else {
                  for (k = i + 2; k < x && len < 128; ++k) {
                     if (!memcmp(begin, row + k * comp, comp)) {
                        ++len;
                     } else {
                        break;
                     }
                  }
               }
            }

            if (diff) {
               unsigned char header = STBIW_UCHAR(len - 1);
               s->func(s->context, &header, 1);
               for (k = 0; k < len; ++k) {
                  stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp);
               }
            } else {
               unsigned char header = STBIW_UCHAR(len - 129);
               s->func(s->context, &header, 1);
               stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin);
            }
         }
      }
   }
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movl %ecx, -0x44(%rbp)
movq %r8, -0x50(%rbp)
movb $0x1, %al
cmpl $0x2, -0x44(%rbp)
movb %al, -0x93(%rbp)
je 0x1600
cmpl $0x4, -0x44(%rbp)
sete %al
movb %al, -0x93(%rbp)
movb -0x93(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x1622
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x162b
movl -0x44(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %edx
movl $0x2, %eax
movl $0x3, %ecx
cmpl $0x2, %edx
cmovll %ecx, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x40(%rbp)
jl 0x1656
cmpl $0x0, -0x3c(%rbp)
jge 0x1662
movl $0x0, -0x2c(%rbp)
jmp 0x1a58
cmpl $0x0, 0x10a97(%rip)     # 0x12100
jne 0x1732
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %r8d
movl -0x44(%rbp), %r9d
movq -0x50(%rbp), %r13
movl -0x54(%rbp), %r12d
movl -0x5c(%rbp), %r14d
movl -0x3c(%rbp), %ebx
movl -0x40(%rbp), %r11d
movl -0x58(%rbp), %r10d
addl -0x54(%rbp), %r10d
shll $0x3, %r10d
movl -0x54(%rbp), %eax
shll $0x3, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %esi, %esi
leaq 0xd4c8(%rip), %r15      # 0xeb79
movl %edx, %esi
movl $0x0, (%rsp)
movq %r13, 0x8(%rsp)
movl %r12d, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movl %r14d, 0x38(%rsp)
movl $0x0, 0x40(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x0, 0x50(%rsp)
movl $0x0, 0x58(%rsp)
movl $0x0, 0x60(%rsp)
movl %ebx, 0x68(%rsp)
movl %r11d, 0x70(%rsp)
movl %r10d, 0x78(%rsp)
movl %eax, 0x80(%rsp)
movb $0x0, %al
callq 0x6410
movl %eax, -0x2c(%rbp)
jmp 0x1a58
movq -0x38(%rbp), %rdi
movl -0x5c(%rbp), %r8d
addl $0x8, %r8d
movl -0x3c(%rbp), %ebx
movl -0x40(%rbp), %r11d
movl -0x58(%rbp), %r10d
addl -0x54(%rbp), %r10d
shll $0x3, %r10d
movl -0x54(%rbp), %eax
shll $0x3, %eax
leaq 0xd41b(%rip), %rsi      # 0xeb79
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movb $0x0, %al
callq 0x6a90
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jl 0x1a4f
movq -0x50(%rbp), %rax
movl -0x64(%rbp), %ecx
imull -0x3c(%rbp), %ecx
imull -0x44(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x1a3f
movq -0x70(%rbp), %rax
movl -0x60(%rbp), %ecx
imull -0x44(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movl $0x1, -0x84(%rbp)
movl $0x1, -0x74(%rbp)
movl -0x60(%rbp), %eax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x196a
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x80(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0x60(%rbp), %eax
addl $0x1, %eax
imull -0x44(%rbp), %eax
cltq
addq %rax, %rsi
movslq -0x44(%rbp), %rdx
callq 0x10b0
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
je 0x18f5
movq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0x60(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3c(%rbp), %ecx
movb %al, -0x99(%rbp)
jge 0x1885
cmpl $0x80, -0x74(%rbp)
setl %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x1891
jmp 0x18f3
movq -0x90(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0x68(%rbp), %eax
imull -0x44(%rbp), %eax
cltq
addq %rax, %rsi
movslq -0x44(%rbp), %rdx
callq 0x10b0
cmpl $0x0, %eax
je 0x18d8
movl -0x44(%rbp), %ecx
movq -0x90(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x18e3
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x18f3
jmp 0x18e5
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x1865
jmp 0x1968
movl -0x60(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3c(%rbp), %ecx
movb %al, -0x9a(%rbp)
jge 0x191e
cmpl $0x80, -0x74(%rbp)
setl %al
movb %al, -0x9a(%rbp)
movb -0x9a(%rbp), %al
testb $0x1, %al
jne 0x192a
jmp 0x1966
movq -0x80(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0x68(%rbp), %eax
imull -0x44(%rbp), %eax
cltq
addq %rax, %rsi
movslq -0x44(%rbp), %rdx
callq 0x10b0
cmpl $0x0, %eax
jne 0x1957
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1959
jmp 0x1966
jmp 0x195b
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x18fe
jmp 0x1968
jmp 0x196a
cmpl $0x0, -0x84(%rbp)
je 0x19e4
movl -0x74(%rbp), %eax
subl $0x1, %eax
andl $0xff, %eax
movb %al, -0x91(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rdi
leaq -0x91(%rbp), %rsi
movl $0x1, %edx
callq *%rax
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x19e2
movq -0x38(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x54(%rbp), %ecx
movq -0x80(%rbp), %r9
movl -0x68(%rbp), %eax
imull -0x44(%rbp), %eax
cltq
addq %rax, %r9
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
callq 0x6830
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x19a8
jmp 0x1a2f
movl -0x74(%rbp), %eax
subl $0x81, %eax
andl $0xff, %eax
movb %al, -0x92(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rdi
leaq -0x92(%rbp), %rsi
movl $0x1, %edx
callq *%rax
movq -0x38(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x54(%rbp), %ecx
movq -0x80(%rbp), %r9
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
callq 0x6830
jmp 0x1a31
movl -0x74(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x17d2
jmp 0x1a41
movl -0x64(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17a8
jmp 0x1a51
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)