// File: lunasorcery[P]brailify/./stb/stb_image.h
// Function: stbi__load_and_postprocess_8bit(stbi__context*, int*, int*, int*, int)
static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
   stbi__result_info ri;
   void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);

   if (result == NULL)
      return NULL;

   if (ri.bits_per_channel != 8) {
      STBI_ASSERT(ri.bits_per_channel == 16);
      result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp);
      ri.bits_per_channel = 8;
   }

   // @TODO: move stbi__convert_format to here

   if (stbi__vertically_flip_on_load) {
      int w = *x, h = *y;
      int channels = req_comp ? req_comp : *comp;
      int row,col,z;
      stbi_uc *image = (stbi_uc *) result;

      // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once
      for (row = 0; row < (h>>1); row++) {
         for (col = 0; col < w; col++) {
            for (z = 0; z < channels; z++) {
               stbi_uc temp = image[(row * w + col) * channels + z];
               image[(row * w + col) * channels + z] = image[((h - row - 1) * w + col) * channels + z];
               image[((h - row - 1) * w + col) * channels + z] = temp;
            }
         }
      }
   }

   return (unsigned char *) result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
leaq -0x38(%rbp), %r9
movl $0x8, (%rsp)
callq 0x3af0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x150b
movq $0x0, -0x8(%rbp)
jmp 0x16bd
cmpl $0x8, -0x38(%rbp)
je 0x1586
cmpl $0x10, -0x38(%rbp)
jne 0x1519
jmp 0x1538
leaq 0x1f129(%rip), %rdi     # 0x20649
leaq 0x1f13c(%rip), %rsi     # 0x20663
movl $0x45d, %edx            # imm = 0x45D
leaq 0x1f142(%rip), %rcx     # 0x20675
callq 0x1090
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x1563
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x1569
movl -0x2c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x68(%rbp), %edx
movl -0x6c(%rbp), %esi
movq -0x78(%rbp), %rdi
movl -0x7c(%rbp), %ecx
callq 0x3d90
movq %rax, -0x40(%rbp)
movl $0x8, -0x38(%rbp)
cmpl $0x0, 0x253ab(%rip)     # 0x26938
je 0x16b5
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x15b3
movl -0x2c(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x15bc
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl -0x48(%rbp), %ecx
sarl %ecx
cmpl %ecx, %eax
jge 0x16b3
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x16a3
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x1693
movq -0x60(%rbp), %rax
movl -0x50(%rbp), %ecx
imull -0x44(%rbp), %ecx
addl -0x54(%rbp), %ecx
imull -0x4c(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x61(%rbp)
movq -0x60(%rbp), %rax
movl -0x48(%rbp), %ecx
subl -0x50(%rbp), %ecx
subl $0x1, %ecx
imull -0x44(%rbp), %ecx
addl -0x54(%rbp), %ecx
imull -0x4c(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x60(%rbp), %rax
movl -0x50(%rbp), %ecx
imull -0x44(%rbp), %ecx
addl -0x54(%rbp), %ecx
imull -0x4c(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movb -0x61(%rbp), %dl
movq -0x60(%rbp), %rax
movl -0x48(%rbp), %ecx
subl -0x50(%rbp), %ecx
subl $0x1, %ecx
imull -0x44(%rbp), %ecx
addl -0x54(%rbp), %ecx
imull -0x4c(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x15fb
jmp 0x1695
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x15e8
jmp 0x16a5
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x15d1
jmp 0x16b5
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)