user: Please show me the C implementation that matches the assembly code listed below:

```asm
<xreadlink>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x450,%rsp
  mov    %rdi,-0x448(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x430(%rbp)
  movq   $0x400,-0x428(%rbp)
L94:
  mov    -0x428(%rbp),%rdx
  mov    -0x430(%rbp),%rcx
  mov    -0x448(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <readlink@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  jns    L113
  lea    -0x410(%rbp),%rax
  cmp    %rax,-0x430(%rbp)
  je     L2
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x434(%rbp)
  mov    -0x430(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    D14(%rip),%rax
  mov    -0x434(%rbp),%edx
  mov    %edx,(%rax)
L2:
  mov    $0x0,%eax
  jmp    L115
L113:
  mov    -0x420(%rbp),%rax
  cmp    %rax,-0x428(%rbp)
  jbe    L114
  mov    -0x420(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x420(%rbp)
  mov    %rax,%rdx
  mov    -0x430(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  lea    -0x410(%rbp),%rax
  cmp    %rax,-0x430(%rbp)
  jne    L108
  mov    -0x420(%rbp),%rax
  mov    %rax,%rdi
  call   <xmalloc@plt>
  mov    %rax,-0x430(%rbp)
  mov    -0x420(%rbp),%rdx
  lea    -0x410(%rbp),%rcx
  mov    -0x430(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L121
L108:
  mov    -0x420(%rbp),%rax
  cmp    %rax,-0x428(%rbp)
  jbe    L121
  mov    -0x420(%rbp),%rdx
  mov    -0x430(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  je     L121
  mov    -0x418(%rbp),%rax
  mov    %rax,-0x430(%rbp)
L121:
  mov    -0x430(%rbp),%rax
  jmp    L115
L114:
  lea    -0x410(%rbp),%rax
  cmp    %rax,-0x430(%rbp)
  je     L53
  mov    -0x430(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L53:
  shlq   -0x428(%rbp)
  mov    -0x428(%rbp),%rax
  test   %rax,%rax
  jns    L70
  mov    $0x0,%eax
  call   <xalloc_die@plt>
L70:
  mov    -0x428(%rbp),%rax
  mov    %rax,%rdi
  call   <xmalloc@plt>
  mov    %rax,-0x430(%rbp)
  jmp    L94
L115:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L41
  call   <__stack_chk_fail@plt>
L41:
  leave
  ret
```

assistant: ```c
char *xreadlink(char const *filename) {
  char initial_buf[1024];
  char *buffer = initial_buf;
  size_t buf_size = sizeof(initial_buf);
  while (1) {
    ssize_t link_length = readlink(filename, buffer, buf_size);
    if (link_length < 0) {
      if (buffer != initial_buf) {
        int saved_errno = errno;
        free(buffer);
        errno = saved_errno;
      }
      return NULL;
    }
    if ((size_t)link_length < buf_size) {
      buffer[link_length++] = '\0';
      if (buffer == initial_buf) {
        buffer = (char *)xmalloc(link_length);
        memcpy(buffer, initial_buf, link_length);
      } else {
        if ((size_t)link_length < buf_size) {
          char *smaller_buffer = (char *)realloc(buffer, link_length);
          if (smaller_buffer != NULL)
            buffer = smaller_buffer;
        }
      }
      return buffer;
    }
    if (buffer != initial_buf)
      free(buffer);
    buf_size *= 2;
    if (((ssize_t)(((size_t)-1) / 2)) < buf_size || (((size_t)-1) / 2 < ((ssize_t)(((size_t)-1) / 2)) && buf_size == 0))
      xalloc_die();
    buffer = (char *)xmalloc(buf_size);
  }
}
```