user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<escape_predefined_character_entities>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strdup@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  lea    (%rax,%rax,2),%edi
  add    %edi,%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L52
  movzbl (%r12),%edx
  mov    %rax,%rbp
  mov    %rax,%r13
  test   %dl,%dl
  je     L54
  mov    %r12,%r14
  lea    D40(%rip),%rbx
  lea    D51(%rip),%r15
  nopl   0x0(%rax,%rax,1)
L66:
  lea    -0x22(%rdx),%eax
  cmp    $0x1c,%al
  ja     L51
  movzbl %al,%eax
  movslq (%rbx,%rax,4),%rax
  add    %rbx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L51:
  mov    %dl,0x0(%r13)
  add    $0x1,%r13
L47:
  movzbl 0x1(%r14),%edx
  add    $0x1,%r14
  test   %dl,%dl
  jne    L66
L54:
  movb   $0x0,0x0(%r13)
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  add    $0x8,%rsp
  mov    %rbp,%rdi
  lea    0x1(%rax),%esi
  pop    %rbx
  pop    %rbp
  movslq %esi,%rsi
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10e0 <realloc@plt>
  xchg   %ax,%ax
  mov    %r13,%rdi
  mov    $0x4,%edx
  lea    D23(%rip),%rsi
  add    $0x4,%r13
  call   <strncpy@plt>
  jmp    L47
  nopw   0x0(%rax,%rax,1)
  mov    %r13,%rdi
  mov    $0x4,%edx
  lea    D45(%rip),%rsi
  add    $0x4,%r13
  call   <strncpy@plt>
  jmp    L47
  nopw   0x0(%rax,%rax,1)
  mov    %r13,%rdi
  mov    $0x6,%edx
  lea    D18(%rip),%rsi
  add    $0x6,%r13
  call   <strncpy@plt>
  jmp    L47
  nopl   (%rax)
  mov    %r13,%rdi
  mov    $0x5,%edx
  lea    D17(%rip),%rsi
  add    $0x5,%r13
  call   <strncpy@plt>
  jmp    L47
  nopl   (%rax)
  mov    %r13,%rdi
  mov    $0x6,%edx
  mov    %r15,%rsi
  add    $0x6,%r13
  call   <strncpy@plt>
  jmp    L47
L52:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: data_label: D51
type: string
name: parse_data
arguments: data_label: D23
type: string
name: parse_data
arguments: data_label: D45
type: string
name: parse_data
arguments: data_label: D18
type: string
name: parse_data
arguments: data_label: D17
type: string

tool: D51: &quot;

tool: D23: &gt;

tool: D45: &lt;

tool: D18: &apos;

tool: D17: &amp;

assistant: ```c
char *escape_predefined_character_entities(const char *string) {
  const int MAX_ESCAPE_LEN = 6;
  char *s = strdup(string);
  char *result = malloc(MAX_ESCAPE_LEN * strlen(string) * sizeof(char));
  if (NULL == result)
    return NULL;
  char *c;
  char *result_end = result;
  for (c = s; *c != '\0'; c++) {
    switch (*c) {
    case '&':
      strncpy(result_end, "&amp;", 5);
      result_end += 5;
      break;
    case '<':
      strncpy(result_end, "&lt;", 4);
      result_end += 4;
      break;
    case '>':
      strncpy(result_end, "&gt;", 4);
      result_end += 4;
      break;
    case '\'':
      strncpy(result_end, "&apos;", 6);
      result_end += 6;
      break;
    case '"':
      strncpy(result_end, "&quot;", 6);
      result_end += 6;
      break;
    default:
      *result_end = *c;
      result_end++;
      break;
    }
  }
  *result_end = '\0';
  free(s);
  size_t new_length = strlen(result) + 1;
  result = realloc(result, new_length);
  return result;
}
```