user: What is the c source code of the assembly code below:

```asm
<str_replace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x40(%rbp)
  jmp    L95
L41:
  mov    -0x58(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L19
  addq   $0x1,-0x28(%rbp)
L19:
  addq   $0x1,-0x40(%rbp)
L95:
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x40(%rbp)
  jb     L41
  cmpq   $0x0,-0x28(%rbp)
  jne    L14
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  jmp    L127
L14:
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    -0x10(%rbp),%rax
  imul   -0x28(%rbp),%rax
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <calloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L89
  mov    $0x0,%eax
  jmp    L127
L89:
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  jmp    L24
L87:
  mov    -0x58(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L8
  movq   $0x0,-0x30(%rbp)
  jmp    L36
L11:
  mov    -0x50(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    -0x8(%rbp),%rdx
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  addq   $0x1,-0x30(%rbp)
L36:
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %rax,-0x30(%rbp)
  jb     L11
  mov    -0x10(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x40(%rbp)
  jmp    L64
L8:
  mov    -0x58(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    -0x8(%rbp),%rdx
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
L64:
  addq   $0x1,-0x40(%rbp)
L24:
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x40(%rbp)
  jb     L87
  mov    -0x8(%rbp),%rax
L127:
  leave
  ret
```

assistant: ```c
char *str_replace(char *search, char *replace, char *subject) {
  char *newstr;
  size_t oldlen, newlen, i, j, k, numreplacements, searchlen;
  newlen = oldlen = strlen(subject) + 1;
  searchlen = strlen(search);
  numreplacements = 0;
  for (i = 0; i < oldlen - 1; i++)
    if (!strncmp(subject + i, search, searchlen))
      numreplacements++;
  if (!numreplacements)
    return strdup(subject);
  newlen += (strlen(replace) * numreplacements) - (searchlen * numreplacements);
  newstr = calloc(1, newlen);
  if (!newstr)
    return NULL;
  for (i = 0, j = 0; i < oldlen - 1; i++) {
    if (!strncmp(subject + i, search, searchlen)) {
      for (k = 0; k < strlen(replace); k++)
        newstr[j++] = replace[k];
      i += searchlen - 1;
    } else
      newstr[j++] = subject[i];
  }
  return newstr;
}
```