user: Converte this assembly snippet into its equivalent C code:

```asm
<SDL_imageFilterAddUint>:
  endbr64
  test   %rdi,%rdi
  je     L94
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rsi,%rsi
  je     L57
  mov    %edx,%r13d
  test   %edx,%edx
  je     L40
  mov    %rdi,%rbp
  mov    %ecx,%r14d
  test   %ecx,%ecx
  je     L143
  xor    %eax,%eax
  mov    %r14d,%r15d
  mov    %r14d,%ebx
  call   <SDL_imageFilterMMXdetect@plt>
  shr    $0x8,%r15d
  shr    $0x18,%ebx
  cmp    $0x7,%r13d
  jbe    L32
  test   %rax,%rax
  jne    L68
L32:
  mov    %r14d,%edi
  movzbl %r15b,%esi
  movzbl %r14b,%ecx
  xor    %edx,%edx
  shr    $0x10,%edi
  movzbl %dil,%edi
  jmp    L153
  nopl   0x0(%rax)
L8:
  add    $0x1,%rbp
  add    $0x1,%r12
L90:
  lea    0x2(%rdx),%eax
  cmp    %r13d,%eax
  jae    L109
  movzbl 0x0(%rbp),%eax
  mov    $0xff,%r8d
  add    %edi,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  add    $0x1,%rbp
  add    $0x1,%r12
  mov    %al,-0x1(%r12)
L109:
  lea    0x3(%rdx),%eax
  cmp    %r13d,%eax
  jae    L58
  movzbl 0x0(%rbp),%eax
  mov    $0xff,%r8d
  add    %ebx,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  add    $0x1,%rbp
  add    $0x1,%r12
  mov    %al,-0x1(%r12)
L58:
  add    $0x4,%edx
  cmp    %edx,%r13d
  jbe    L40
L153:
  movzbl 0x0(%rbp),%eax
  mov    $0xff,%r8d
  add    %ecx,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  mov    %al,(%r12)
  lea    0x1(%rdx),%eax
  cmp    %r13d,%eax
  jae    L8
  movzbl 0x1(%rbp),%eax
  mov    $0xff,%r8d
  add    %esi,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  add    $0x2,%rbp
  add    $0x2,%r12
  mov    %al,-0x1(%r12)
  jmp    L90
  nopl   0x0(%rax)
L143:
  call   <memcpy@plt>
L40:
  xor    %eax,%eax
L55:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  mov    %r14d,%r8d
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  bswap  %r8d
  call   <SDL_imageFilterAddUintMMX@plt>
  test   $0x7,%r13b
  je     L40
  mov    %r13d,%edx
  and    $0xfffffff8,%edx
  cmp    %edx,%r13d
  jbe    L40
  mov    %r14d,%edi
  mov    %edx,%eax
  movzbl %r15b,%esi
  movzbl %r14b,%ecx
  shr    $0x10,%edi
  add    %rax,%rbp
  add    %rax,%r12
  movzbl %dil,%edi
  jmp    L153
L57:
  mov    $0xffffffff,%eax
  jmp    L55
L94:
  or     $0xffffffff,%eax
  ret
```

assistant: ```c
int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C) {
  unsigned int i, j, istart, D;
  int iC[4];
  unsigned char *cursrc1;
  unsigned char *curdest;
  int result;
  if ((Src1 == NULL) || (Dest == NULL))
    return (-1);
  if (length == 0)
    return (0);
  if (C == 0) {
    memcpy(Src1, Dest, length);
    return (0);
  }
  if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
    D = (((C) >> 24) | (((C)&0x00ff0000) >> 8) | (((C)&0x0000ff00) << 8) | ((C) << 24));
    SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D);
    if ((length & 7) > 0) {
      istart = length & 0xfffffff8;
      cursrc1 = &Src1[istart];
      curdest = &Dest[istart];
    } else {
      return (0);
    }
  } else {
    istart = 0;
    cursrc1 = Src1;
    curdest = Dest;
  }
  iC[3] = (int)((C >> 24) & 0xff);
  iC[2] = (int)((C >> 16) & 0xff);
  iC[1] = (int)((C >> 8) & 0xff);
  iC[0] = (int)((C >> 0) & 0xff);
  for (i = istart; i < length; i += 4) {
    for (j = 0; j < 4; j++) {
      if ((i + j) < length) {
        result = (int)*cursrc1 + iC[j];
        if (result > 255)
          result = 255;
        *curdest = (unsigned char)result;
        cursrc1++;
        curdest++;
      }
    }
  }
  return (0);
}
```