// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x48(%rsi), %rax
testq %rax, %rax
je 0xcfbf4
movq %r14, %rdi
callq *%rax
testl %eax, %eax
je 0xcfdc4
cmpl $0x0, 0x70(%r14)
je 0xcfc0b
movl $0x0, 0xb68(%rbx)
xorl %ecx, %ecx
xorl %eax, %eax
jmp 0xcfc3b
movslq 0xb68(%rbx), %rax
leaq 0x592d3(%rip), %rcx     # 0x128eec
movzbl (%rax,%rcx), %ecx
cmpq $0x2, %rax
jne 0xcfc3b
movl $0x0, 0x1a0(%rbx)
leaq 0x1a4(%rbx), %rdx
movl $0x2, %eax
jmp 0xcfc75
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 0xcfc6a
movl $0x0, 0x1a0(%rbx)
testl %edx, %edx
jns 0xcfc7b
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 0xcfcb8
movl %edx, 0x1ac(%rbx)
testl %eax, %eax
jle 0xcfdc0
movl 0x60(%rbx), %edx
movl 0x84(%rbx), %eax
movl %eax, 0x4(%rsp)
leaq 0xb6c(%rbx), %rdi
xorl %r8d, %r8d
movl $0x2, %r9d
cmpl $0x0, 0x4(%rsp)
je 0xcfcfc
movsbl 0x94(%rbx,%r8), %r10d
cmpl $0x0, 0x8c(%rbx)
jne 0xcfd00
addl 0x58(%rbx), %r10d
jmp 0xcfd00
movl 0x58(%rbx), %r10d
movb $0x1, %r11b
leaq (%rdi,%r8,8), %r14
xorl %r15d, %r15d
movl %r10d, %eax
testl %edx, %edx
je 0xcfd20
movl 0x64(%rbx), %eax
addl %r10d, %eax
testb $0x1, %r11b
jne 0xcfd20
addl 0x74(%rbx), %eax
cmpl $0x3f, %eax
movl $0x3f, %r13d
cmovll %eax, %r13d
testl %r13d, %r13d
jg 0xcfd35
xorl %r13d, %r13d
leaq (%r14,%r15,4), %r12
testl %eax, %eax
jle 0xcfd8f
movl 0x5c(%rbx), %esi
movl %r13d, %ebp
testl %esi, %esi
jle 0xcfd61
cmpl $0x5, %esi
movb $0x1, %cl
sbbb $-0x1, %cl
movl %r13d, %ebp
shrl %cl, %ebp
movl $0x9, %ecx
subl %esi, %ecx
cmpl %ecx, %ebp
jl 0xcfd61
movl %ecx, %ebp
cmpl $0x2, %ebp
jge 0xcfd6b
movl $0x1, %ebp
movb %bpl, 0x1(%r12)
leal (%rbp,%r13,2), %ecx
movb %cl, (%r12)
xorl %ecx, %ecx
cmpl $0xf, %eax
setae %cl
cmpl $0x28, %eax
cmovael %r9d, %ecx
movb %cl, 0x3(%r12)
jmp 0xcfd94
movb $0x0, (%r12)
movb %r15b, 0x2(%r12)
movl $0x1, %r15d
xorl %eax, %eax
testb $0x1, %r11b
movl $0x0, %r11d
jne 0xcfd0a
incq %r8
cmpq $0x4, %r8
jne 0xcfcdd
jmp 0xcfdda
xorl %eax, %eax
jmp 0xcfdda
leaq 0x591cb(%rip), %rdx     # 0x128f96
movq %rbx, %rdi
movl $0x6, %esi
callq 0xd18d5
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq