// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x13ee81
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0x13ee81
movq -0x10(%rbp), %rdi
movl $0x6, %esi
leaq 0x7db75(%rip), %rdx     # 0x1bc9e3
callq 0x142580
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x13efe1
movq -0x18(%rbp), %rax
cmpl $0x0, 0x70(%rax)
je 0x13ee99
movq -0x10(%rbp), %rax
movl $0x0, 0xb68(%rax)
movq -0x10(%rbp), %rax
movslq 0xb68(%rax), %rcx
leaq 0x7de31(%rip), %rax     # 0x1bccdc
movzbl (%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, 0xb68(%rax)
jne 0x13eedd
movq -0x10(%rbp), %rax
movl $0x0, 0x1a0(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x1a4(%rax)
jmp 0x13ef46
movq -0x18(%rbp), %rax
movl 0x78(%rax), %ecx
subl -0x1c(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1a0(%rax)
movq -0x18(%rbp), %rax
movl 0x80(%rax), %ecx
subl -0x1c(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1a4(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1a0(%rax)
jge 0x13ef29
movq -0x10(%rbp), %rax
movl $0x0, 0x1a0(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1a4(%rax)
jge 0x13ef44
movq -0x10(%rbp), %rax
movl $0x0, 0x1a4(%rax)
jmp 0x13ef46
movq -0x18(%rbp), %rax
movl 0x84(%rax), %ecx
addl $0xf, %ecx
addl -0x1c(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1ac(%rax)
movq -0x18(%rbp), %rax
movl 0x7c(%rax), %ecx
addl $0xf, %ecx
addl -0x1c(%rbp), %ecx
sarl $0x4, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1a8(%rax)
movq -0x10(%rbp), %rax
movl 0x1a8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x198(%rcx), %eax
jle 0x13efa7
movq -0x10(%rbp), %rax
movl 0x198(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1a8(%rax)
movq -0x10(%rbp), %rax
movl 0x1ac(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x19c(%rcx), %eax
jle 0x13efd1
movq -0x10(%rbp), %rax
movl 0x19c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1ac(%rax)
movq -0x10(%rbp), %rdi
callq 0x13eff0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)