// File: /workspace/github_c_makefile_star2_O3/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 $0x1c8, %rsp            # imm = 0x1C8
xorl %r13d, %r13d
cmpl $0x64, %r8d
ja 0xf2eef
movl %edx, %r12d
movl %esi, %ebx
movq %rdi, %r15
testq %rdi, %rdi
sete %al
testl %esi, %esi
setle %sil
testl %edx, %edx
setle %dl
orb %sil, %dl
orb %al, %dl
jne 0xf2eef
movslq %r8d, %rax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x23, %rax
addl %edx, %eax
leal (%rax,%rax), %esi
leal -0x1(%rbx), %edx
shrl %edx
cmpl %ebx, %esi
cmovll %eax, %edx
leal (%rdx,%rdx), %eax
leal -0x1(%r12), %esi
movl %esi, 0x74(%rsp)
movl %esi, %ebp
shrl %ebp
cmpl %r12d, %eax
cmovll %edx, %ebp
testl %ebp, %ebp
jle 0xf2ee9
movl %ecx, 0x10(%rsp)
leal 0x2(,%rbp,2), %ecx
leal (%rbx,%rbx), %eax
movl %eax, 0x1c(%rsp)
imull %eax, %ecx
movl %ebx, %r14d
movq %rcx, 0x8(%rsp)
leaq (%rcx,%r14,2), %rsi
addq $0xffe, %rsi            # imm = 0xFFE
movl $0x1, %edi
callq 0x56b20
testq %rax, %rax
je 0xf2eef
movl %ebp, %ecx
negl %ecx
movl %ecx, 0x4(%rsp)
movq %rbp, 0x50(%rsp)
leal (,%rbp,2), %ecx
leaq (%r14,%r14), %rdx
movq %rcx, 0x38(%rsp)
movl %ecx, %r13d
orl $0x1, %r13d
movl %r13d, %ecx
movq %rbx, 0x78(%rsp)
imull %ebx, %ecx
leaq (%rax,%rcx,2), %rbp
movq %r15, 0x28(%rsp)
movq %rbp, 0x60(%rsp)
subq %rdx, %rbp
xorl %ebx, %ebx
movq %rax, %r15
movq %rbp, %rdi
xorl %esi, %esi
movq %rdx, 0x48(%rsp)
callq 0x55f20
movq %r15, 0x30(%rsp)
movq 0x8(%rsp), %rax
addq %r15, %rax
movq %rax, 0x20(%rsp)
imull %r13d, %r13d
movl %r13d, 0x58(%rsp)
leaq 0xc0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x55f20
movslq 0x10(%rsp), %r13
movl $0xff, %edi
xorl %eax, %eax
movl $0xff, %ecx
xorl %edx, %edx
movq 0x28(%rsp), %rsi
xorl %r8d, %r8d
movl %eax, %r9d
movl %ecx, %r10d
movzbl (%rsi,%r8), %r11d
cmpl %r11d, %r10d
cmovgl %r11d, %edi
cmovgl %r11d, %ecx
cmovgel %r11d, %r10d
cmpl %r11d, %r9d
cmovll %r11d, %ebx
cmovll %r11d, %eax
cmovlel %r11d, %r9d
movb $0x1, 0xc0(%rsp,%r11)
incq %r8
cmpq %r8, %r14
jne 0xf2a93
addq %r13, %rsi
incl %edx
cmpl %r12d, %edx
jne 0xf2a8a
movq 0x20(%rsp), %rdx
movq 0x48(%rsp), %r15
leaq (%rdx,%r15), %r8
subl %ecx, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %esi, %esi
xorl %ecx, %ecx
movq 0x8(%rsp), %r11
cmpb $0x0, 0xc0(%rsp,%rcx)
je 0xf2b0e
incl %esi
testl %edx, %edx
js 0xf2b0c
movl %ecx, %r9d
subl %edx, %r9d
cmpl %eax, %r9d
cmovll %r9d, %eax
movl %ecx, %edx
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0xf2aef
movq %rsi, 0x40(%rsp)
movq %r13, 0x88(%rsp)
leaq 0x7fe(%r8), %rcx
movq %rcx, 0x80(%rsp)
leal (,%rax,4), %ecx
leal (%rcx,%rcx,2), %r10d
sarl $0x2, %r10d
movslq %ecx, %rdx
subl %r10d, %ecx
movq %rcx, 0x10(%rsp)
movslq %r10d, %r13
addq %r11, %r15
movq 0x30(%rsp), %rcx
addq %rcx, %r15
addq $0x7fc, %r15            # imm = 0x7FC
leal -0x1(,%rax,4), %ecx
imull %r13d, %ecx
xorl %r9d, %r9d
movq %r9, %r11
incq %r9
cmpq %r13, %r9
jle 0xf2ba0
xorl %eax, %eax
cmpq %rdx, %r9
jge 0xf2ba3
movl %ecx, %eax
movq %r8, %rsi
movq %r12, %r8
movq %rdx, %r12
cltd
idivl 0x10(%rsp)
movq %r12, %rdx
movq %r8, %r12
movq %rsi, %r8
jmp 0xf2ba3
movl %r9d, %eax
shrl $0x2, %eax
movw %ax, 0x800(%r8,%r11,2)
negl %eax
movw %ax, (%r15)
addq $-0x2, %r15
subl %r10d, %ecx
cmpq $0x3ff, %r9             # imm = 0x3FF
jne 0xf2b73
movl $0x40000, %eax          # imm = 0x40000
xorl %edx, %edx
divl 0x58(%rsp)
movl %eax, 0x48(%rsp)
movq 0x80(%rsp), %rax
movw $0x0, (%rax)
cmpl $0x3, 0x40(%rsp)
movq 0x50(%rsp), %r10
movq 0x20(%rsp), %rax
jl 0xf2edf
cmpl %r12d, 0x4(%rsp)
jge 0xf2edf
movl %r10d, %ecx
leal 0x1(%r10), %esi
movq 0x78(%rsp), %rdx
movl %edx, %r8d
subl %r10d, %r8d
movq %rsi, 0x40(%rsp)
movslq %esi, %r9
movl %r8d, 0x70(%rsp)
movslq %r8d, %rsi
movq %rsi, 0xa8(%rsp)
movq 0x38(%rsp), %rsi
incl %esi
imull %edx, %esi
movq 0x30(%rsp), %rdx
leaq (%rdx,%rsi,2), %r11
addq %rsi, %rsi
leaq (%rsi,%rcx,2), %rcx
leaq (%rdx,%rcx), %rsi
movq %rsi, 0x38(%rsp)
movq 0x8(%rsp), %rsi
leaq (%rsi,%r9,2), %rsi
addq %rdx, %rsi
movq %rsi, 0xa0(%rsp)
movq %r9, 0xb0(%rsp)
leaq (%rcx,%r9,2), %r8
addq %rdx, %r8
addl $-0x2, 0x1c(%rsp)
movl %r10d, %ecx
notl %ecx
movl %ecx, 0x6c(%rsp)
movq %rdx, %rsi
movq 0x28(%rsp), %r15
movq %r12, 0xb8(%rsp)
movq %r8, 0x98(%rsp)
movq %r11, 0x90(%rsp)
movq %rsi, %r13
xorl %ecx, %ecx
xorl %esi, %esi
movzbl (%r15,%rcx), %r8d
addl %r8d, %esi
movzwl (%rbp,%rcx,2), %r8d
addw %si, %r8w
movl %r8d, %r9d
subw (%r13,%rcx,2), %r9w
movw %r9w, (%r11,%rcx,2)
movw %r8w, (%r13,%rcx,2)
incq %rcx
cmpq %rcx, %r14
jne 0xf2ca6
leaq (,%r14,2), %rsi
addq %r13, %rsi
movq 0x60(%rsp), %r8
cmpq %r8, %rsi
cmoveq 0x30(%rsp), %rsi
movl 0x4(%rsp), %ecx
cmpl 0x74(%rsp), %ecx
movl $0x0, %r9d
cmovlq 0x88(%rsp), %r9
testl %ecx, %ecx
movl $0x0, %edx
cmovsq %rdx, %r9
cmpl %r10d, %ecx
jl 0xf2ec6
movq %r9, 0x58(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x38(%rsp), %rbp
movq %rbp, %rcx
xorl %esi, %esi
movl 0x48(%rsp), %r9d
movq 0x40(%rsp), %r10
movzwl (%rcx), %r8d
addw -0x2(%rbp,%rsi,2), %r8w
movzwl %r8w, %r8d
imull %r9d, %r8d
shrl $0x10, %r8d
movw %r8w, (%rax,%rsi,2)
incq %rsi
addq $-0x2, %rcx
cmpq %rsi, %r10
jne 0xf2d36
movl %r10d, %ecx
cmpl 0x70(%rsp), %r10d
jge 0xf2dc3
xorl %ecx, %ecx
movq 0xb0(%rsp), %rax
movq 0xa8(%rsp), %r12
movq 0xa0(%rsp), %rbp
movq 0x98(%rsp), %rdx
movq 0x60(%rsp), %r11
movzwl (%rdx,%rcx,2), %esi
movslq %ecx, %r8
subw (%r11,%r8,2), %si
movzwl %si, %esi
imull %r9d, %esi
shrl $0x10, %esi
movw %si, (%rbp,%rcx,2)
leaq (%rax,%rcx), %rsi
incq %rsi
incq %rcx
cmpq %r12, %rsi
jl 0xf2d8e
addl %r10d, %ecx
movq 0x90(%rsp), %r11
cmpl 0x78(%rsp), %ecx
movq 0x60(%rsp), %rbp
jge 0xf2e46
movl %r9d, %r10d
movslq %ecx, %rsi
movq %r14, %r9
subq %rsi, %r9
movq 0x20(%rsp), %rax
leaq (%rax,%rsi,2), %rax
movq %rax, 0x10(%rsp)
movq 0x50(%rsp), %rdx
leal (%rdx,%rcx), %r8d
movl 0x1c(%rsp), %edx
movl %edx, %esi
subl %r8d, %esi
addl 0x6c(%rsp), %ecx
xorl %r8d, %r8d
movl %r10d, %eax
movzwl -0x2(%rbp,%r14,2), %r10d
addl %r10d, %r10d
movslq %esi, %rsi
movzwl (%rbp,%rsi,2), %edx
leal (%rcx,%r8), %r12d
movslq %r12d, %r12
addw (%rbp,%r12,2), %dx
subl %edx, %r10d
movzwl %r10w, %edx
movl %eax, %r10d
imull %eax, %edx
shrl $0x10, %edx
movq 0x10(%rsp), %rax
movw %dx, (%rax,%r8,2)
incq %r8
decl %esi
cmpq %r8, %r9
jne 0xf2e01
xorl %ecx, %ecx
movq 0xb8(%rsp), %r12
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %rax
movq 0x80(%rsp), %r10
movzbl (%r9,%rcx), %esi
cmpl %esi, %ebx
jle 0xf2ea2
cmpl %esi, %edi
jge 0xf2ea2
movzwl (%rax,%rcx,2), %edx
leal (,%rsi,4), %r8d
subq %r8, %rdx
movswl (%r10,%rdx,2), %r8d
addl %esi, %r8d
testl %r8d, %r8d
jg 0xf2e8e
xorl %r8d, %r8d
movl $0xff, %edx
cmpl %edx, %r8d
jl 0xf2e9e
movl $0xff, %r8d
movb %r8b, (%r9,%rcx)
incq %rcx
cmpq %rcx, %r14
jne 0xf2e62
addq 0x88(%rsp), %r9
movq %r9, 0x28(%rsp)
movq 0x50(%rsp), %r10
movq 0x8(%rsp), %rsi
movq 0x58(%rsp), %r9
addq %r9, %r15
movl 0x4(%rsp), %ecx
incl %ecx
movq %r13, %rbp
movl %ecx, 0x4(%rsp)
cmpl %r12d, %ecx
jne 0xf2c9f
movq 0x30(%rsp), %rdi
callq 0x57290
movl $0x1, %r13d
movl %r13d, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq