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     L79
  movzbl (%r12),%edx
  mov    %rax,%rbp
  mov    %rax,%r13
  test   %dl,%dl
  je     L31
  mov    %r12,%r14
  lea    D5(%rip),%rbx
  lea    D16(%rip),%r15
  nopl   0x0(%rax,%rax,1)
L61:
  lea    -0x22(%rdx),%eax
  cmp    $0x1c,%al
  ja     L6
  movzbl %al,%eax
  movslq (%rbx,%rax,4),%rax
  add    %rbx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L6:
  mov    %dl,0x0(%r13)
  add    $0x1,%r13
L84:
  movzbl 0x1(%r14),%edx
  add    $0x1,%r14
  test   %dl,%dl
  jne    L61
L31:
  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    D54(%rip),%rsi
  add    $0x4,%r13
  call   <strncpy@plt>
  jmp    L84
  nopw   0x0(%rax,%rax,1)
  mov    %r13,%rdi
  mov    $0x4,%edx
  lea    D11(%rip),%rsi
  add    $0x4,%r13
  call   <strncpy@plt>
  jmp    L84
  nopw   0x0(%rax,%rax,1)
  mov    %r13,%rdi
  mov    $0x6,%edx
  lea    D32(%rip),%rsi
  add    $0x6,%r13
  call   <strncpy@plt>
  jmp    L84
  nopl   (%rax)
  mov    %r13,%rdi
  mov    $0x5,%edx
  lea    D41(%rip),%rsi
  add    $0x5,%r13
  call   <strncpy@plt>
  jmp    L84
  nopl   (%rax)
  mov    %r13,%rdi
  mov    $0x6,%edx
  mov    %r15,%rsi
  add    $0x6,%r13
  call   <strncpy@plt>
  jmp    L84
L79:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D16
type: string
name: retrieve_data
arguments: data_label: D54
type: string
name: retrieve_data
arguments: data_label: D11
type: string
name: retrieve_data
arguments: data_label: D32
type: string
name: retrieve_data
arguments: data_label: D41
type: string

tool: D16: &quot;

tool: D54: &gt;

tool: D11: &lt;

tool: D32: &apos;

tool: D41: &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;
}
```