user: Converte this assembly snippet into its equivalent C code:

```asm
<quote_buffer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D9(%rip),%rcx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <_talloc_array@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L56
  mov    $0x0,%eax
  jmp    L10
L63:
  mov    -0xc(%rbp),%eax
  add    $0x9,%eax
  cmp    %eax,-0x14(%rbp)
  jg     L47
  addl   $0x200,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  lea    D9(%rip),%r8
  mov    %edx,%ecx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <_talloc_realloc_array@plt>
  mov    %rax,-0x8(%rbp)
L47:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  jbe    L48
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x7e,%al
  ja     L48
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L6
L48:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x14(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    -0xc(%rbp),%ecx
  movslq %ecx,%rsi
  mov    -0x8(%rbp),%rcx
  lea    (%rsi,%rcx,1),%rdi
  mov    %edx,%ecx
  lea    D19(%rip),%rdx
  mov    %eax,%esi
  call   <snprintf@plt>
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L14
L6:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  addl   $0x1,-0xc(%rbp)
L14:
  addl   $0x1,-0x10(%rbp)
L56:
  mov    -0x10(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  ja     L63
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L10:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D9
type: string
name: extract_symbolic_data
arguments: tag: D19
type: string

tool: D9: char

tool: D19: \x%.2X

assistant: ```c
char *quote_buffer(const unsigned char *str, unsigned int len, const char *special) {
  int out_len = len + 1;
  char *ret_val = (char *)_talloc_array(str, sizeof(char), out_len, "char");
  int i = 0, j = 0;
  if (!ret_val)
    return NULL;
  while (i < len) {
    if (j + 10 > out_len) {
      out_len += 512;
      ret_val = (char *)_talloc_realloc_array(ret_val, ret_val, sizeof(char), out_len, "char");
    };
    if (str[i] < 32 || str[i] > 126 || strchr(special, str[i]) != NULL) {
      j += snprintf(ret_val + j, out_len - j, "\\x%.2X", str[i]);
    } else {
      ret_val[j] = str[i];
      j++;
    };
    i++;
  };
  ret_val[j] = 0;
  return ret_val;
}
```