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

```asm
<repl_str>:
  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    L93
  cmpq   $0x0,-0x40(%rbp)
  jne    L93
  mov    $0x0,%eax
  jmp    L70
L93:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L83
  mov    $0x0,%eax
  jmp    L70
L83:
  cmpq   $0x0,-0x48(%rbp)
  jne    L0
  lea    D2(%rip),%rax
  mov    %rax,-0x48(%rbp)
L0:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L23
L82:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  addl   $0x1,-0x28(%rbp)
L23:
  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    L82
  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    L95
  mov    $0x0,%eax
  jmp    L70
L4:
  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)
L95:
  mov    -0x28(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  test   %eax,%eax
  jne    L4
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x8(%rbp),%rax
L70:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D2
type: string

tool: 

assistant: ```c
char *repl_str(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 && !rep)
    return NULL;
  len_rep = strlen(rep);
  if (len_rep == 0)
    return NULL;
  if (!with)
    with = "";
  len_with = strlen(with);
  ins = orig;
  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;
}
```