user: Translate the below assembly code into C programming language:

```asm
<ss_connect_to_ipv6_host_impl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,%eax
  mov    %ecx,-0x68(%rbp)
  mov    %ax,-0x64(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rax
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    D97(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <Slock_object@plt>
  cmpq   $0x0,-0x60(%rbp)
  je     L201
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <Slock_object@plt>
L201:
  mov    $0x0,%eax
  call   <Sdeactivate_thread@plt>
  movl   $0x0,-0x48(%rbp)
  lea    -0x38(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  mov    -0x60(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <getaddrinfo@plt>
  test   %rax,%rax
  jne    L95
  mov    -0x38(%rbp),%rax
  test   %rax,%rax
  jne    L153
L95:
  mov    D167(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
  mov    $0x0,%eax
  call   <Sactivate_thread@plt>
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <Sunlock_object@plt>
  cmpq   $0x0,-0x60(%rbp)
  je     L150
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <Sunlock_object@plt>
L150:
  mov    D167(%rip),%rax
  mov    -0x48(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L96
L153:
  movl   $0x0,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L43
L62:
  movl   $0x0,-0x40(%rbp)
  mov    D97(%rip),%rax
  mov    (%rax),%ecx
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0xffffffff,-0x44(%rbp)
  jne    L41
  mov    D167(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
  movl   $0xfffffffe,-0x40(%rbp)
  jmp    L160
L41:
  mov    D125(%rip),%rax
  mov    (%rax),%edx
  mov    -0x44(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  mov    %eax,%edx
  mov    D148(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D61(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x44(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  cmpl   $0x0,-0x68(%rbp)
  jne    L8
  mov    -0x44(%rbp),%eax
  mov    %eax,%edi
  call   <ss_set_fd_non_blocking@plt>
  test   %eax,%eax
  jne    L8
  mov    D167(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
  mov    -0x44(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  movl   $0xfffffffe,-0x40(%rbp)
  jmp    L160
L8:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x28(%rbp)
  cmpw   $0x0,-0x64(%rbp)
  je     L208
  movzwl -0x64(%rbp),%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    -0x28(%rbp),%rdx
  mov    %eax,(%rdx)
L208:
  mov    -0x28(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <connect@plt>
  mov    %eax,-0x3c(%rbp)
  cmpl   $0xffffffff,-0x3c(%rbp)
  jne    L165
  mov    D167(%rip),%rax
  mov    (%rax),%edx
  mov    D129(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L208
L165:
  mov    D167(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
  cmpl   $0xffffffff,-0x3c(%rbp)
  jne    L160
  mov    D167(%rip),%rax
  mov    (%rax),%edx
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L160
  mov    -0x44(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  movl   $0xfffffffd,-0x40(%rbp)
  nop
  mov    -0x30(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x30(%rbp)
L43:
  cmpq   $0x0,-0x30(%rbp)
  jne    L62
L160:
  mov    $0x0,%eax
  call   <Sactivate_thread@plt>
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <Sunlock_object@plt>
  cmpq   $0x0,-0x60(%rbp)
  je     L94
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <Sunlock_object@plt>
L94:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <freeaddrinfo@plt>
  mov    D167(%rip),%rax
  mov    -0x48(%rbp),%edx
  mov    %edx,(%rax)
  cmpl   $0x0,-0x40(%rbp)
  je     L141
  mov    -0x40(%rbp),%eax
  jmp    L96
L141:
  mov    -0x44(%rbp),%eax
L96:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L33
  call   <__stack_chk_fail@plt>
L33:
  leave
  ret
```

assistant: ```c
int ss_connect_to_ipv6_host_impl(const char *address, const char *service, unsigned short port, int blocking) {
  struct addrinfo hints;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_INET6;
  hints.ai_socktype = SOCK_STREAM;
  Slock_object((void *)address);
  if (service)
    Slock_object((void *)service);
  Sdeactivate_thread();
  struct addrinfo *info;
  int saved_errno = 0;
  if (getaddrinfo(address, service, &hints, &info) || info == NULL) {
    saved_errno = errno;
    Sactivate_thread();
    Sunlock_object((void *)address);
    if (service)
      Sunlock_object((void *)service);
    errno = saved_errno;
    return -1;
  }
  int sock;
  struct addrinfo *tmp;
  int err = 0;
  for (tmp = info; tmp != NULL; tmp = tmp->ai_next) {
    err = 0;
    sock = socket(AF_INET6, SOCK_STREAM, 0);
    if (sock == -1) {
      saved_errno = errno;
      err = -2;
      break;
    }
    fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC);
    if (!blocking && !(ss_set_fd_non_blocking(sock))) {
      saved_errno = errno;
      close(sock);
      err = -2;
      break;
    }
    struct sockaddr *in = tmp->ai_addr;
    if (port > 0)
      ((struct sockaddr_in6 *)in)->sin6_port = htons(port);
    int res;
    do {
      res = connect(sock, in, sizeof(struct sockaddr_in6));
    } while (res == -1 && errno == EINTR);
    saved_errno = errno;
    if (res == -1 && errno != EINPROGRESS) {
      close(sock);
      err = -3;
      continue;
    } else
      break;
  }
  Sactivate_thread();
  Sunlock_object((void *)address);
  if (service)
    Sunlock_object((void *)service);
  freeaddrinfo(info);
  errno = saved_errno;
  if (err)
    return err;
  return sock;
}
```