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

```asm
<http_nak>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  mov    %esi,%r12d
  xor    %esi,%esi
  push   %rbp
  mov    %rdx,%rbp
  mov    $0x400,%edx
  push   %rbx
  sub    $0x818,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x808(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  lea    0x400(%rsp),%r15
  mov    %r13,%rdi
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x400,%edx
  mov    %r15,%rdi
  call   <memset@plt>
  mov    %r12d,%r8d
  mov    %r12d,%ecx
  mov    %rbp,%r9
  lea    D11(%rip),%rdx
  mov    $0x400,%esi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    $0x400,%esi
  mov    %rbp,%rcx
  mov    %r13,%rdi
  movslq %eax,%r9
  lea    D47(%rip),%rdx
  lea    D34(%rip),%r8
  xor    %eax,%eax
  mov    %r9,%rbx
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %r13,%rsi
  mov    %r14d,%edi
  mov    %eax,%edx
  mov    %eax,%r12d
  call   <write@plt>
  cmp    %r12d,%eax
  jne    L40
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <write@plt>
  cmp    %ebx,%eax
  jne    L13
  xor    %eax,%eax
L6:
  mov    0x808(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x818,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L40:
  mov    %rbp,%rsi
  lea    D42(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L6
L13:
  mov    %rbp,%rsi
  lea    D30(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L6
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D11
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D47
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D34
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D42
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D30
type_guessed: string

tool: D11: <!DOCTYPE html PUBLIC "-//IEIF//DTD HTML 2.0//EN">
<html><head><title>Error %d</title>
</head><body>
<h2>Error %d</h2><h2>Helight Server: %s</h2></body></html>


tool: D47: HTTP/1.1 %s
Server: Helight
%s
Content-Length: %ld



tool: D34: Content-Type: text/html

tool: D42: writer head error: %s


tool: D30: writer body  error: %s


assistant: ```c
int http_nak(int fd, int code, const char *nak) {
  int len, len2;
  char buf[1024], buf2[1024];
  memset(buf, '\0', sizeof(buf));
  memset(buf2, '\0', sizeof(buf2));
  snprintf(buf2, sizeof(buf2),
           "<!DOCTYPE html PUBLIC \"-//IEIF//DTD HTML 2.0//EN\">\n"
           "<html><head><title>Error %d</title>\n"
           "</head><body>\n"
           "<h2>Error %d</h2>"
           "<h2>Helight Server: %s</h2>"
           "</body></html>\r\n",
           code, code, nak);
  len2 = strlen(buf2);
  snprintf(buf, sizeof(buf), "HTTP/1.1 %s\r\nServer: Helight\r\n%s\r\nContent-Length: %ld\r\n\r\n", nak, "Content-Type: text/html", (long)len2);
  len = strlen(buf);
  if (len != write(fd, buf, len)) {
    printf("writer head error: %s\n", nak);
    return -1;
  }
  if (len2 != write(fd, buf2, len2)) {
    printf("writer body  error: %s\n", nak);
    return -1;
  }
  return 0;
}
```