// File: /workspace/github_c_makefile_star2_O2/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 0xc8c55
movq %r14, %rdi
callq *%rax
testl %eax, %eax
je 0xc8e15
cmpl $0x0, 0x70(%r14)
pushq $0x2
popq %rdx
je 0xc8c6c
andl $0x0, 0xb68(%rbx)
xorl %ecx, %ecx
xorl %eax, %eax
jmp 0xc8c96
movslq 0xb68(%rbx), %rax
leaq 0x4ff92(%rip), %rcx     # 0x118c0c
movzbl (%rax,%rcx), %ecx
cmpq $0x2, %rax
jne 0xc8c96
andl $0x0, 0x1a0(%rbx)
leaq 0x1a4(%rbx), %rsi
movl %edx, %eax
jmp 0xc8ccd
movl 0x78(%r14), %edi
subl %ecx, %edi
sarl $0x4, %edi
movl %edi, 0x1a0(%rbx)
movl 0x80(%r14), %esi
subl %ecx, %esi
sarl $0x4, %esi
movl %esi, 0x1a4(%rbx)
testl %edi, %edi
jns 0xc8cc2
andl $0x0, 0x1a0(%rbx)
testl %esi, %esi
jns 0xc8cd0
leaq 0x1a4(%rbx), %rsi
andl $0x0, (%rsi)
addl $0xf, %ecx
movl 0x84(%r14), %edi
addl %ecx, %edi
sarl $0x4, %edi
movl %edi, 0x1ac(%rbx)
addl 0x7c(%r14), %ecx
sarl $0x4, %ecx
movl 0x198(%rbx), %r8d
movl 0x19c(%rbx), %esi
cmpl %r8d, %ecx
cmovgel %r8d, %ecx
movl %ecx, 0x1a8(%rbx)
cmpl %esi, %edi
jle 0xc8d10
movl %esi, 0x1ac(%rbx)
testl %eax, %eax
jle 0xc8e11
movl 0x60(%rbx), %esi
movl 0x84(%rbx), %eax
movl %eax, 0x4(%rsp)
leaq 0xb6c(%rbx), %r8
pushq $0x3f
popq %r9
pushq $0x9
popq %r10
pushq $0x1
popq %r11
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0xc8e11
cmpl $0x0, 0x4(%rsp)
je 0xc8d63
movsbl 0x94(%rbx,%r14), %ebp
cmpl $0x0, 0x8c(%rbx)
jne 0xc8d66
addl 0x58(%rbx), %ebp
jmp 0xc8d66
movl 0x58(%rbx), %ebp
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0xc8e05
movl %ebp, %r12d
testl %esi, %esi
je 0xc8d8a
movl 0x64(%rbx), %r12d
addl %ebp, %r12d
testq %r15, %r15
je 0xc8d8a
addl 0x74(%rbx), %r12d
cmpl $0x3f, %r12d
movl %r9d, %edi
cmovll %r12d, %edi
testl %edi, %edi
jg 0xc8d9b
xorl %edi, %edi
testl %r12d, %r12d
jle 0xc8df3
movl 0x5c(%rbx), %eax
movl %edi, %r13d
testl %eax, %eax
jle 0xc8dc5
cmpl $0x5, %eax
movb $0x1, %cl
sbbb $-0x1, %cl
movl %edi, %r13d
shrl %cl, %r13d
movl %r10d, %ecx
subl %eax, %ecx
cmpl %ecx, %r13d
jl 0xc8dc5
movl %ecx, %r13d
cmpl $0x2, %r13d
jge 0xc8dce
movl %r11d, %r13d
movb %r13b, 0x1(%r8,%r15,4)
leal (%r13,%rdi,2), %eax
movb %al, (%r8,%r15,4)
xorl %eax, %eax
cmpl $0xf, %r12d
setae %al
cmpl $0x28, %r12d
cmovael %edx, %eax
movb %al, 0x3(%r8,%r15,4)
jmp 0xc8df8
movb $0x0, (%r8,%r15,4)
movb %r15b, 0x2(%r8,%r15,4)
incq %r15
jmp 0xc8d69
incq %r14
addq $0x8, %r8
jmp 0xc8d3b
xorl %eax, %eax
jmp 0xc8e29
leaq 0x4fe9a(%rip), %rdx     # 0x118cb6
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0xca862
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq