user: Demonstrate the C code that generates the assembly output below:

```asm
<connect_timeout>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x38(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D114(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x34(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  mov    %eax,-0x1c(%rbp)
  mov    D81(%rip),%rax
  mov    (%rax),%eax
  and    -0x1c(%rbp),%eax
  test   %eax,%eax
  jne    L113
  mov    D81(%rip),%rax
  mov    (%rax),%eax
  or     -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    D209(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  jmp    L126
L113:
  nop
L126:
  mov    -0x38(%rbp),%edx
  mov    -0x40(%rbp),%rcx
  mov    -0x34(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <connect@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L70
  mov    D96(%rip),%rax
  mov    (%rax),%edx
  mov    D82(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L60
  jmp    L126
L60:
  mov    D96(%rip),%rax
  mov    (%rax),%edx
  mov    D169(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L48
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    D115(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
L93:
  mov    -0x44(%rbp),%eax
  imul   $0x3e8,%eax,%edx
  lea    -0x10(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <poll@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L72
  mov    D96(%rip),%rax
  mov    (%rax),%edx
  mov    D82(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L7
  jmp    L93
L72:
  cmpl   $0x0,-0x18(%rbp)
  jne    L70
  mov    D96(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    D96(%rip),%rax
  mov    -0x14(%rbp),%edx
  mov    %edx,(%rax)
  jmp    L145
L70:
  movl   $0x4,-0x20(%rbp)
  mov    D99(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    (%rax),%esi
  lea    -0x20(%rbp),%rdi
  lea    -0x24(%rbp),%rcx
  mov    -0x34(%rbp),%eax
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <getsockopt@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  test   %eax,%eax
  je     L141
  mov    -0x24(%rbp),%edx
  mov    D96(%rip),%rax
  mov    %edx,(%rax)
  jmp    L145
L141:
  mov    D81(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    D209(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  mov    $0x0,%eax
  jmp    L158
L48:
  nop
  jmp    L145
L7:
  nop
L145:
  mov    D96(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    D209(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  mov    D96(%rip),%rax
  mov    -0x14(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
L158:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L38
  call   <__stack_chk_fail@plt>
L38:
  leave
  ret
```

assistant: ```c
int connect_timeout(int s, struct sockaddr *saddrp, int len, int time_secs) {
  struct pollfd pfds;
  int ret, oldfl, err, val;
  socklen_t val_len;
  oldfl = fcntl(s, F_GETFL, 0);
  if (!(oldfl & O_NONBLOCK))
    fcntl(s, F_SETFL, oldfl | O_NONBLOCK);
connect_timeout_connect_restart:
  ret = connect(s, saddrp, len);
  if (ret < 0) {
    if (errno == EINTR)
      goto connect_timeout_connect_restart;
    if (errno != EINPROGRESS)
      goto connect_timeout_err;
    pfds.fd = s;
    pfds.events = POLLOUT;
  connect_timeout_poll_restart:
    ret = poll(&pfds, 1, time_secs * 1000);
    if (ret < 0) {
      if (errno == EINTR)
        goto connect_timeout_poll_restart;
      else
        goto connect_timeout_err;
    }
    if (ret == 0) {
      err = errno;
      close(s);
      errno = err;
      goto connect_timeout_err;
    }
  }
  val_len = sizeof(val);
  ret = getsockopt(s, SOL_SOCKET, SO_ERROR, &val, &val_len);
  if (val != 0) {
    errno = val;
    goto connect_timeout_err;
  }
  fcntl(s, F_SETFL, oldfl & (~O_NONBLOCK));
  return 0;
connect_timeout_err:
  err = errno;
  fcntl(s, F_SETFL, oldfl);
  errno = err;
  return -1;
}
```