// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/frame_dec.c
// Function: VP8InitDithering
void VP8InitDithering(const WebPDecoderOptions* const options,
                      VP8Decoder* const dec) {
  assert(dec != NULL);
  if (options != NULL) {
    const int d = options->dithering_strength;
    const int max_amp = (1 << VP8_RANDOM_DITHER_FIX) - 1;
    const int f = (d < 0) ? 0 : (d > 100) ? max_amp : (d * max_amp / 100);
    if (f > 0) {
      int s;
      int all_amp = 0;
      for (s = 0; s < NUM_MB_SEGMENTS; ++s) {
        VP8QuantMatrix* const dqm = &dec->dqm_[s];
        if (dqm->uv_quant_ < DITHER_AMP_TAB_SIZE) {
          const int idx = (dqm->uv_quant_ < 0) ? 0 : dqm->uv_quant_;
          dqm->dither_ = (f * kQuantToDitherAmp[idx]) >> 3;
        }
        all_amp |= dqm->dither_;
      }
      if (all_amp != 0) {
        VP8InitRandom(&dec->dithering_rg_, 1.0f);
        dec->dither_ = 1;
      }
    }
    // potentially allow alpha dithering
    dec->alpha_dithering_ = options->alpha_dithering_strength;
    if (dec->alpha_dithering_ > 100) {
      dec->alpha_dithering_ = 100;
    } else if (dec->alpha_dithering_ < 0) {
      dec->alpha_dithering_ = 0;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x13de69
jmp 0x13de88
leaq 0x7f66d(%rip), %rdi     # 0x1bd4dd
leaq 0x7eac5(%rip), %rsi     # 0x1bc93c
movl $0x14a, %edx            # imm = 0x14A
leaq 0x7eacd(%rip), %rcx     # 0x1bc950
callq 0x598a0
cmpq $0x0, -0x8(%rbp)
je 0x13dff6
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x14(%rbp)
movl $0xff, -0x18(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x13deb1
xorl %eax, %eax
movl %eax, -0x38(%rbp)
jmp 0x13ded9
cmpl $0x64, -0x14(%rbp)
jle 0x13dec1
movl $0xff, %eax
movl %eax, -0x3c(%rbp)
jmp 0x13ded3
imull $0xff, -0x14(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x13dfa9
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x4, -0x20(%rbp)
jge 0x13df7b
movq -0x10(%rbp), %rax
addq $0x424, %rax            # imm = 0x424
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xc, 0x18(%rax)
jge 0x13df60
movq -0x30(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jge 0x13df31
xorl %eax, %eax
movl %eax, -0x40(%rbp)
jmp 0x13df3b
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x1c(%rbp), %ecx
movslq -0x34(%rbp), %rdx
leaq 0x7ed81(%rip), %rax     # 0x1bccd0
movzbl (%rax,%rdx), %eax
imull %eax, %ecx
sarl $0x3, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %eax
orl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x13def7
cmpl $0x0, -0x24(%rbp)
je 0x13dfa7
movq -0x10(%rbp), %rdi
addq $0x33c, %rdi            # imm = 0x33C
movss 0x7e9a4(%rip), %xmm0    # 0x1bc938
callq 0x1843e0
movq -0x10(%rbp), %rax
movl $0x1, 0x338(%rax)
jmp 0x13dfa9
movq -0x8(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xbc8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x64, 0xbc8(%rax)
jle 0x13dfd7
movq -0x10(%rbp), %rax
movl $0x64, 0xbc8(%rax)
jmp 0x13dff4
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc8(%rax)
jge 0x13dff2
movq -0x10(%rbp), %rax
movl $0x0, 0xbc8(%rax)
jmp 0x13dff4
jmp 0x13dff6
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)