user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<_xstrsubstitute>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L70
  cmpq   $0x0,-0x40(%rbp)
  je     L70
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L70
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x40(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L59
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  sub    %rdx,%rax
  mov    %eax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  jne    L50
  movl   $0x0,-0x24(%rbp)
  jmp    L94
L50:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
L94:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <xstrdup@plt>
  mov    %rax,-0x18(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  je     L24
  mov    -0x24(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <makespace@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
L24:
  mov    -0x18(%rbp),%rax
  mov    -0x38(%rbp),%rdx
  mov    (%rdx),%rcx
  mov    -0x20(%rbp),%edx
  movslq %edx,%rsi
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  add    %rsi,%rdx
  add    %rcx,%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  lea    -0x18(%rbp),%rax
  lea    D15(%rip),%rdx
  mov    %rdx,%rcx
  mov    $0x1c9,%edx
  lea    D12(%rip),%rsi
  mov    %rax,%rdi
  call   <slurm_xfree@plt>
  jmp    L11
L70:
  nop
  jmp    L11
L59:
  nop
L11:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L34
  call   <__stack_chk_fail@plt>
L34:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D15
type_guessed: string
name: parse_data
arguments: data_tag: D12
type_guessed: string

tool: 

tool: D12: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Q-Leap-Networks/debian-slurm/refs/heads/master/src/common/xstring.c

assistant: ```c
void _xstrsubstitute(char **str, const char *pattern, const char *replacement) {
  int pat_len, rep_len;
  char *ptr, *end_copy;
  int pat_offset;
  if (*str == NULL || pattern == NULL || pattern[0] == '\0')
    return;
  if ((ptr = strstr(*str, pattern)) == NULL)
    return;
  pat_offset = ptr - (*str);
  pat_len = strlen(pattern);
  if (replacement == NULL)
    rep_len = 0;
  else
    rep_len = strlen(replacement);
  end_copy = xstrdup(ptr + pat_len);
  if (rep_len != 0) {
    makespace(str, rep_len - pat_len);
    strcpy((*str) + pat_offset, replacement);
  }
  strcpy((*str) + pat_offset + rep_len, end_copy);
  slurm_xfree((void **)&(end_copy), "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Q-Leap-Networks/debian-slurm/refs/heads/master/src/common/xstring.c", 457, "");
}
```