user: What is the c source code of the assembly code below:

```asm
<write_retry>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L76
L121:
  lea    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x24(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x50(%rbp),%rcx
  lea    -0x24(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %rax,%rdx
  mov    $0x0,%esi
  call   <select_retry@plt>
  mov    %eax,-0x20(%rbp)
  cmpl   $0xffffffff,-0x20(%rbp)
  jne    L5
  mov    $0xffffffffffffffff,%rax
  jmp    L27
L5:
  cmpl   $0x0,-0x20(%rbp)
  jne    L69
  mov    D57(%rip),%rax
  mov    (%rax),%rdx
  mov    D7(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffffffffffff,%rax
  jmp    L27
L69:
  lea    -0x24(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L118
  mov    D96(%rip),%rax
  mov    (%rax),%rdx
  mov    D7(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffffffffffff,%rax
  jmp    L27
L118:
  mov    -0x18(%rbp),%rax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jne    L98
  cmpl   $0x1,-0x20(%rbp)
  jne    L98
  mov    D96(%rip),%rax
  mov    (%rax),%rdx
  mov    D7(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffffffffffff,%rax
  jmp    L27
L98:
  cmpl   $0xffffffff,-0x1c(%rbp)
  jne    L13
  mov    D7(%rip),%rax
  mov    (%rax),%rdx
  mov    D95(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L76
  mov    D7(%rip),%rax
  mov    (%rax),%rdx
  mov    D1(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L117
  jmp    L76
L117:
  mov    $0xffffffffffffffff,%rax
  jmp    L27
L13:
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  sub    %rax,-0x10(%rbp)
L76:
  mov    -0x18(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jb     L121
  mov    -0x18(%rbp),%rax
L27:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L81
  call   <__stack_chk_fail@plt>
L81:
  leave
  ret
```

assistant: ```c
ssize_t write_retry(int fd, void *buf, size_t count, struct timeval *timeout) {
  int n, rv = 0;
  ssize_t total = 0, remain = count;
  fd_set wfds, xfds;
  while (total < count) {
    FD_ZERO(&wfds);
    FD_SET(fd, &wfds);
    FD_ZERO(&xfds);
    FD_SET(fd, &xfds);
    rv = select_retry(fd + 1, NULL, &wfds, &xfds, timeout);
    if (rv == -1)
      return -1;
    else if (rv == 0) {
      errno = ETIMEDOUT;
      return -1;
    }
    if (FD_ISSET(fd, &xfds)) {
      errno = EPIPE;
      return -1;
    }
    n = write(fd, (char *)buf + (off_t)total, remain);
    if ((n == 0) && (rv == 1)) {
      errno = EPIPE;
      return -1;
    }
    if (n == -1) {
      if ((errno == EAGAIN) || (errno == EINTR)) {
        continue;
      }
      return -1;
    }
    total += n;
    remain -= n;
  }
  return total;
}
```