user: 请将以下的汇编代码转换成C语言代码：

```asm
<str_replace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,-0x68(%rbp)
  mov    %r9d,-0x50(%rbp)
  cmpl   $0x0,-0x50(%rbp)
  jg     L146
  mov    $0x0,%eax
  jmp    L56
L146:
  mov    -0x50(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x28(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jne    L30
  mov    -0x2c(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x48(%rbp),%rcx
  mov    -0x68(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x34(%rbp),%eax
  jmp    L56
L30:
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x4c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
L147:
  mov    -0x58(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L42
  mov    -0x8(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jle    L137
  mov    -0x34(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jge    L46
  mov    -0x34(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x34(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  sub    %eax,-0x30(%rbp)
  jmp    L137
L46:
  mov    -0x30(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x30(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  sub    -0x68(%rbp),%rax
  jmp    L56
L137:
  mov    -0x24(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jge    L20
  mov    -0x24(%rbp),%edx
  mov    -0x60(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x24(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  sub    %eax,-0x30(%rbp)
  jmp    L149
L20:
  mov    -0x30(%rbp),%edx
  mov    -0x60(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x30(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  sub    -0x68(%rbp),%rax
  jmp    L56
L149:
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x20(%rbp)
  jmp    L147
L42:
  nop
  mov    -0x10(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jle    L129
  mov    -0x34(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jle    L53
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x34(%rbp)
L53:
  mov    -0x34(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x34(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
L129:
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  sub    -0x68(%rbp),%rax
L56:
  leave
  ret
```

assistant: ```c
int str_replace(const char *s, const int src_len, const char *replaced, const char *new_str, char *dest, const int dest_size) {
  const char *pStart;
  const char *pEnd;
  char *pDest;
  const char *p;
  int old_len;
  int new_len;
  int len;
  int max_dest_len;
  int remain_len;
  if (dest_size <= 0) {
    return 0;
  }
  max_dest_len = dest_size - 1;
  old_len = strlen(replaced);
  new_len = strlen(new_str);
  if (old_len == 0) {
    len = src_len < max_dest_len ? src_len : max_dest_len;
    memcpy(dest, s, len);
    dest[len] = '\0';
    return len;
  }
  remain_len = max_dest_len;
  pDest = dest;
  pStart = s;
  pEnd = s + src_len;
  while (1) {
    p = strstr(pStart, replaced);
    if (p == NULL) {
      break;
    }
    len = p - pStart;
    if (len > 0) {
      if (len < remain_len) {
        memcpy(pDest, pStart, len);
        pDest += len;
        remain_len -= len;
      } else {
        memcpy(pDest, pStart, remain_len);
        pDest += remain_len;
        *pDest = '\0';
        return pDest - dest;
      }
    }
    if (new_len < remain_len) {
      memcpy(pDest, new_str, new_len);
      pDest += new_len;
      remain_len -= new_len;
    } else {
      memcpy(pDest, new_str, remain_len);
      pDest += remain_len;
      *pDest = '\0';
      return pDest - dest;
    }
    pStart = p + old_len;
  }
  len = pEnd - pStart;
  if (len > 0) {
    if (len > remain_len) {
      len = remain_len;
    }
    memcpy(pDest, pStart, len);
    pDest += len;
  }
  *pDest = '\0';
  return pDest - dest;
}
```