user: Demonstrate the C code that generates the assembly output below:

```asm
<htmlspecialchars>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  jne    L126
  mov    $0x0,%eax
  jmp    L120
L126:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L54
  mov    $0x0,%eax
  jmp    L120
L54:
  mov    -0x30(%rbp),%rax
  movb   $0x0,(%rax)
  movl   $0x0,-0x3c(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L183
L10:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x26,%al
  jne    L118
  lea    D5(%rip),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L200
  mov    $0x0,%eax
  jmp    L120
L200:
  mov    -0x8(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L26
L118:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L153
  lea    D20(%rip),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L233
  mov    $0x0,%eax
  jmp    L120
L233:
  mov    -0x10(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L26
L153:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x27,%al
  jne    L121
  lea    D41(%rip),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L43
  mov    $0x0,%eax
  jmp    L120
L43:
  mov    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L26
L121:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3c,%al
  jne    L236
  lea    D13(%rip),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L108
  mov    $0x0,%eax
  jmp    L120
L108:
  mov    -0x20(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L26
L236:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  jne    L4
  lea    D28(%rip),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L39
  mov    $0x0,%eax
  jmp    L120
L39:
  mov    -0x28(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L26
L4:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
L26:
  addl   $0x1,-0x3c(%rbp)
L183:
  mov    -0x3c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L10
  mov    -0x30(%rbp),%rax
L120:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D5
type_guessed: string
name: parse_data
arguments: label: D20
type_guessed: string
name: parse_data
arguments: label: D41
type_guessed: string
name: parse_data
arguments: label: D13
type_guessed: string
name: parse_data
arguments: label: D28
type_guessed: string

tool: D5: &amp;

tool: D20: &quot;

tool: D41: &#039;

tool: D13: &lt;

tool: D28: &gt;

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;
}
```