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

```asm
<SDL_imageFilterAddUint>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %ecx,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x58(%rbp)
  je     L115
  cmpq   $0x0,-0x60(%rbp)
  jne    L116
L115:
  mov    $0xffffffff,%eax
  jmp    L65
L116:
  cmpl   $0x0,-0x64(%rbp)
  jne    L70
  mov    $0x0,%eax
  jmp    L65
L70:
  cmpl   $0x0,-0x68(%rbp)
  jne    L153
  mov    -0x64(%rbp),%edx
  mov    -0x60(%rbp),%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    $0x0,%eax
  jmp    L65
L153:
  mov    $0x0,%eax
  call   <SDL_imageFilterMMXdetect@plt>
  test   %rax,%rax
  je     L74
  cmpl   $0x7,-0x64(%rbp)
  jbe    L74
  mov    -0x68(%rbp),%eax
  shr    $0x18,%eax
  mov    %eax,%edx
  mov    -0x68(%rbp),%eax
  shr    $0x8,%eax
  and    $0xff00,%eax
  or     %eax,%edx
  mov    -0x68(%rbp),%eax
  shl    $0x8,%eax
  and    $0xff0000,%eax
  or     %eax,%edx
  mov    -0x68(%rbp),%eax
  shl    $0x18,%eax
  or     %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%edi
  mov    -0x68(%rbp),%ecx
  mov    -0x64(%rbp),%edx
  mov    -0x60(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <SDL_imageFilterAddUintMMX@plt>
  mov    -0x64(%rbp),%eax
  and    $0x7,%eax
  test   %eax,%eax
  je     L158
  mov    -0x64(%rbp),%eax
  and    $0xfffffff8,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%edx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x3c(%rbp),%edx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L37
L158:
  mov    $0x0,%eax
  jmp    L65
L74:
  movl   $0x0,-0x3c(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x28(%rbp)
L37:
  mov    -0x68(%rbp),%eax
  shr    $0x18,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x68(%rbp),%eax
  shr    $0x10,%eax
  movzbl %al,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x68(%rbp),%eax
  shr    $0x8,%eax
  movzbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x68(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x44(%rbp)
  jmp    L35
L88:
  movl   $0x0,-0x40(%rbp)
  jmp    L80
L117:
  mov    -0x44(%rbp),%edx
  mov    -0x40(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x64(%rbp)
  jbe    L56
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x40(%rbp),%eax
  mov    -0x20(%rbp,%rax,4),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
  cmpl   $0xff,-0x38(%rbp)
  jle    L119
  movl   $0xff,-0x38(%rbp)
L119:
  mov    -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %dl,(%rax)
  addq   $0x1,-0x30(%rbp)
  addq   $0x1,-0x28(%rbp)
L56:
  addl   $0x1,-0x40(%rbp)
L80:
  cmpl   $0x3,-0x40(%rbp)
  jbe    L117
  addl   $0x4,-0x44(%rbp)
L35:
  mov    -0x44(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jb     L88
  mov    $0x0,%eax
L65:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  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);
}
```