// File: Ciaxur[P]yagb-emu/include/imgui/imstb_truetype.h
// Function: stbtt__h_prefilter(unsigned char*, int, int, int, unsigned int)
static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)
{
   unsigned char buffer[STBTT_MAX_OVERSAMPLE];
   int safe_w = w - kernel_width;
   int j;
   STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze
   for (j=0; j < h; ++j) {
      int i;
      unsigned int total;
      STBTT_memset(buffer, 0, kernel_width);

      total = 0;

      // make kernel_width a constant in common cases so compiler can optimize out the divide
      switch (kernel_width) {
         case 2:
            for (i=0; i <= safe_w; ++i) {
               total += pixels[i] - buffer[i & STBTT__OVER_MASK];
               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];
               pixels[i] = (unsigned char) (total / 2);
            }
            break;
         case 3:
            for (i=0; i <= safe_w; ++i) {
               total += pixels[i] - buffer[i & STBTT__OVER_MASK];
               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];
               pixels[i] = (unsigned char) (total / 3);
            }
            break;
         case 4:
            for (i=0; i <= safe_w; ++i) {
               total += pixels[i] - buffer[i & STBTT__OVER_MASK];
               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];
               pixels[i] = (unsigned char) (total / 4);
            }
            break;
         case 5:
            for (i=0; i <= safe_w; ++i) {
               total += pixels[i] - buffer[i & STBTT__OVER_MASK];
               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];
               pixels[i] = (unsigned char) (total / 5);
            }
            break;
         default:
            for (i=0; i <= safe_w; ++i) {
               total += pixels[i] - buffer[i & STBTT__OVER_MASK];
               buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i];
               pixels[i] = (unsigned char) (total / kernel_width);
            }
            break;
      }

      for (; i < w; ++i) {
         STBTT_assert(pixels[i] == 0);
         total -= buffer[i & STBTT__OVER_MASK];
         pixels[i] = (unsigned char) (total / kernel_width);
      }

      pixels += stride_in_bytes;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl -0xc(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0xd2f0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x1224d6
movl -0x18(%rbp), %eax
movl %eax, %edx
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xd2f0
movl $0x0, -0x30(%rbp)
movl -0x18(%rbp), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x3, %eax
ja 0x1223d5
movq -0x38(%rbp), %rax
leaq 0x618f8(%rip), %rcx     # 0x183b04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x12227d
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
andl $0x7, %ecx
movslq %ecx, %rcx
movzbl -0x20(%rbp,%rcx), %ecx
subl %ecx, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x2c(%rbp), %eax
addl -0x18(%rbp), %eax
andl $0x7, %eax
movl %eax, %eax
movb %cl, -0x20(%rbp,%rax)
movl -0x30(%rbp), %eax
shrl %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x12221c
jmp 0x122442
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x1222f1
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
andl $0x7, %ecx
movslq %ecx, %rcx
movzbl -0x20(%rbp,%rcx), %ecx
subl %ecx, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x2c(%rbp), %eax
addl -0x18(%rbp), %eax
andl $0x7, %eax
movl %eax, %eax
movb %cl, -0x20(%rbp,%rax)
movl -0x30(%rbp), %eax
movl $0x3, %ecx
xorl %edx, %edx
divl %ecx
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x122289
jmp 0x122442
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x12235f
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
andl $0x7, %ecx
movslq %ecx, %rcx
movzbl -0x20(%rbp,%rcx), %ecx
subl %ecx, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x2c(%rbp), %eax
addl -0x18(%rbp), %eax
andl $0x7, %eax
movl %eax, %eax
movb %cl, -0x20(%rbp,%rax)
movl -0x30(%rbp), %eax
shrl $0x2, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1222fd
jmp 0x122442
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x1223d3
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
andl $0x7, %ecx
movslq %ecx, %rcx
movzbl -0x20(%rbp,%rcx), %ecx
subl %ecx, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x2c(%rbp), %eax
addl -0x18(%rbp), %eax
andl $0x7, %eax
movl %eax, %eax
movb %cl, -0x20(%rbp,%rax)
movl -0x30(%rbp), %eax
movl $0x5, %ecx
xorl %edx, %edx
divl %ecx
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x12236b
jmp 0x122442
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x122440
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
andl $0x7, %ecx
movslq %ecx, %rcx
movzbl -0x20(%rbp,%rcx), %ecx
subl %ecx, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x2c(%rbp), %eax
addl -0x18(%rbp), %eax
andl $0x7, %eax
movl %eax, %eax
movb %cl, -0x20(%rbp,%rax)
movl -0x30(%rbp), %eax
xorl %edx, %edx
divl -0x18(%rbp)
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1223dc
jmp 0x122442
jmp 0x122444
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1224b7
jmp 0x12244e
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x122461
jmp 0x122480
leaq 0x692fa(%rip), %rdi     # 0x18b762
leaq 0x68b7b(%rip), %rsi     # 0x18afea
movl $0xf41, %edx            # imm = 0xF41
leaq 0x692f6(%rip), %rcx     # 0x18b771
callq 0xd180
jmp 0x122482
movl -0x2c(%rbp), %eax
andl $0x7, %eax
cltq
movzbl -0x20(%rbp,%rax), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
xorl %edx, %edx
divl -0x18(%rbp)
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x122444
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1221c9
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)