// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/libraries/libwebp/src/utils/quant_levels_dec_utils.c
// Function: WebPDequantizeLevels
int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride,
                         int strength) {
  int radius = 4 * strength / 100;

  if (strength < 0 || strength > 100) return 0;
  if (data == NULL || width <= 0 || height <= 0) return 0;  // bad params

  // limit the filter size to not exceed the image dimensions
  if (2 * radius + 1 > width) radius = (width - 1) >> 1;
  if (2 * radius + 1 > height) radius = (height - 1) >> 1;

  if (radius > 0) {
    SmoothParams p;
    memset(&p, 0, sizeof(p));
    if (!InitParams(data, width, height, stride, radius, &p)) return 0;
    if (p.num_levels_ > 2) {
      for (; p.row_ < p.height_; ++p.row_) {
        VFilter(&p);  // accumulate average of input
        // Need to wait few rows in order to prime the filter,
        // before emitting some output.
        if (p.row_ >= p.radius_) {
          HFilter(&p);
          ApplyFilter(&p);
        }
      }
    }
    CleanupParams(&p);
  }
  return 1;
}

// Assembly:
xorl %r9d, %r9d
cmpl $0x64, %r8d
ja 0xf3dff
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %ecx, %ebp
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, 0x30(%rsp)
testq %rdi, %rdi
sete %al
testl %esi, %esi
setle %cl
testl %edx, %edx
setle %dl
orb %cl, %dl
orb %al, %dl
jne 0xf3dee
movslq %r8d, %rax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rax
addl %ecx, %eax
leal (%rax,%rax), %ecx
leal -0x1(%r14), %edx
shrl %edx
cmpl %r14d, %ecx
cmovll %eax, %edx
leal (%rdx,%rdx), %eax
leal -0x1(%rbx), %ecx
shrl %ecx
cmpl %ebx, %eax
cmovll %edx, %ecx
movl $0x1, %r9d
testl %ecx, %ecx
jle 0xf3dee
leal 0x2(,%rcx,2), %r12d
imull %r14d, %r12d
addl %r12d, %r12d
movl %r14d, %r13d
leaq (%r12,%r13,2), %rsi
addq $0xffe, %rsi            # imm = 0xFFE
movl $0x1, %edi
movq %rcx, %r15
callq 0x56b20
xorl %r9d, %r9d
testq %rax, %rax
je 0xf3934
movl %ebp, 0x18(%rsp)
movq %rbx, 0x28(%rsp)
movq %r15, 0x20(%rsp)
leal (%r15,%r15), %ebx
leaq (,%r13,2), %rdx
orl $0x1, %ebx
movl %ebx, %ecx
imull %r14d, %ecx
movq %r12, 0x8(%rsp)
leaq (%rax,%rcx,2), %r12
movq %r12, %r15
subq %rdx, %r15
movq %rax, %rbp
movq %r15, %rdi
xorl %esi, %esi
movq %rdx, 0x50(%rsp)
callq 0x55f20
movq %rbp, 0x10(%rsp)
movq 0x8(%rsp), %rax
addq %rbp, %rax
movq %rax, 0x38(%rsp)
imull %ebx, %ebx
movl $0x40000, %eax          # imm = 0x40000
xorl %edx, %edx
divl %ebx
movq 0x28(%rsp), %rbx
movl %eax, %ebp
leaq 0xb0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x55f20
testl %ebx, %ebx
jle 0xf3984
movslq 0x18(%rsp), %rax
xorl %r8d, %r8d
movl $0xff, %esi
xorl %ecx, %ecx
movq 0x30(%rsp), %rdx
testl %r14d, %r14d
jle 0xf3929
xorl %edi, %edi
movl %r8d, %r9d
movl %esi, %r10d
movzbl (%rdx,%rdi), %r11d
cmpl %r11d, %r10d
cmovgl %r11d, %esi
cmovgel %r11d, %r10d
cmpl %r11d, %r9d
cmovll %r11d, %r8d
cmovlel %r11d, %r9d
movb $0x1, 0xb0(%rsp,%r11)
incq %rdi
cmpq %rdi, %r13
jne 0xf38fd
addq %rax, %rdx
incl %ecx
cmpl %ebx, %ecx
jne 0xf38f0
jmp 0xf398c
xorl %r14d, %r14d
xorl %ebx, %ebx
movq $0x0, 0x60(%rsp)
movl $0x0, 0x4(%rsp)
movq $0x0, 0x30(%rsp)
xorl %edx, %edx
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
movq $0x0, 0x38(%rsp)
xorl %edi, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq $0x0, 0x18(%rsp)
jmp 0xf3ac5
movl $0xff, %esi
xorl %r8d, %r8d
movq 0x38(%rsp), %rax
movq 0x50(%rsp), %r11
leaq (%rax,%r11), %rdi
movq 0x20(%rsp), %rax
negl %eax
movl %eax, 0x4(%rsp)
movslq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
movl %r8d, %eax
subl %esi, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r10d, %r10d
cmpb $0x0, 0xb0(%rsp,%rcx)
je 0xf39de
incl %r10d
testl %edx, %edx
js 0xf39dc
movl %ecx, %r9d
subl %edx, %r9d
cmpl %eax, %r9d
cmovll %r9d, %eax
movl %ecx, %edx
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0xf39be
movq %r10, 0x58(%rsp)
leaq 0x7fe(%rdi), %rcx
movq %rcx, 0x18(%rsp)
leal (,%rax,4), %ecx
leal (%rcx,%rcx,2), %r10d
sarl $0x2, %r10d
movslq %ecx, %rdx
subl %r10d, %ecx
movq %rcx, 0x48(%rsp)
movslq %r10d, %r13
addq 0x8(%rsp), %r11
movq 0x10(%rsp), %rcx
leaq (%rcx,%r11), %r9
addq $0x7fc, %r9             # imm = 0x7FC
leal -0x1(,%rax,4), %ecx
imull %r13d, %ecx
xorl %ebx, %ebx
movl %r10d, 0x40(%rsp)
movq %rbx, %r11
incq %rbx
cmpq %r13, %rbx
jle 0xf3a77
xorl %eax, %eax
cmpq %rdx, %rbx
jge 0xf3a79
movl %ecx, %eax
movq %r13, %r10
movq %rdi, %r13
movq %r14, %rdi
movq %rdx, %r14
cltd
idivl 0x48(%rsp)
movq %r14, %rdx
movq %rdi, %r14
movq %r13, %rdi
movq %r10, %r13
movl 0x40(%rsp), %r10d
jmp 0xf3a79
movl %ebx, %eax
shrl $0x2, %eax
movw %ax, 0x800(%rdi,%r11,2)
negl %eax
movw %ax, (%r9)
addq $-0x2, %r9
subl %r10d, %ecx
cmpq $0x3ff, %rbx            # imm = 0x3FF
jne 0xf3a3f
movq 0x18(%rsp), %rax
movw $0x0, (%rax)
cmpl $0x3, 0x58(%rsp)
setge %dil
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rbx
movq 0x20(%rsp), %rdx
xorl %r9d, %r9d
testq %rax, %rax
je 0xf3dee
cmpl %ebx, 0x4(%rsp)
setl %cl
andb %cl, %dil
cmpb $0x1, %dil
jne 0xf3dde
movl %r14d, %eax
movslq %r14d, %rdi
leal -0x1(%rbx), %ecx
movl %ecx, 0x58(%rsp)
movl %edx, %ecx
leal 0x1(%rdx), %r9d
movq %r9, 0x98(%rsp)
leaq (%r12,%rcx,2), %r9
addq $-0x2, %r9
movq %r9, 0x90(%rsp)
movl %edi, %r9d
subl %edx, %r9d
movl %r9d, 0x70(%rsp)
movslq %r9d, %r9
movq %r9, 0x80(%rsp)
movl %edx, %r9d
notl %r9d
movq %r9, 0x78(%rsp)
leaq (%r12,%rcx,2), %rcx
movq %rcx, 0x88(%rsp)
movq %rdi, 0x40(%rsp)
leal -0x2(%rdi,%rdi), %ecx
movl %ecx, 0x6c(%rsp)
movabsq $0x100000000, %r10      # imm = 0x100000000
movq 0x8(%rsp), %r13
movq 0x30(%rsp), %rdi
movq %rdx, 0x20(%rsp)
movl %ebp, 0x74(%rsp)
movq %r12, 0xa0(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x28(%rsp)
testl %r14d, %r14d
jle 0xf3bad
xorl %ecx, %ecx
xorl %r9d, %r9d
movzbl (%rdi,%rcx), %r11d
addl %r11d, %r9d
movzwl (%r15,%rcx,2), %r11d
addw %r9w, %r11w
movl %r11d, %ebx
subw (%r13,%rcx,2), %bx
movw %bx, (%r12,%rcx,2)
movw %r11w, (%r13,%rcx,2)
incq %rcx
cmpq %rcx, %rax
jne 0xf3b80
movq %rdi, 0x48(%rsp)
movq 0x40(%rsp), %rcx
leaq (,%rcx,2), %r9
addq %r13, %r9
cmpq %r12, %r9
cmoveq 0x8(%rsp), %r9
movl 0x4(%rsp), %ecx
cmpl 0x58(%rsp), %ecx
movl $0x0, %r11d
cmovlq 0x60(%rsp), %r11
testl %ecx, %ecx
movl $0x0, %edi
cmovsq %rdi, %r11
cmpl %edx, %ecx
jge 0xf3bfd
movq 0x28(%rsp), %rbx
movq 0x48(%rsp), %rdi
jmp 0xf3dc3
movq %r11, 0xa8(%rsp)
movq %r9, 0x50(%rsp)
movq 0x88(%rsp), %rbx
movq %rbx, %rcx
xorl %r15d, %r15d
xorl %r9d, %r9d
movq 0x38(%rsp), %rdx
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %r14
movzwl (%rcx), %r11d
addw (%r14,%r9,2), %r11w
addq %r10, %r15
movzwl %r11w, %r11d
imull %ebp, %r11d
shrl $0x10, %r11d
movw %r11w, (%rdx,%r9,2)
incq %r9
addq $-0x2, %rcx
cmpq %r9, %rdi
jne 0xf3c30
cmpl %r9d, 0x70(%rsp)
movq 0x78(%rsp), %r10
jle 0xf3ca2
sarq $0x20, %r15
movq 0x80(%rsp), %rdi
movq 0x10(%rsp), %r11
movzwl (%rbx,%r15,2), %ecx
leal (%r10,%r15), %r9d
movslq %r9d, %r9
subw (%r12,%r9,2), %cx
movzwl %cx, %ecx
imull %ebp, %ecx
shrl $0x10, %ecx
movw %cx, (%rdx,%r15,2)
incq %r15
cmpq %rdi, %r15
jl 0xf3c76
movl %r15d, %r9d
jmp 0xf3ca7
movq 0x10(%rsp), %r11
cmpl %r11d, %r9d
movq 0x40(%rsp), %rbp
movl 0x74(%rsp), %edi
movq 0xa0(%rsp), %r12
jge 0xf3d21
movslq %r9d, %rcx
movq %rbp, %r15
subq %rcx, %r15
movq 0x38(%rsp), %rdx
leaq (%rdx,%rcx,2), %rbx
movq 0x20(%rsp), %rcx
addl %r9d, %ecx
movl 0x6c(%rsp), %edx
movl %edx, %r11d
subl %ecx, %r11d
addl 0x78(%rsp), %r9d
xorl %ecx, %ecx
movzwl -0x2(%r12,%rbp,2), %r14d
addl %r14d, %r14d
movslq %r11d, %r11
movzwl (%r12,%r11,2), %r10d
leal (%r9,%rcx), %edx
movslq %edx, %rdx
addw (%r12,%rdx,2), %r10w
subl %r10d, %r14d
movzwl %r14w, %edx
imull %edi, %edx
shrl $0x10, %edx
movw %dx, (%rbx,%rcx,2)
incq %rcx
decl %r11d
cmpq %rcx, %r15
jne 0xf3ce8
movq 0x10(%rsp), %r14
testl %r14d, %r14d
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %r15
movl %edi, %ebp
movabsq $0x100000000, %r10      # imm = 0x100000000
movq 0x48(%rsp), %rdi
jle 0xf3da7
xorl %r9d, %r9d
movzbl (%r15,%r9), %ecx
cmpl %ecx, %r8d
jle 0xf3d9f
cmpl %ecx, %esi
jge 0xf3d9f
movq 0x38(%rsp), %rdx
movzwl (%rdx,%r9,2), %edx
leal (,%rcx,4), %r10d
subq %r10, %rdx
movq 0x18(%rsp), %r10
movswl (%r10,%rdx,2), %r11d
addl %ecx, %r11d
testl %r11d, %r11d
jg 0xf3d81
xorl %r11d, %r11d
movl $0xff, %ecx
cmpl %ecx, %r11d
jl 0xf3d91
movl $0xff, %r11d
movb %r11b, (%r15,%r9)
movabsq $0x100000000, %r10      # imm = 0x100000000
incq %r9
cmpq %r9, %rax
jne 0xf3d49
addq 0x60(%rsp), %r15
movq %r15, 0x30(%rsp)
movq 0x20(%rsp), %rdx
movq 0x50(%rsp), %r9
movq 0xa8(%rsp), %r11
addq %r11, %rdi
movl 0x4(%rsp), %ecx
incl %ecx
movq %r13, %r15
movq %r9, %r13
movl %ecx, 0x4(%rsp)
cmpl %ebx, %ecx
jne 0xf3b76
movq 0x8(%rsp), %rdi
callq 0x57290
movl $0x1, %r9d
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl %r9d, %eax
retq