user: 请从给定的汇编指令推导出C源代码：

```asm
<htmlspecialchars>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L48
  mov    %rdi,%r14
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  movb   $0x0,(%rax)
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L100
  lea    -0x1(%rax),%eax
  lea    D69(%rip),%r13
  lea    0x1(%r14,%rax,1),%rbp
  lea    D10(%rip),%r12
  jmp    L151
  nopl   0x0(%rax)
L57:
  cmp    $0x22,%al
  je     L120
  cmp    $0x27,%al
  je     L158
  cmp    $0x3c,%al
  je     L172
  cmp    $0x3e,%al
  je     L20
  mov    $0x1,%edx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <strncat@plt>
L107:
  add    $0x1,%r14
  cmp    %rbp,%r14
  je     L100
L151:
  movzbl (%r14),%eax
  cmp    $0x26,%al
  jne    L57
  lea    D63(%rip),%r9
  mov    %r9,%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  add    %eax,%ebx
  mov    %ebx,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  lea    D63(%rip),%r9
  mov    %rax,%rdi
  add    $0x1,%r14
  mov    %r9,%rsi
  call   <strcat@plt>
  cmp    %rbp,%r14
  jne    L151
L100:
  add    $0x8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L120:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  add    %eax,%ebx
  mov    %ebx,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L107
L20:
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  add    %eax,%ebx
  mov    %ebx,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L107
L158:
  lea    D28(%rip),%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  add    %eax,%ebx
  mov    %ebx,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  lea    D28(%rip),%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L107
  nopl   0x0(%rax)
L172:
  lea    D71(%rip),%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  add    %eax,%ebx
  mov    %ebx,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L48
  lea    D71(%rip),%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L107
  nopl   0x0(%rax)
L48:
  xor    %r15d,%r15d
  jmp    L100
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D69
data_type: string
name: extract_symbolic_data
arguments: data_label: D10
data_type: string
name: extract_symbolic_data
arguments: data_label: D63
data_type: string
name: extract_symbolic_data
arguments: data_label: D28
data_type: string
name: extract_symbolic_data
arguments: data_label: D71
data_type: string

tool: D69: &gt;

tool: D10: &quot;

tool: D63: &amp;

tool: D28: &#039;

tool: D71: &lt;

assistant: ```c
char *htmlspecialchars(const char *s) {
  if (s == NULL) {
    return NULL;
  }
  char *t = malloc(strlen(s) + 1);
  if (t == NULL) {
    return NULL;
  }
  t[0] = '\0';
  for (int i = 0, old = strlen(s), new = old; i < old; i++) {
    if (s[i] == '&') {
      const char *entity = "&amp;";
      new += strlen(entity);
      t = realloc(t, new);
      if (t == NULL) {
        return NULL;
      }
      strcat(t, entity);
    } else if (s[i] == '"') {
      const char *entity = "&quot;";
      new += strlen(entity);
      t = realloc(t, new);
      if (t == NULL) {
        return NULL;
      }
      strcat(t, entity);
    } else if (s[i] == '\'') {
      const char *entity = "&#039;";
      new += strlen(entity);
      t = realloc(t, new);
      if (t == NULL) {
        return NULL;
      }
      strcat(t, entity);
    } else if (s[i] == '<') {
      const char *entity = "&lt;";
      new += strlen(entity);
      t = realloc(t, new);
      if (t == NULL) {
        return NULL;
      }
      strcat(t, entity);
    } else if (s[i] == '>') {
      const char *entity = "&gt;";
      new += strlen(entity);
      t = realloc(t, new);
      if (t == NULL) {
        return NULL;
      }
      strcat(t, entity);
    } else {
      strncat(t, s + i, 1);
    }
  }
  return t;
}
```