// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/yuv.c
// Function: WebPConvertARGBToUV_C
void WebPConvertARGBToUV_C(const uint32_t* argb, uint8_t* u, uint8_t* v,
                           int src_width, int do_store) {
  // No rounding. Last pixel is dealt with separately.
  const int uv_width = src_width >> 1;
  int i;
  for (i = 0; i < uv_width; ++i) {
    const uint32_t v0 = argb[2 * i + 0];
    const uint32_t v1 = argb[2 * i + 1];
    // VP8RGBToU/V expects four accumulated pixels. Hence we need to
    // scale r/g/b value by a factor 2. We just shift v0/v1 one bit less.
    const int r = ((v0 >> 15) & 0x1fe) + ((v1 >> 15) & 0x1fe);
    const int g = ((v0 >>  7) & 0x1fe) + ((v1 >>  7) & 0x1fe);
    const int b = ((v0 <<  1) & 0x1fe) + ((v1 <<  1) & 0x1fe);
    const int tmp_u = VP8RGBToU(r, g, b, YUV_HALF << 2);
    const int tmp_v = VP8RGBToV(r, g, b, YUV_HALF << 2);
    if (do_store) {
      u[i] = tmp_u;
      v[i] = tmp_v;
    } else {
      // Approximated average-of-four. But it's an acceptable diff.
      u[i] = (u[i] + tmp_u + 1) >> 1;
      v[i] = (v[i] + tmp_v + 1) >> 1;
    }
  }
  if (src_width & 1) {       // last pixel
    const uint32_t v0 = argb[2 * i + 0];
    const int r = (v0 >> 14) & 0x3fc;
    const int g = (v0 >>  6) & 0x3fc;
    const int b = (v0 <<  2) & 0x3fc;
    const int tmp_u = VP8RGBToU(r, g, b, YUV_HALF << 2);
    const int tmp_v = VP8RGBToV(r, g, b, YUV_HALF << 2);
    if (do_store) {
      u[i] = tmp_u;
      v[i] = tmp_v;
    } else {
      u[i] = (u[i] + tmp_u + 1) >> 1;
      v[i] = (v[i] + tmp_v + 1) >> 1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl -0x1c(%rbp), %eax
sarl %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x153d08
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
shll %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
shrl $0xf, %eax
andl $0x1fe, %eax            # imm = 0x1FE
movl -0x30(%rbp), %ecx
shrl $0xf, %ecx
andl $0x1fe, %ecx            # imm = 0x1FE
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
shrl $0x7, %eax
andl $0x1fe, %eax            # imm = 0x1FE
movl -0x30(%rbp), %ecx
shrl $0x7, %ecx
andl $0x1fe, %ecx            # imm = 0x1FE
addl %ecx, %eax
movl %eax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
shll %eax
andl $0x1fe, %eax            # imm = 0x1FE
movl -0x30(%rbp), %ecx
shll %ecx
andl $0x1fe, %ecx            # imm = 0x1FE
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
movl -0x3c(%rbp), %edx
movl $0x20000, %ecx          # imm = 0x20000
callq 0x153e00
movl %eax, -0x40(%rbp)
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
movl -0x3c(%rbp), %edx
movl $0x20000, %ecx          # imm = 0x20000
callq 0x153e50
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x153cb6
movl -0x40(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x44(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x153cf8
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x40(%rbp), %eax
addl $0x1, %eax
sarl %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x44(%rbp), %eax
addl $0x1, %eax
sarl %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x153cfa
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x153bda
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x153dee
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
shll %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
shrl $0xe, %eax
andl $0x3fc, %eax            # imm = 0x3FC
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
shrl $0x6, %eax
andl $0x3fc, %eax            # imm = 0x3FC
movl %eax, -0x50(%rbp)
movl -0x48(%rbp), %eax
shll $0x2, %eax
andl $0x3fc, %eax            # imm = 0x3FC
movl %eax, -0x54(%rbp)
movl -0x4c(%rbp), %edi
movl -0x50(%rbp), %esi
movl -0x54(%rbp), %edx
movl $0x20000, %ecx          # imm = 0x20000
callq 0x153e00
movl %eax, -0x58(%rbp)
movl -0x4c(%rbp), %edi
movl -0x50(%rbp), %esi
movl -0x54(%rbp), %edx
movl $0x20000, %ecx          # imm = 0x20000
callq 0x153e50
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x153daa
movl -0x58(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x5c(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x153dec
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x58(%rbp), %eax
addl $0x1, %eax
sarl %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x5c(%rbp), %eax
addl $0x1, %eax
sarl %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x153dee
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)