// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/io_dec.c
// Function: EmitFancyRGB
static int EmitFancyRGB(const VP8Io* const io, WebPDecParams* const p) {
  int num_lines_out = io->mb_h;   // a priori guess
  const WebPRGBABuffer* const buf = &p->output->u.RGBA;
  uint8_t* dst = buf->rgba + (size_t)io->mb_y * buf->stride;
  WebPUpsampleLinePairFunc upsample = WebPUpsamplers[p->output->colorspace];
  const uint8_t* cur_y = io->y;
  const uint8_t* cur_u = io->u;
  const uint8_t* cur_v = io->v;
  const uint8_t* top_u = p->tmp_u;
  const uint8_t* top_v = p->tmp_v;
  int y = io->mb_y;
  const int y_end = io->mb_y + io->mb_h;
  const int mb_w = io->mb_w;
  const int uv_w = (mb_w + 1) / 2;

  if (y == 0) {
    // First line is special cased. We mirror the u/v samples at boundary.
    upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, mb_w);
  } else {
    // We can finish the left-over line from previous call.
    upsample(p->tmp_y, cur_y, top_u, top_v, cur_u, cur_v,
             dst - buf->stride, dst, mb_w);
    ++num_lines_out;
  }
  // Loop over each output pairs of row.
  for (; y + 2 < y_end; y += 2) {
    top_u = cur_u;
    top_v = cur_v;
    cur_u += io->uv_stride;
    cur_v += io->uv_stride;
    dst += 2 * buf->stride;
    cur_y += 2 * io->y_stride;
    upsample(cur_y - io->y_stride, cur_y,
             top_u, top_v, cur_u, cur_v,
             dst - buf->stride, dst, mb_w);
  }
  // move to last row
  cur_y += io->y_stride;
  if (io->crop_top + y_end < io->crop_bottom) {
    // Save the unfinished samples for next call (as we're not done yet).
    memcpy(p->tmp_y, cur_y, mb_w * sizeof(*p->tmp_y));
    memcpy(p->tmp_u, cur_u, uv_w * sizeof(*p->tmp_u));
    memcpy(p->tmp_v, cur_v, uv_w * sizeof(*p->tmp_v));
    // The fancy upsampler leaves a row unfinished behind
    // (except for the very last row)
    num_lines_out--;
  } else {
    // Process the very last row of even-sized picture
    if (!(y_end & 1)) {
      upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v,
               dst + buf->stride, NULL, mb_w);
    }
  }
  return num_lines_out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl 0x10(%rdi), %ebx
movq (%rsi), %r8
movslq 0x8(%rdi), %r15
movslq 0x18(%r8), %r14
movq %r14, %rbp
imulq %r15, %rbp
addq 0x10(%r8), %rbp
movslq 0xc(%rdi), %r10
leal 0x1(%r10), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, 0x34(%rsp)
movq %r8, 0x40(%rsp)
movl (%r8), %eax
leaq 0xa7cd8(%rip), %rcx     # 0x1717c0
movq (%rcx,%rax,8), %r11
movq 0x18(%rdi), %r13
movq 0x20(%rdi), %r8
movq %rdi, 0x48(%rsp)
movq 0x28(%rdi), %r9
testq %r15, %r15
movq %rsi, 0x50(%rsp)
movq %r10, 0x28(%rsp)
movq %r11, 0x38(%rsp)
je 0xc9b46
movq 0x18(%rsi), %rcx
movq 0x8(%rsi), %rdi
movq 0x10(%rsi), %rdx
movq %rbp, %rax
subq %r14, %rax
movl %r10d, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movq %rax, (%rsp)
movq %r13, %rsi
movq %r8, %r14
movq %r9, %r12
callq *%r11
leal 0x1(%rbx), %eax
movl %eax, 0x24(%rsp)
jmp 0xc9b6d
andq $0x0, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rbp, (%rsp)
movq %r13, %rdi
xorl %esi, %esi
movq %r8, %rdx
movq %r9, %rcx
movq %r8, %r14
movq %r9, %r12
callq *%r11
movl %ebx, 0x24(%rsp)
movq %rbx, %rsi
addl %r15d, %esi
leal 0x2(%r15), %ebx
movq %r12, %rcx
movq %r14, %rdx
cmpl %esi, %ebx
jge 0xc9be4
movq 0x48(%rsp), %rdi
movslq 0x34(%rdi), %r15
leaq (%rdx,%r15), %r12
addq %rcx, %r15
movq 0x40(%rsp), %rax
movslq 0x18(%rax), %rax
leaq (%rbp,%rax,2), %rbp
movq %rsi, %r14
movslq 0x30(%rdi), %rsi
leaq (%r13,%rsi,2), %r13
movq %r13, %rdi
subq %rsi, %rdi
movq %rbp, %rsi
subq %rax, %rsi
movq 0x28(%rsp), %rax
movl %eax, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movq %rsi, (%rsp)
movq %r13, %rsi
movq %r12, %r8
movq %r15, %r9
callq *0x38(%rsp)
movq %r14, %rsi
addl $0x2, %ebx
movq %r12, %rdx
movq %r15, %rcx
jmp 0xc9b7d
movq %rdx, %r14
movq %rcx, %r12
movq 0x48(%rsp), %rcx
movslq 0x30(%rcx), %rax
addq %rax, %r13
movl 0x80(%rcx), %eax
addl %esi, %eax
cmpl 0x84(%rcx), %eax
jge 0xc9c47
movq 0x50(%rsp), %rbx
movq 0x8(%rbx), %rdi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
callq 0x562f0
movq 0x10(%rbx), %rdi
movslq 0x34(%rsp), %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x562f0
movq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x562f0
movl 0x24(%rsp), %eax
decl %eax
jmp 0xc9c85
testb $0x1, %sil
jne 0xc9c81
movq 0x40(%rsp), %rax
movslq 0x18(%rax), %rax
addq %rax, %rbp
andq $0x0, 0x8(%rsp)
movq 0x28(%rsp), %rax
movl %eax, 0x10(%rsp)
movq %rbp, (%rsp)
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
movq %r14, %r8
movq %r12, %r9
callq *0x38(%rsp)
movl 0x24(%rsp), %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq