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

```asm
<connect_nb>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %edx,%r12d
  mov    %ecx,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movl   $0x1,0xc(%rsp)
  lea    0xc(%rsp),%rcx
  mov    $0x4,%r8d
  mov    D119(%rip),%rax
  mov    (%rax),%edx
  mov    D113(%rip),%rax
  mov    (%rax),%esi
  call   <setsockopt@plt>
  test   %rax,%rax
  js     L90
  mov    $0x0,%edx
  mov    D139(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <fcntl@plt>
  mov    %eax,0xc(%rsp)
  mov    D122(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,%edx
  mov    D34(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <fcntl@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <connect@plt>
  test   %eax,%eax
  js     L38
  je     L92
L146:
  lea    0x18(%rsp),%rbp
  mov    %rbp,%rdi
  call   <FD_ZERO@plt>
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <FD_SET@plt>
  lea    0x1c(%rsp),%r12
  mov    %r12,%rdi
  call   <FD_ZERO@plt>
  mov    %r12,%rsi
  mov    %ebx,%edi
  call   <FD_SET@plt>
  mov    %r13d,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  lea    0x1(%rbx),%edi
  lea    0x20(%rsp),%r8
  mov    $0x0,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <select@plt>
  test   %rax,%rax
  je     L93
  lea    0x18(%rsp),%rsi
  mov    %ebx,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  jne    L131
  lea    0x1c(%rsp),%rsi
  mov    %ebx,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  je     L92
L131:
  movl   $0x4,0x14(%rsp)
  lea    0x10(%rsp),%rcx
  lea    0x14(%rsp),%r8
  mov    D71(%rip),%rax
  mov    (%rax),%edx
  mov    D113(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <getsockopt@plt>
  test   %rax,%rax
  js     L133
  mov    0x10(%rsp),%ebp
  test   %ebp,%ebp
  jne    L153
  mov    0xc(%rsp),%edx
  mov    D34(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <fcntl@plt>
L35:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L122
  mov    %ebp,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L38:
  mov    D8(%rip),%rdx
  mov    D74(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,(%rdx)
  je     L146
  mov    $0xffffffff,%ebp
  jmp    L35
L93:
  mov    D63(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%ebp
  jmp    L35
L133:
  mov    %ebx,%edi
  call   <close@plt>
  mov    $0xffffffff,%ebp
  jmp    L35
L153:
  mov    %ebx,%edi
  call   <close@plt>
  mov    D8(%rip),%rax
  mov    0x10(%rsp),%edx
  mov    %edx,(%rax)
  mov    $0xffffffff,%ebp
  jmp    L35
L92:
  mov    D46(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%ebp
  jmp    L35
L90:
  mov    $0xffffffff,%ebp
  jmp    L35
L122:
  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;
}
```