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

```asm
<get_HTTP_headers>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %edi,%r13d
  mov    $0x1001,%edi
  push   %r12
  mov    $0x1000,%r12d
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    %rdx,0x10(%rsp)
  mov    %rcx,0x18(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <malloc@plt>
  movq   $0x0,(%rbx)
  mov    $0x1000,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %rax,%rbp
  xor    %ebx,%ebx
  call   <memset@plt>
  test   %r15,%r15
  je     L132
  lea    D20(%rip),%r13
  nopl   0x0(%rax)
L94:
  mov    %r12d,%edx
  lea    0x0(%rbp,%r14,1),%rsi
  mov    %r15,%rdi
  sub    %ebx,%edx
  call   <SSL_read@plt>
  mov    %eax,%r8d
  lea    0x1(%rax),%eax
  cmp    $0x1,%eax
  jbe    L87
  test   %r8d,%r8d
  js     L88
  add    %r8d,%ebx
  mov    $0x1,%edi
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %ebx,%r12d
  movslq %ebx,%r14
  setge  %dil
  call   <assert@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %r13,(%rsp)
  movb   $0x0,0x0(%rbp,%r14,1)
  call   <strstr@plt>
  test   %rax,%rax
  jne    L143
  cmp    %ebx,%r12d
  jg     L94
  add    %r12d,%r12d
  mov    %rbp,%rdi
  lea    0x1(%r12),%esi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L94
  nopl   0x0(%rax)
L87:
  lea    D20(%rip),%rax
  mov    $0xffffffff,%r8d
  mov    %rax,(%rsp)
L75:
  mov    0x10(%rsp),%rax
  mov    (%rsp),%rsi
  mov    %rbp,%rdi
  mov    %r8d,0x8(%rsp)
  mov    %rbp,(%rax)
  call   <strstr@plt>
  mov    0x8(%rsp),%r8d
  test   %rax,%rax
  je     L58
  sub    %rbp,%rax
  sub    $0x4,%ebx
  sub    %eax,%ebx
  mov    0x18(%rsp),%rax
  mov    %ebx,(%rax)
L100:
  add    $0x28,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L88:
  mov    %rbp,%rdi
  mov    %r8d,(%rsp)
  call   <free@plt>
  mov    (%rsp),%r8d
  jmp    L100
  nopw   0x0(%rax,%rax,1)
L143:
  xor    %r8d,%r8d
  jmp    L75
  nopl   (%rax)
L132:
  lea    D20(%rip),%r15
  nopw   0x0(%rax,%rax,1)
L72:
  movsd  0x8(%rsp),%xmm0
  mov    %r12d,%edx
  lea    0x0(%rbp,%r14,1),%rsi
  mov    %r13d,%edi
  sub    %ebx,%edx
  call   <read_to@plt>
  mov    %eax,%r8d
  lea    0x1(%rax),%eax
  cmp    $0x1,%eax
  jbe    L87
  test   %r8d,%r8d
  js     L88
  add    %r8d,%ebx
  mov    $0x1,%edi
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %ebx,%r12d
  movslq %ebx,%r14
  setge  %dil
  call   <assert@plt>
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    %r15,(%rsp)
  movb   $0x0,0x0(%rbp,%r14,1)
  call   <strstr@plt>
  test   %rax,%rax
  jne    L143
  cmp    %ebx,%r12d
  jg     L72
  add    %r12d,%r12d
  mov    %rbp,%rdi
  lea    0x1(%r12),%esi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L72
  xchg   %ax,%ax
L58:
  mov    0x18(%rsp),%rax
  movl   $0x0,(%rax)
  jmp    L100
```

tool_calls: name: extract_symbolic_data
arguments: tag: D20
type: string

tool: D20: 



assistant: ```c
int get_HTTP_headers(int socket_h, SSL *ssl_h, char **headers, int *overflow, double timeout) {
  char *term = NULL;
  int len_in = 0, len = 4096;
  char *buffer = (char *)malloc(len + 1);
  int rc = 0;
  *headers = NULL;
  memset(buffer, 0x00, len);
  for (;;) {
    int rrc = -1;
    int now_n = len - len_in;
    if (ssl_h)
      rrc = SSL_read(ssl_h, &buffer[len_in], now_n);
    else
      rrc = read_to(socket_h, &buffer[len_in], now_n, timeout);
    if (rrc == 0 || rrc == -1) {
      rc = -1;
      break;
    } else if (rrc < 0) {
      free(buffer);
      return rrc;
    }
    len_in += rrc;
    assert(len_in >= 0);
    assert(len_in <= len);
    buffer[len_in] = 0x00;
    if (strstr(buffer, "\r\n\r\n") != NULL)
      break;
    if (len_in >= len) {
      len <<= 1;
      buffer = (char *)realloc(buffer, len + 1);
    }
  }
  *headers = buffer;
  term = strstr(buffer, "\r\n\r\n");
  if (term)
    *overflow = len_in - (term - buffer + 4);
  else
    *overflow = 0;
  return rc;
}
```