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

```asm
<__imlib_AddCopyShapedSpanToRGBA>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  mov    %rdx,%rax
  mov    %esi,%edx
  shr    $0x18,%edx
  cmp    $0xff,%dl
  jne    L39
  mov    %ecx,%esi
  add    %rdi,%rsi
  test   %ecx,%ecx
  je     L93
  mov    %ebx,%r8d
  shr    $0x10,%r8d
  movzbl %r8b,%r10d
  movzbl %bh,%ecx
  movzbl %bl,%r9d
  jmp    L105
L39:
  mov    %edx,%r11d
  test   %ecx,%ecx
  je     L93
  mov    %ecx,%ecx
  add    %rdi,%rcx
  movzbl %dl,%ebp
  mov    %esi,%r8d
  shr    $0x10,%r8d
  movzbl %r8b,%r10d
  movzbl %bh,%esi
  movzbl %bl,%r9d
  jmp    L20
L63:
  movzbl %dl,%edx
  imul   %ebp,%edx
  sub    $0xffffff80,%edx
  mov    %edx,%r12d
  shr    $0x8,%r12d
  add    %r12d,%edx
  movzbl %dh,%edx
  mov    %dl,0x3(%rax)
  movzbl 0x2(%rax),%r12d
  movzbl %r12b,%edx
  add    %r10d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %r8d,%r12d
  or     %r12d,%edx
  mov    %dl,0x2(%rax)
  movzbl 0x1(%rax),%r12d
  movzbl %r12b,%edx
  lea    (%rsi,%rdx,1),%edx
  shr    $0x8,%edx
  neg    %edx
  add    %esi,%r12d
  or     %r12d,%edx
  mov    %dl,0x1(%rax)
  movzbl (%rax),%r12d
  movzbl %r12b,%edx
  add    %r9d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %ebx,%r12d
  or     %r12d,%edx
  mov    %dl,(%rax)
L3:
  add    $0x1,%rdi
  add    $0x4,%rax
  cmp    %rdi,%rcx
  je     L93
L20:
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L3
  cmp    $0xff,%dl
  jne    L63
  mov    %r11b,0x3(%rax)
  movzbl 0x2(%rax),%r12d
  movzbl %r12b,%edx
  add    %r10d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %r8d,%r12d
  or     %r12d,%edx
  mov    %dl,0x2(%rax)
  movzbl 0x1(%rax),%r12d
  movzbl %r12b,%edx
  lea    (%rsi,%rdx,1),%edx
  shr    $0x8,%edx
  neg    %edx
  add    %esi,%r12d
  or     %r12d,%edx
  mov    %dl,0x1(%rax)
  movzbl (%rax),%r12d
  movzbl %r12b,%edx
  add    %r9d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %ebx,%r12d
  or     %r12d,%edx
  mov    %dl,(%rax)
  jmp    L3
L64:
  add    $0x1,%rdi
  add    $0x4,%rax
  cmp    %rdi,%rsi
  je     L93
L105:
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L64
  mov    %dl,0x3(%rax)
  movzbl 0x2(%rax),%r11d
  movzbl %r11b,%edx
  add    %r10d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %r8d,%r11d
  or     %r11d,%edx
  mov    %dl,0x2(%rax)
  movzbl 0x1(%rax),%r11d
  movzbl %r11b,%edx
  lea    (%rcx,%rdx,1),%edx
  shr    $0x8,%edx
  neg    %edx
  add    %ecx,%r11d
  or     %r11d,%edx
  mov    %dl,0x1(%rax)
  movzbl (%rax),%r11d
  movzbl %r11b,%edx
  add    %r9d,%edx
  shr    $0x8,%edx
  neg    %edx
  add    %ebx,%r11d
  or     %r11d,%edx
  mov    %dl,(%rax)
  jmp    L64
L93:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void __imlib_AddCopyShapedSpanToRGBA(unsigned char *src, unsigned int color, unsigned int *dst, int len) {
  if (((unsigned char *)(&color))[3] < 255) {
    while (len--) {
      unsigned int tmp;
      switch (*src) {
      case 0:
        break;
      case 255: {
        ((unsigned char *)(dst))[3] = ((unsigned char *)(&color))[3];
        do {
          tmp = (((unsigned char *)(dst))[2]) + (((unsigned char *)(&color))[2]);
          ((unsigned char *)(dst))[2] = (tmp | (-(tmp >> 8)));
          ;
          tmp = (((unsigned char *)(dst))[1]) + (((unsigned char *)(&color))[1]);
          ((unsigned char *)(dst))[1] = (tmp | (-(tmp >> 8)));
          ;
          tmp = (((unsigned char *)(dst))[0]) + (((unsigned char *)(&color))[0]);
          ((unsigned char *)(dst))[0] = (tmp | (-(tmp >> 8)));
          ;
        } while (0);
        break;
      }
      default: {
        do {
          tmp = ((*src) * (((unsigned char *)(&color))[3])) + 0x80;
          ((unsigned char *)(dst))[3] = (tmp + (tmp >> 8)) >> 8;
        } while (0);
        do {
          tmp = (((unsigned char *)(dst))[2]) + (((unsigned char *)(&color))[2]);
          ((unsigned char *)(dst))[2] = (tmp | (-(tmp >> 8)));
          ;
          tmp = (((unsigned char *)(dst))[1]) + (((unsigned char *)(&color))[1]);
          ((unsigned char *)(dst))[1] = (tmp | (-(tmp >> 8)));
          ;
          tmp = (((unsigned char *)(dst))[0]) + (((unsigned char *)(&color))[0]);
          ((unsigned char *)(dst))[0] = (tmp | (-(tmp >> 8)));
          ;
        } while (0);
        break;
      }
      }
      src++;
      dst++;
    }
    return;
  }
  while (len--) {
    unsigned int tmp;
    if (*src) {
      ((unsigned char *)(dst))[3] = *src;
      do {
        tmp = (((unsigned char *)(dst))[2]) + (((unsigned char *)(&color))[2]);
        ((unsigned char *)(dst))[2] = (tmp | (-(tmp >> 8)));
        ;
        tmp = (((unsigned char *)(dst))[1]) + (((unsigned char *)(&color))[1]);
        ((unsigned char *)(dst))[1] = (tmp | (-(tmp >> 8)));
        ;
        tmp = (((unsigned char *)(dst))[0]) + (((unsigned char *)(&color))[0]);
        ((unsigned char *)(dst))[0] = (tmp | (-(tmp >> 8)));
        ;
      } while (0);
    }
    src++;
    dst++;
  }
}
```