// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/libraries/libwebp/src/dec/frame_dec.c
// Function: VP8EnterCritical
VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) {
  // Call setup() first. This may trigger additional decoding features on 'io'.
  // Note: Afterward, we must call teardown() no matter what.
  if (io->setup != NULL && !io->setup(io)) {
    VP8SetError(dec, VP8_STATUS_USER_ABORT, "Frame setup failed");
    return dec->status_;
  }

  // Disable filtering per user request
  if (io->bypass_filtering) {
    dec->filter_type_ = 0;
  }

  // Define the area where we can skip in-loop filtering, in case of cropping.
  //
  // 'Simple' filter reads two luma samples outside of the macroblock
  // and filters one. It doesn't filter the chroma samples. Hence, we can
  // avoid doing the in-loop filtering before crop_top/crop_left position.
  // For the 'Complex' filter, 3 samples are read and up to 3 are filtered.
  // Means: there's a dependency chain that goes all the way up to the
  // top-left corner of the picture (MB #0). We must filter all the previous
  // macroblocks.
  {
    const int extra_pixels = kFilterExtraRows[dec->filter_type_];
    if (dec->filter_type_ == 2) {
      // For complex filter, we need to preserve the dependency chain.
      dec->tl_mb_x_ = 0;
      dec->tl_mb_y_ = 0;
    } else {
      // For simple filter, we can filter only the cropped region.
      // We include 'extra_pixels' on the other side of the boundary, since
      // vertical or horizontal filtering of the previous macroblock can
      // modify some abutting pixels.
      dec->tl_mb_x_ = (io->crop_left - extra_pixels) >> 4;
      dec->tl_mb_y_ = (io->crop_top - extra_pixels) >> 4;
      if (dec->tl_mb_x_ < 0) dec->tl_mb_x_ = 0;
      if (dec->tl_mb_y_ < 0) dec->tl_mb_y_ = 0;
    }
    // We need some 'extra' pixels on the right/bottom.
    dec->br_mb_y_ = (io->crop_bottom + 15 + extra_pixels) >> 4;
    dec->br_mb_x_ = (io->crop_right + 15 + extra_pixels) >> 4;
    if (dec->br_mb_x_ > dec->mb_w_) {
      dec->br_mb_x_ = dec->mb_w_;
    }
    if (dec->br_mb_y_ > dec->mb_h_) {
      dec->br_mb_y_ = dec->mb_h_;
    }
  }
  PrecomputeFilterStrengths(dec);
  return VP8_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x48(%rsi), %rax
testq %rax, %rax
je 0xd0b27
movq %r14, %rdi
callq *%rax
testl %eax, %eax
je 0xd0cd2
cmpl $0x0, 0x70(%r14)
je 0xd0b38
movl $0x0, 0xb68(%rbx)
movslq 0xb68(%rbx), %rax
leaq 0x59176(%rip), %rcx     # 0x129cbc
movzbl (%rax,%rcx), %ecx
cmpq $0x2, %rax
jne 0xd0b5c
movl $0x0, 0x1a0(%rbx)
jmp 0xd0b8f
movl 0x78(%r14), %esi
subl %ecx, %esi
sarl $0x4, %esi
movl %esi, 0x1a0(%rbx)
movl 0x80(%r14), %edx
subl %ecx, %edx
sarl $0x4, %edx
movl %edx, 0x1a4(%rbx)
testl %esi, %esi
jns 0xd0b8b
movl $0x0, 0x1a0(%rbx)
testl %edx, %edx
jns 0xd0b9c
leaq 0x1a4(%rbx), %rdx
movl $0x0, (%rdx)
addl $0xf, %ecx
movl 0x84(%r14), %esi
addl %ecx, %esi
sarl $0x4, %esi
movl %esi, 0x1ac(%rbx)
addl 0x7c(%r14), %ecx
sarl $0x4, %ecx
movl 0x198(%rbx), %edi
movl 0x19c(%rbx), %edx
cmpl %edi, %ecx
cmovgel %edi, %ecx
movl %ecx, 0x1a8(%rbx)
cmpl %edx, %esi
jle 0xd0bd9
movl %edx, 0x1ac(%rbx)
testl %eax, %eax
jle 0xd0cce
movl 0x60(%rbx), %eax
movl 0x84(%rbx), %edx
leaq 0xb6c(%rbx), %rsi
xorl %edi, %edi
movl $0x2, %r8d
testl %edx, %edx
je 0xd0c15
movsbl 0x94(%rbx,%rdi), %r9d
cmpl $0x0, 0x8c(%rbx)
jne 0xd0c19
addl 0x58(%rbx), %r9d
jmp 0xd0c19
movl 0x58(%rbx), %r9d
xorl %r10d, %r10d
movl %r9d, %r11d
testl %eax, %eax
je 0xd0c33
movl 0x64(%rbx), %r11d
addl %r9d, %r11d
testq %r10, %r10
je 0xd0c33
addl 0x74(%rbx), %r11d
cmpl $0x3f, %r11d
movl $0x3f, %r14d
cmovll %r11d, %r14d
testl %r14d, %r14d
jg 0xd0c49
xorl %r14d, %r14d
testl %r11d, %r11d
jle 0xd0ca6
movl 0x5c(%rbx), %ebp
movl %r14d, %r15d
testl %ebp, %ebp
jle 0xd0c75
cmpl $0x5, %ebp
setge %cl
incb %cl
movl %r14d, %r15d
shrl %cl, %r15d
movl $0x9, %ecx
subl %ebp, %ecx
cmpl %ecx, %r15d
jl 0xd0c75
movl %ecx, %r15d
cmpl $0x2, %r15d
jge 0xd0c81
movl $0x1, %r15d
movb %r15b, 0x1(%rsi,%r10,4)
leal (%r15,%r14,2), %ecx
movb %cl, (%rsi,%r10,4)
xorl %ecx, %ecx
cmpl $0xf, %r11d
setge %cl
cmpl $0x28, %r11d
cmovgel %r8d, %ecx
movb %cl, 0x3(%rsi,%r10,4)
jmp 0xd0cab
movb $0x0, (%rsi,%r10,4)
movb %r10b, 0x2(%rsi,%r10,4)
incq %r10
cmpq $0x1, %r10
je 0xd0c1c
incq %rdi
addq $0x8, %rsi
cmpq $0x4, %rdi
jne 0xd0bf9
xorl %eax, %eax
jmp 0xd0ce8
leaq 0x5908d(%rip), %rdx     # 0x129d66
movq %rbx, %rdi
movl $0x6, %esi
callq 0xd2755
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq