user: Translate the below assembly code into C programming language:

```asm
<iReplaceS>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  movq   $0x0,-0x30(%rbp)
  movq   $0x0,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  movl   $0x0,-0x54(%rbp)
  movq   $0x0,-0x28(%rbp)
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L110
  mov    $0xffffffff,%eax
  jmp    L1
L110:
  mov    -0x78(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  jmp    L105
L95:
  mov    -0x50(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x40(%rbp)
  cmpq   $0x0,-0x80(%rbp)
  je     L46
  mov    -0x38(%rbp),%rax
  cmp    -0x80(%rbp),%rax
  je     L25
L46:
  addq   $0x1,-0x38(%rbp)
L105:
  mov    -0x70(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  jne    L95
  jmp    L52
L25:
  nop
L52:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  imul   -0x38(%rbp),%rax
  add    %rdx,%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L99
  cmpl   $0x0,-0x54(%rbp)
  je     L96
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L96:
  mov    $0xffffffff,%eax
  jmp    L1
L118:
  mov    -0x70(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  sub    -0x48(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x48(%rbp),%rcx
  mov    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x8(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x18(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  add    %rax,-0x48(%rbp)
L99:
  mov    -0x38(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  test   %rax,%rax
  jne    L118
  mov    -0x48(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  cmpl   $0x0,-0x54(%rbp)
  je     L111
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L111:
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x68(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L1:
  leave
  ret
```

assistant: ```c
int iReplaceS(char **s, const char *olds, const char *news, size_t max) {
  char *r = NULL;
  char *tmp = NULL;
  char *workingS = NULL;
  char *ins = NULL;
  size_t count;
  size_t lfront;
  bool freeNewsStatus = false;
  ;
  char *internalNews = NULL;
  size_t lolds;
  lolds = strlen(olds);
  if (!lolds) {
    return (-1);
  }
  internalNews = (char *)news;
  ins = workingS = *s;
  for (count = 0; (tmp = strstr(ins, olds)); ++count) {
    ins = tmp + lolds;
    if (max && (count == max)) {
      break;
    }
  }
  size_t lnews;
  lnews = strlen(internalNews);
  size_t rLen = strlen(*s) + (lnews - lolds) * count + 1;
  ;
  tmp = r = malloc(rLen);
  if (!r) {
    if (freeNewsStatus) {
      free(internalNews);
    }
    return (-1);
  }
  while (count--) {
    ins = strstr(workingS, olds);
    lfront = ins - workingS;
    tmp = strncpy(tmp, workingS, lfront) + lfront;
    tmp = strcpy(tmp, internalNews) + lnews;
    workingS += lfront + lolds;
  }
  strcpy(tmp, workingS);
  if (freeNewsStatus) {
    free(internalNews);
  }
  free(*s);
  *s = r;
  return (0);
}
```