user: What would the C source look like for the assembly code provided here:

```asm
<connect_nb>:
  endbr64
  push   %r15
  mov    $0x4,%r8d
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x48,%rsp
  mov    D123(%rip),%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    D96(%rip),%rax
  lea    0xc(%rsp),%rcx
  movl   $0x1,0xc(%rsp)
  mov    (%r14),%esi
  mov    (%rax),%edx
  call   <setsockopt@plt>
  test   %rax,%rax
  js     L77
  mov    D97(%rip),%rax
  xor    %edx,%edx
  mov    %ebp,%edi
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    D20(%rip),%rdx
  mov    D72(%rip),%r15
  mov    %ebp,%edi
  mov    %eax,0xc(%rsp)
  mov    (%r15),%esi
  or     (%rdx),%eax
  mov    %eax,%edx
  call   <fcntl@plt>
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <connect@plt>
  test   %eax,%eax
  js     L84
  je     L130
L55:
  lea    0x18(%rsp),%r12
  lea    0x1c(%rsp),%r13
  mov    %r12,%rdi
  call   <FD_ZERO@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_SET@plt>
  mov    %r13,%rdi
  call   <FD_ZERO@plt>
  mov    %r13,%rsi
  mov    %ebp,%edi
  call   <FD_SET@plt>
  xor    %ecx,%ecx
  lea    0x1(%rbp),%edi
  lea    0x20(%rsp),%r8
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %ebx,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  call   <select@plt>
  test   %rax,%rax
  je     L100
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L76
L119:
  mov    (%r14),%esi
  lea    0x10(%rsp),%rcx
  lea    0x14(%rsp),%r8
  mov    %ebp,%edi
  mov    D38(%rip),%rax
  movl   $0x4,0x14(%rsp)
  mov    (%rax),%edx
  call   <getsockopt@plt>
  test   %rax,%rax
  js     L78
  mov    0x10(%rsp),%r12d
  test   %r12d,%r12d
  jne    L3
  mov    0xc(%rsp),%edx
  mov    (%r15),%esi
  mov    %ebp,%edi
  call   <fcntl@plt>
L0:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x48,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L76:
  mov    %r13,%rsi
  mov    %ebp,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  jne    L119
  nopl   0x0(%rax,%rax,1)
L130:
  mov    D75(%rip),%rax
  mov    (%rax),%edx
  mov    D48(%rip),%rax
  mov    %edx,(%rax)
L77:
  mov    $0xffffffff,%r12d
  jmp    L0
  nopw   0x0(%rax,%rax,1)
L84:
  mov    D109(%rip),%rax
  mov    D48(%rip),%rdx
  mov    (%rax),%eax
  cmp    %eax,(%rdx)
  je     L55
  jmp    L77
  nopw   0x0(%rax,%rax,1)
L100:
  mov    D18(%rip),%rax
  mov    $0xffffffff,%r12d
  mov    (%rax),%edx
  mov    D48(%rip),%rax
  mov    %edx,(%rax)
  jmp    L0
  nopl   (%rax)
L3:
  mov    %ebp,%edi
  mov    $0xffffffff,%r12d
  call   <close@plt>
  mov    D48(%rip),%rax
  mov    0x10(%rsp),%edx
  mov    %edx,(%rax)
  jmp    L0
L78:
  mov    %ebp,%edi
  mov    $0xffffffff,%r12d
  call   <close@plt>
  jmp    L0
L29:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int connect_nb(int fd, struct sockaddr *dest, socklen_t len, int timeout) {
  int ret, flags = 1, err;
  unsigned l;
  fd_set rfds, wfds;
  struct timeval tv;
  if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags)) < 0)
    return -1;
  flags = fcntl(fd, F_GETFL, 0);
  fcntl(fd, F_SETFL, flags | O_NONBLOCK);
  ret = connect(fd, dest, len);
  if ((ret < 0) && (errno != EINPROGRESS))
    return -1;
  if (ret != 0) {
    FD_ZERO(&rfds);
    FD_SET(fd, &rfds);
    FD_ZERO(&wfds);
    FD_SET(fd, &wfds);
    tv.tv_sec = timeout;
    tv.tv_usec = 0;
    if (select(fd + 1, &rfds, &wfds, NULL, &tv) == 0) {
      errno = ETIMEDOUT;
      return -1;
    }
    if (FD_ISSET(fd, &rfds) || FD_ISSET(fd, &wfds)) {
      l = sizeof(err);
      if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &l) < 0) {
        close(fd);
        return -1;
      }
      if (err != 0) {
        close(fd);
        errno = err;
        return -1;
      }
      fcntl(fd, F_SETFL, flags);
      return 0;
    }
  }
  errno = EIO;
  return -1;
}
```