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

```asm
<str_replace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  jne    L45
  mov    $0x0,%eax
  jmp    L72
L45:
  cmpq   $0x0,-0x40(%rbp)
  je     L60
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L87
L60:
  mov    $0x0,%eax
  jmp    L72
L87:
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L68
  mov    $0x0,%eax
  jmp    L72
L68:
  cmpq   $0x0,-0x48(%rbp)
  jne    L58
  lea    D3(%rip),%rax
  mov    %rax,-0x48(%rbp)
L58:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x20(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L11
L9:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  addl   $0x1,-0x28(%rbp)
L11:
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L9
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  sub    -0x24(%rbp),%eax
  imul   -0x28(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L100
  mov    $0x0,%eax
  jmp    L72
L55:
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  cltq
  add    %rax,-0x38(%rbp)
L100:
  mov    -0x28(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  test   %eax,%eax
  jne    L55
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x8(%rbp),%rax
L72:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D3
datatype: string

tool: 

assistant: ```c
char *str_replace(char *orig, char *rep, char *with) {
  char *result;
  char *ins;
  char *tmp;
  int len_rep;
  int len_with;
  int len_front;
  int count;
  if (!orig)
    return NULL;
  if (!rep || !(len_rep = strlen(rep)))
    return NULL;
  if (!(ins = strstr(orig, rep)))
    return NULL;
  if (!with)
    with = "";
  len_with = strlen(with);
  for (count = 0; (tmp = (strstr(ins, rep))); ++count) {
    ins = tmp + len_rep;
  }
  tmp = result = malloc(strlen(orig) + (len_with - len_rep) * count + 1);
  if (!result)
    return NULL;
  while (count--) {
    ins = strstr(orig, rep);
    len_front = ins - orig;
    tmp = strncpy(tmp, orig, len_front) + len_front;
    tmp = strcpy(tmp, with) + len_with;
    orig += len_front + len_rep;
  }
  strcpy(tmp, orig);
  return result;
}
```