// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/frame_dec.c
// Function: FinishRow
static int FinishRow(void* arg1, void* arg2) {
  VP8Decoder* const dec = (VP8Decoder*)arg1;
  VP8Io* const io = (VP8Io*)arg2;
  int ok = 1;
  const VP8ThreadContext* const ctx = &dec->thread_ctx_;
  const int cache_id = ctx->id_;
  const int extra_y_rows = kFilterExtraRows[dec->filter_type_];
  const int ysize = extra_y_rows * dec->cache_y_stride_;
  const int uvsize = (extra_y_rows / 2) * dec->cache_uv_stride_;
  const int y_offset = cache_id * 16 * dec->cache_y_stride_;
  const int uv_offset = cache_id * 8 * dec->cache_uv_stride_;
  uint8_t* const ydst = dec->cache_y_ - ysize + y_offset;
  uint8_t* const udst = dec->cache_u_ - uvsize + uv_offset;
  uint8_t* const vdst = dec->cache_v_ - uvsize + uv_offset;
  const int mb_y = ctx->mb_y_;
  const int is_first_row = (mb_y == 0);
  const int is_last_row = (mb_y >= dec->br_mb_y_ - 1);

  if (dec->mt_method_ == 2) {
    ReconstructRow(dec, ctx);
  }

  if (ctx->filter_row_) {
    FilterRow(dec);
  }

  if (dec->dither_) {
    DitherRow(dec);
  }

  if (io->put != NULL) {
    int y_start = MACROBLOCK_VPOS(mb_y);
    int y_end = MACROBLOCK_VPOS(mb_y + 1);
    if (!is_first_row) {
      y_start -= extra_y_rows;
      io->y = ydst;
      io->u = udst;
      io->v = vdst;
    } else {
      io->y = dec->cache_y_ + y_offset;
      io->u = dec->cache_u_ + uv_offset;
      io->v = dec->cache_v_ + uv_offset;
    }

    if (!is_last_row) {
      y_end -= extra_y_rows;
    }
    if (y_end > io->crop_bottom) {
      y_end = io->crop_bottom;    // make sure we don't overflow on last row.
    }
    // If dec->alpha_data_ is not NULL, we have some alpha plane present.
    io->a = NULL;
    if (dec->alpha_data_ != NULL && y_start < y_end) {
      io->a = VP8DecompressAlphaRows(dec, io, y_start, y_end - y_start);
      if (io->a == NULL) {
        return VP8SetError(dec, VP8_STATUS_BITSTREAM_ERROR,
                           "Could not decode alpha data.");
      }
    }
    if (y_start < io->crop_top) {
      const int delta_y = io->crop_top - y_start;
      y_start = io->crop_top;
      assert(!(delta_y & 1));
      io->y += dec->cache_y_stride_ * delta_y;
      io->u += dec->cache_uv_stride_ * (delta_y >> 1);
      io->v += dec->cache_uv_stride_ * (delta_y >> 1);
      if (io->a != NULL) {
        io->a += io->width * delta_y;
      }
    }
    if (y_start < y_end) {
      io->y += io->crop_left;
      io->u += io->crop_left >> 1;
      io->v += io->crop_left >> 1;
      if (io->a != NULL) {
        io->a += io->crop_left;
      }
      io->mb_y = y_start - io->crop_top;
      io->mb_w = io->crop_right - io->crop_left;
      io->mb_h = y_end - y_start;
      ok = io->put(io);
    }
  }
  // rotate top samples if needed
  if (cache_id + 1 == dec->num_caches_) {
    if (!is_last_row) {
      memcpy(dec->cache_y_ - ysize, ydst + 16 * dec->cache_y_stride_, ysize);
      memcpy(dec->cache_u_ - uvsize, udst + 8 * dec->cache_uv_stride_, uvsize);
      memcpy(dec->cache_v_ - uvsize, vdst + 8 * dec->cache_uv_stride_, uvsize);
    }
  }

  return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movq %rdi, %r9
movslq 0xd8(%rdi), %rax
movq %rax, 0x70(%rsp)
movslq 0xb68(%rdi), %rax
leaq 0x506c6(%rip), %rcx     # 0x118c0c
movzbl (%rax,%rcx), %eax
movq %rax, 0x58(%rsp)
movslq 0xb40(%rdi), %rax
movq %rax, 0x80(%rsp)
movl 0xb44(%rdi), %eax
movl %eax, 0x64(%rsp)
movq 0xb28(%rdi), %rax
movq %rax, 0x38(%rsp)
movq 0xb30(%rdi), %rax
movq %rax, 0x40(%rsp)
movq 0xb38(%rdi), %rax
movq %rax, 0x78(%rsp)
movl 0xdc(%rdi), %eax
movl %eax, 0x24(%rsp)
movl 0x1ac(%rdi), %ebp
cmpl $0x2, 0xc8(%rdi)
movq %rdi, (%rsp)
jne 0xc85bc
leaq 0xd8(%r9), %rsi
movq %r9, %rdi
callq 0xc802e
movq (%rsp), %r9
movl %ebp, 0x68(%rsp)
movq %rbx, 0x88(%rsp)
cmpl $0x0, 0xe0(%r9)
je 0xc8877
movl 0xdc(%r9), %eax
movl %eax, 0x34(%rsp)
movslq 0x1a0(%r9), %rbp
leaq (,%rbp,8), %rax
movq %rax, 0x48(%rsp)
movq %rbp, %rax
shlq $0x4, %rax
movq %rax, 0x50(%rsp)
movslq 0x1a8(%r9), %rax
cmpq %rax, %rbp
jge 0xc8877
movq 0xe8(%r9), %rbx
movzbl (%rbx,%rbp,4), %r12d
testl %r12d, %r12d
je 0xc8863
cmpb $0x2, %r12b
jbe 0xc8bf0
movl 0xd8(%r9), %eax
movl 0xb40(%r9), %edx
movl %eax, %ecx
movl %edx, 0x8(%rsp)
imull %edx, %ecx
shll $0x4, %ecx
movslq %ecx, %r13
addq 0xb28(%r9), %r13
addq 0x50(%rsp), %r13
cmpl $0x1, 0xb68(%r9)
jne 0xc86e2
testq %rbp, %rbp
jle 0xc8681
leal 0x4(%r12), %edx
movq %r13, %rdi
movl 0x8(%rsp), %esi
leaq 0xa8eed(%rip), %rax     # 0x171568
callq *(%rax)
movq (%rsp), %r9
cmpb $0x0, 0x2(%rbx,%rbp,4)
je 0xc869f
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r12d, %edx
leaq 0xa8edf(%rip), %rax     # 0x171578
callq *(%rax)
movq (%rsp), %r9
cmpl $0x0, 0x34(%rsp)
jle 0xc86bf
leal 0x4(%r12), %edx
movq %r13, %rdi
movl 0x8(%rsp), %esi
leaq 0xa8ea7(%rip), %rax     # 0x171560
callq *(%rax)
movq (%rsp), %r9
cmpb $0x0, 0x2(%rbx,%rbp,4)
je 0xc8863
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r12d, %edx
leaq 0xa8e95(%rip), %rax     # 0x171570
callq *(%rax)
jmp 0xc885f
movzbl 0x1(%rbx,%rbp,4), %ecx
movl 0xb44(%r9), %esi
imull %esi, %eax
shll $0x3, %eax
movslq %eax, %r15
movq %rbx, %rdx
movq 0xb30(%r9), %rbx
addq %r15, %rbx
addq 0xb38(%r9), %r15
movq 0x48(%rsp), %rax
addq %rax, %rbx
addq %rax, %r15
movq %rdx, 0x90(%rsp)
movzbl 0x3(%rdx,%rbp,4), %r8d
testq %rbp, %rbp
movl %ecx, %r14d
movl %r8d, 0x10(%rsp)
movl %esi, 0x28(%rsp)
jle 0xc877c
leal 0x4(%r12), %edx
movl %edx, 0x18(%rsp)
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r14d, %ecx
leaq 0xa8dd9(%rip), %rax     # 0x171528
callq *(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl 0x28(%rsp), %edx
movl 0x18(%rsp), %ecx
movl %r14d, %r8d
movl 0x10(%rsp), %r9d
leaq 0xa8dca(%rip), %rax     # 0x171538
callq *(%rax)
movl 0x10(%rsp), %r8d
movl %r14d, %ecx
movq (%rsp), %r9
movq %rbx, 0x18(%rsp)
movq 0x90(%rsp), %rbx
cmpb $0x0, 0x2(%rbx,%rbp,4)
je 0xc87d2
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r12d, %edx
movl %r14d, %ecx
leaq 0xa8da4(%rip), %rax     # 0x171548
callq *(%rax)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl 0x28(%rsp), %edx
movl %r12d, %ecx
movl %r14d, %r8d
movl 0x10(%rsp), %r9d
leaq 0xa8d94(%rip), %rax     # 0x171558
callq *(%rax)
movl 0x10(%rsp), %r8d
movl %r14d, %ecx
movq (%rsp), %r9
cmpl $0x0, 0x34(%rsp)
jle 0xc8822
leal 0x4(%r12), %edx
movl %edx, 0x6c(%rsp)
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r14d, %ecx
leaq 0xa8d2d(%rip), %rax     # 0x171520
callq *(%rax)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl 0x28(%rsp), %edx
movl 0x6c(%rsp), %ecx
movl %r14d, %r8d
movl 0x10(%rsp), %r9d
leaq 0xa8d1c(%rip), %rax     # 0x171530
callq *(%rax)
movl 0x10(%rsp), %r8d
movl %r14d, %ecx
movq (%rsp), %r9
cmpb $0x0, 0x2(%rbx,%rbp,4)
je 0xc8863
movq %r13, %rdi
movl 0x8(%rsp), %esi
movl %r12d, %edx
movl %ecx, %ebx
leaq 0xa8d04(%rip), %rax     # 0x171540
movl %r8d, %r14d
callq *(%rax)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl 0x28(%rsp), %edx
movl %r12d, %ecx
movl %ebx, %r8d
movl %r14d, %r9d
leaq 0xa8cf3(%rip), %rax     # 0x171550
callq *(%rax)
movq (%rsp), %r9
incq %rbp
addq $0x8, 0x48(%rsp)
addq $0x10, 0x50(%rsp)
jmp 0xc8601
movq 0x58(%rsp), %rdx
movl %edx, %eax
shrl %eax
movl 0x64(%rsp), %esi
imull %esi, %eax
movq 0x70(%rsp), %rcx
imull %ecx, %esi
movq %rcx, %rdi
movq 0x80(%rsp), %rcx
imulq %rcx, %rdi
imulq %rcx, %rdx
shll $0x3, %esi
cltq
shlq $0x4, %rdi
movq %rdi, 0x48(%rsp)
movq %rdx, 0x18(%rsp)
subq %rdx, 0x38(%rsp)
subq %rax, 0x40(%rsp)
movslq %esi, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x28(%rsp)
subq %rax, 0x78(%rsp)
cmpl $0x0, 0x338(%r9)
je 0xc8994
movslq 0x1a0(%r9), %rbx
leaq 0x33c(%r9), %rax
movq %rax, 0x50(%rsp)
leaq (,%rbx,8), %rdx
imulq $0x64, %rbx, %r12
movq 0x50(%rsp), %r13
movslq 0x1a8(%r9), %rax
cmpq %rax, %rbx
jge 0xc8994
movq 0xf0(%r9), %r14
movzbl 0x31c(%r14,%r12,8), %ecx
cmpl $0x4, %ecx
jb 0xc8984
movl 0xb44(%r9), %ebp
movl 0xd8(%r9), %eax
imull %ebp, %eax
shll $0x3, %eax
movslq %eax, %r15
movq 0xb30(%r9), %rsi
addq %r15, %rsi
addq %rdx, %rsi
addq 0xb38(%r9), %r15
addq %rdx, %r15
movq %r13, %rdi
movq %rdx, 0x8(%rsp)
movl %ebp, %edx
callq 0xc92f0
movzbl 0x31c(%r14,%r12,8), %ecx
movq %r13, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0xc92f0
movq 0x8(%rsp), %rdx
movq (%rsp), %r9
incq %rbx
addq $0x8, %rdx
addq $0x64, %r12
jmp 0xc8903
movq 0x48(%rsp), %rsi
addq %rsi, 0x38(%rsp)
movq 0x10(%rsp), %rcx
addq %rcx, 0x40(%rsp)
movq 0x78(%rsp), %rax
addq %rcx, %rax
movl 0x68(%rsp), %r12d
decl %r12d
pushq $0x1
popq %r13
movq 0x88(%rsp), %r14
cmpq $0x0, 0x40(%r14)
je 0xc89f4
movl 0x24(%rsp), %ecx
movl %ecx, %ebp
shll $0x4, %ebp
leal 0x10(%rbp), %ebx
testl %ecx, %ecx
je 0xc89fc
movq 0x58(%rsp), %rdx
subl %edx, %ebp
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rcx
movq %rax, %r15
movq %rax, %rdi
jmp 0xc8a23
movq %rax, %r15
jmp 0xc8b47
movq %rax, %r15
addq 0xb28(%r9), %rsi
movq 0xb30(%r9), %rcx
movq 0x10(%rsp), %rdi
addq %rdi, %rcx
addq 0xb38(%r9), %rdi
xorl %ebp, %ebp
movq 0x58(%rsp), %rdx
xorl %eax, %eax
cmpl %r12d, 0x24(%rsp)
movq %rsi, 0x18(%r14)
movq %rcx, 0x20(%r14)
movq %rdi, 0x28(%r14)
cmovgel %eax, %edx
subl %edx, %ebx
movl 0x84(%r14), %ecx
cmpl %ecx, %ebx
cmovgel %ecx, %ebx
andq $0x0, 0x98(%r14)
cmpq $0x0, 0xb98(%r9)
je 0xc8a7c
movl %ebx, %ecx
subl %ebp, %ecx
jle 0xc8a7c
movq %r9, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xe1de5
movq (%rsp), %r9
movq %rax, 0x98(%r14)
testq %rax, %rax
je 0xc8ad4
movl 0x80(%r14), %ecx
movl %ecx, %edx
subl %ebp, %edx
jle 0xc8afb
testb $0x1, %dl
jne 0xc8c0f
movslq 0xb40(%r9), %rdi
movslq %edx, %rsi
imulq %rsi, %rdi
addq %rdi, 0x18(%r14)
movslq 0xb44(%r9), %rdi
sarl %edx
movslq %edx, %rdx
imulq %rdi, %rdx
addq %rdx, 0x20(%r14)
addq %rdx, 0x28(%r14)
testq %rax, %rax
je 0xc8af7
movslq (%r14), %rdx
imulq %rsi, %rdx
addq %rdx, %rax
movq %rax, 0x98(%r14)
jmp 0xc8af9
leaq 0x5027b(%rip), %rdx     # 0x118d56
pushq $0x3
popq %rsi
movq %r9, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xca862
xorl %eax, %eax
movl %ecx, %ebp
subl %ebp, %ebx
jle 0xc8b47
movslq 0x78(%r14), %rdx
addq %rdx, 0x18(%r14)
movl %edx, %esi
sarl %esi
movslq %esi, %rsi
addq %rsi, 0x20(%r14)
addq %rsi, 0x28(%r14)
testq %rax, %rax
je 0xc8b25
addq %rdx, %rax
movq %rax, 0x98(%r14)
subl %ecx, %ebp
movl %ebp, 0x8(%r14)
movl 0x7c(%r14), %eax
subl %edx, %eax
movl %eax, 0xc(%r14)
movl %ebx, 0x10(%r14)
movq %r14, %rdi
callq *0x40(%r14)
movl %eax, %r13d
movq (%rsp), %r9
cmpl %r12d, 0x24(%rsp)
setge %al
movq 0x70(%rsp), %rcx
incl %ecx
cmpl 0xd0(%r9), %ecx
setne %cl
orb %al, %cl
jne 0xc8bdb
movq 0x18(%rsp), %rdx
movq %rdx, %rdi
negq %rdi
movq 0x28(%rsp), %r12
movq %r12, %r14
addq 0xb28(%r9), %rdi
negq %r14
movslq 0xb40(%r9), %rax
shlq $0x4, %rax
movq 0x38(%rsp), %rsi
addq %rax, %rsi
movq %r9, %rbx
callq 0x562f0
movq 0xb30(%rbx), %rdi
addq %r14, %rdi
movslq 0xb44(%rbx), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movq %r12, %rdx
callq 0x562f0
addq 0xb38(%rbx), %r14
movslq 0xb44(%rbx), %rax
leaq (%r15,%rax,8), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x562f0
movl %r13d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x501a9(%rip), %rdi     # 0x118da0
leaq 0x50011(%rip), %rsi     # 0x118c0f
leaq 0x501a6(%rip), %rcx     # 0x118dab
movl $0xd6, %edx
callq 0x56770
leaq 0x5015d(%rip), %rdi     # 0x118d73
leaq 0x4fff2(%rip), %rsi     # 0x118c0f
leaq 0x5015e(%rip), %rcx     # 0x118d82
movl $0x1d0, %edx            # imm = 0x1D0
callq 0x56770