user: Please show me the C implementation that matches the assembly code listed below:

```asm
<scale_YCoCg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  movl   $0x3f,-0x1c(%rbp)
  movl   $0x1f,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x48(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jle    L31
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x28(%rbp)
L31:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L14
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x24(%rbp)
L14:
  mov    -0x24(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jle    L34
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x28(%rbp)
L34:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  setle  %al
  movzbl %al,%eax
  neg    %eax
  mov    %eax,-0xc(%rbp)
  mov    -0x28(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  setle  %al
  movzbl %al,%eax
  neg    %eax
  mov    %eax,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  and    $0x1,%eax
  lea    0x1(%rax),%edx
  mov    -0x8(%rbp),%eax
  and    $0x2,%eax
  add    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  add    $0x2,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x40(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x48(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  add    $0x2,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x48(%rbp),%rax
  mov    %dl,(%rax)
  movl   $0x0,-0x20(%rbp)
  jmp    L27
L10:
  mov    -0x20(%rbp),%eax
  shl    $0x2,%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  shl    $0x2,%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  mov    -0x20(%rbp),%eax
  shl    $0x2,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  add    $0xffffff80,%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  shl    $0x2,%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  add    $0xffffff80,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x20(%rbp)
L27:
  cmpl   $0xf,-0x20(%rbp)
  jle    L10
  nop
  nop
  leave
  ret
```

assistant: ```c
void scale_YCoCg(unsigned char *block, unsigned char *mincolor, unsigned char *maxcolor) {
  const int s0 = 128 / 2 - 1;
  const int s1 = 128 / 4 - 1;
  int m0, m1, m2, m3;
  int mask0, mask1, scale;
  int i;
  m0 = abs(mincolor[2] - 128);
  m1 = abs(mincolor[1] - 128);
  m2 = abs(maxcolor[2] - 128);
  m3 = abs(maxcolor[1] - 128);
  if (m1 > m0)
    m0 = m1;
  if (m3 > m2)
    m2 = m3;
  if (m2 > m0)
    m0 = m2;
  mask0 = -(m0 <= s0);
  mask1 = -(m0 <= s1);
  scale = 1 + (1 & mask0) + (2 & mask1);
  mincolor[2] = (mincolor[2] - 128) * scale + 128;
  mincolor[1] = (mincolor[1] - 128) * scale + 128;
  mincolor[0] = (scale - 1) << 3;
  maxcolor[2] = (maxcolor[2] - 128) * scale + 128;
  maxcolor[1] = (maxcolor[1] - 128) * scale + 128;
  maxcolor[0] = (scale - 1) << 3;
  for (i = 0; i < 16; ++i) {
    block[i * 4 + 2] = (block[i * 4 + 2] - 128) * scale + 128;
    block[i * 4 + 1] = (block[i * 4 + 1] - 128) * scale + 128;
  }
}
```