// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %edx, %r14d
movl %esi, %r12d
pushq $0x19
popq %rsi
movl %r8d, %eax
cltd
idivl %esi
xorl %r13d, %r13d
cmpl $0x64, %r8d
ja 0xe2f09
movq %rdi, %rbp
testq %rdi, %rdi
sete %dil
testl %r12d, %r12d
setle %dl
testl %r14d, %r14d
setle %sil
orb %dl, %sil
orb %dil, %sil
jne 0xe2f09
leal (%rax,%rax), %esi
leal -0x1(%r12), %edx
shrl %edx
cmpl %r12d, %esi
cmovll %eax, %edx
leal (%rdx,%rdx), %eax
leal -0x1(%r14), %esi
movl %esi, 0x54(%rsp)
movl %esi, %ebx
shrl %ebx
cmpl %r14d, %eax
cmovll %edx, %ebx
pushq $0x1
popq %rax
testl %ebx, %ebx
jle 0xe2f06
movl %ecx, 0x10(%rsp)
leal 0x2(,%rbx,2), %ecx
leal (%r12,%r12), %eax
movl %eax, 0x4(%rsp)
imull %eax, %ecx
movl %r12d, %r15d
movq %rcx, 0x8(%rsp)
leaq (%rcx,%r15,2), %rsi
addq $0xffe, %rsi            # imm = 0xFFE
pushq $0x1
popq %rdi
callq 0x57c90
testq %rax, %rax
je 0xe2f09
movl %ebx, %ecx
negl %ecx
movl %ecx, (%rsp)
movq %rbx, 0x58(%rsp)
leal (%rbx,%rbx), %ecx
leaq (%r15,%r15), %rdx
movq %rcx, 0x68(%rsp)
movq %rbp, 0x28(%rsp)
movl %ecx, %ebp
orl $0x1, %ebp
movl %ebp, %ecx
movq %r12, 0x70(%rsp)
imull %r12d, %ecx
movq %rax, 0x18(%rsp)
leaq (%rax,%rcx,2), %r13
movq %r13, %r12
subq %rdx, %r12
xorl %ebx, %ebx
movq %r12, %rdi
xorl %esi, %esi
movq %rdx, 0x30(%rsp)
callq 0x56ff0
imull %ebp, %ebp
movl %ebp, 0x38(%rsp)
movq 0x28(%rsp), %rbp
leaq 0x80(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x56ff0
movslq 0x10(%rsp), %rax
movq %rax, 0x48(%rsp)
movl $0xff, %edi
xorl %ecx, %ecx
movl $0xff, %edx
movl $0xff, %r9d
xorl %eax, %eax
movq %rbp, %rsi
xorl %r8d, %r8d
cmpl %r14d, %r8d
je 0xe2bb1
xorl %r10d, %r10d
cmpq %r10, %r15
je 0xe2ba7
movzbl (%rsi,%r10), %eax
cmpl %eax, %edx
cmovgl %eax, %edi
cmovgel %eax, %edx
cmpl %eax, %ecx
cmovll %eax, %ebx
cmovlel %eax, %ecx
movb $0x1, 0x80(%rsp,%rax)
incq %r10
movl %edx, %r9d
movl %ecx, %eax
jmp 0xe2b7b
addq 0x48(%rsp), %rsi
incl %r8d
jmp 0xe2b73
movq 0x18(%rsp), %r10
movq 0x8(%rsp), %rcx
addq %r10, %rcx
movq %rcx, 0x20(%rsp)
subl %r9d, %eax
pushq $-0x1
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
cmpq $0x100, %rcx            # imm = 0x100
je 0xe2bfa
cmpb $0x0, 0x80(%rsp,%rcx)
je 0xe2bf5
incl %esi
testl %edx, %edx
js 0xe2bf3
movl %ecx, %r8d
subl %edx, %r8d
cmpl %eax, %r8d
cmovll %r8d, %eax
movl %ecx, %edx
incq %rcx
jmp 0xe2bcd
movq %r14, 0x78(%rsp)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rdx
leaq (%rcx,%rdx), %r9
addq %rdx, %rcx
addq $0x7fe, %rcx            # imm = 0x7FE
movq %rcx, 0x60(%rsp)
leal (,%rax,4), %ecx
imull $0xc, %eax, %r8d
sarl $0x2, %r8d
movslq %r8d, %r11
movslq %ecx, %r14
movq %r14, 0x10(%rsp)
subl %r8d, %ecx
movl %ecx, 0x40(%rsp)
addq 0x8(%rsp), %rdx
leaq (%r10,%rdx), %rbp
addq $0x7fc, %rbp            # imm = 0x7FC
leal -0x1(,%rax,4), %ecx
imull %r11d, %ecx
xorl %r14d, %r14d
cmpq $0x3ff, %r14            # imm = 0x3FF
je 0xe2ca0
leaq 0x1(%r14), %r10
cmpq %r11, %r10
jle 0xe2c7f
xorl %eax, %eax
cmpq 0x10(%rsp), %r10
jge 0xe2c82
movl %ecx, %eax
cltd
idivl 0x40(%rsp)
jmp 0xe2c82
movl %r10d, %eax
shrl $0x2, %eax
movw %ax, 0x800(%r9,%r14,2)
negl %eax
movw %ax, (%rbp)
addq $-0x2, %rbp
subl %r8d, %ecx
movq %r10, %r14
jmp 0xe2c5b
movl $0x40000, %eax          # imm = 0x40000
xorl %edx, %edx
divl 0x38(%rsp)
movq 0x60(%rsp), %rcx
andw $0x0, (%rcx)
cmpl $0x3, %esi
jl 0xe2ef6
movq 0x58(%rsp), %rsi
movl %esi, %ecx
movq 0x70(%rsp), %r9
movl %r9d, %edx
subl %esi, %edx
movslq %edx, %rdx
movq %rdx, 0x38(%rsp)
leaq 0x1(%rcx), %rdx
movq 0x68(%rsp), %r11
leal 0x1(%r11), %r8d
imull %r9d, %r8d
movq 0x18(%rsp), %r9
leaq (%r9,%r8,2), %r10
addq %r8, %r8
leaq (%r8,%rcx,2), %rsi
addq %r9, %rsi
movq %rsi, 0x30(%rsp)
movq 0x8(%rsp), %rsi
leaq (%rsi,%rcx,2), %rsi
addq %r9, %rsi
addq $0x2, %rsi
leaq (%r8,%rcx,4), %rcx
addq %r9, %rcx
addq $0x2, %rcx
movq %rcx, 0x10(%rsp)
movl 0x4(%rsp), %ecx
subl %r11d, %ecx
addl $-0x3, %ecx
movl %ecx, 0x4(%rsp)
movq 0x28(%rsp), %r14
movl (%rsp), %ecx
movl %ecx, (%rsp)
cmpl 0x78(%rsp), %ecx
je 0xe2ef6
movq %r9, %rbp
xorl %r8d, %r8d
xorl %ecx, %ecx
cmpq %r8, %r15
je 0xe2d7e
movq 0x28(%rsp), %r9
movzbl (%r9,%r8), %r9d
addl %r9d, %ecx
movzwl (%r12,%r8,2), %r11d
addw %cx, %r11w
movl %r11d, %r9d
subw (%rbp,%r8,2), %r9w
movw %r9w, (%r10,%r8,2)
movw %r11w, (%rbp,%r8,2)
incq %r8
jmp 0xe2d4a
leaq (,%r15,2), %r9
addq %rbp, %r9
cmpq %r13, %r9
cmoveq 0x18(%rsp), %r9
movl (%rsp), %ecx
cmpl 0x54(%rsp), %ecx
movl $0x0, %r11d
cmovlq 0x48(%rsp), %r11
testl %ecx, %ecx
movl $0x0, %r8d
cmovsq %r8, %r11
movq %r11, 0x40(%rsp)
cmpl 0x58(%rsp), %ecx
jl 0xe2ee2
movq %r9, 0x8(%rsp)
movq 0x30(%rsp), %r12
movq %r12, %r8
xorl %ecx, %ecx
movq 0x20(%rsp), %r11
cmpq %rcx, %rdx
je 0xe2dfd
movzwl (%r8), %r9d
addw -0x2(%r12,%rcx,2), %r9w
movzwl %r9w, %r9d
imull %eax, %r9d
shrl $0x10, %r9d
movw %r9w, (%r11,%rcx,2)
incq %rcx
addq $-0x2, %r8
jmp 0xe2dd4
movl 0x4(%rsp), %ecx
movl %ecx, %r12d
xorl %r8d, %r8d
movq 0x38(%rsp), %r11
leaq (%rdx,%r8), %rcx
cmpq %r11, %rcx
jge 0xe2e6f
movq 0x10(%rsp), %rcx
movzwl (%rcx,%r8,2), %ecx
movslq %r8d, %r9
subw (%r13,%r9,2), %cx
movzwl %cx, %ecx
imull %eax, %ecx
shrl $0x10, %ecx
movw %cx, (%rsi,%r8,2)
incq %r8
decl %r12d
jmp 0xe2e0c
movzwl -0x2(%r13,%r15,2), %ecx
movslq %r12d, %r12
movzwl (%r13,%r12,2), %r9d
movslq %r8d, %r11
addw (%r13,%r11,2), %r9w
addl %ecx, %ecx
subl %r9d, %ecx
movzwl %cx, %ecx
imull %eax, %ecx
shrl $0x10, %ecx
movw %cx, (%rsi,%r8,2)
incq %r8
decl %r12d
leaq (%rdx,%r8), %rcx
cmpq %r15, %rcx
jb 0xe2e3e
xorl %r8d, %r8d
movq 0x20(%rsp), %r9
cmpq %r8, %r15
je 0xe2ed5
movzbl (%r14,%r8), %ecx
cmpl %ecx, %ebx
jle 0xe2ed0
cmpl %ecx, %edi
jge 0xe2ed0
movzwl (%r9,%r8,2), %r9d
leal (,%rcx,4), %r11d
subq %r11, %r9
movq 0x60(%rsp), %r11
movswl (%r11,%r9,2), %r12d
addl %ecx, %r12d
testl %r12d, %r12d
jg 0xe2eb7
xorl %r12d, %r12d
movl $0xff, %ecx
cmpl %ecx, %r12d
jl 0xe2ec7
movl $0xff, %r12d
movb %r12b, (%r14,%r8)
movq 0x20(%rsp), %r9
incq %r8
jmp 0xe2e80
addq 0x48(%rsp), %r14
movl (%rsp), %ecx
movq 0x8(%rsp), %r9
movq 0x40(%rsp), %r8
addq %r8, 0x28(%rsp)
incl %ecx
movq %rbp, %r12
jmp 0xe2d35
movq 0x18(%rsp), %rdi
callq 0x58480
pushq $0x1
popq %r13
jmp 0xe2f09
movl %eax, %r13d
movl %r13d, %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq