user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ss_accept_ipv6_connection_impl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x18(%rbp),%rax
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x4,-0x14(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L123
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <Slock_object@plt>
L123:
  mov    $0x0,%eax
  call   <Sdeactivate_thread@plt>
L73:
  lea    -0x14(%rbp),%rdx
  lea    -0x18(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <accept@plt>
  mov    %eax,-0x10(%rbp)
  cmpl   $0xffffffff,-0x10(%rbp)
  je     L114
  mov    D74(%rip),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  mov    %eax,%edx
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D94(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x10(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
L114:
  cmpl   $0xffffffff,-0x10(%rbp)
  jne    L84
  mov    D52(%rip),%rax
  mov    (%rax),%edx
  mov    D82(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L73
L84:
  mov    D52(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    $0x0,%eax
  call   <Sactivate_thread@plt>
  cmpq   $0x0,-0x30(%rbp)
  je     L95
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <Sunlock_object@plt>
L95:
  mov    -0x14(%rbp),%eax
  cmp    $0x4,%eax
  jbe    L94
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    D52(%rip),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L24
L94:
  cmpl   $0xffffffff,-0x10(%rbp)
  jne    L11
  mov    D52(%rip),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
  mov    D31(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  je     L45
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jne    L37
L45:
  mov    $0xfffffffe,%eax
  jmp    L24
L37:
  mov    $0xffffffff,%eax
  jmp    L24
L11:
  cmpq   $0x0,-0x30(%rbp)
  je     L32
  lea    -0x18(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L32:
  mov    -0x10(%rbp),%eax
L24:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L103
  call   <__stack_chk_fail@plt>
L103:
  leave
  ret
```

assistant: ```c
int ss_accept_ipv6_connection_impl(int sock, uint8_t *connection) {
  struct sockaddr_in6 addr;
  memset(&addr, 0, sizeof(addr));
  socklen_t addr_len = sizeof(addr);
  if (connection)
    Slock_object((void *)connection);
  Sdeactivate_thread();
  int connect_sock;
  do {
    connect_sock = accept(sock, (struct sockaddr *)&addr, &addr_len);
    if (connect_sock != -1) {
      fcntl(connect_sock, F_SETFD, fcntl(connect_sock, F_GETFD) | FD_CLOEXEC);
    }
  } while (connect_sock == -1 && errno == EINTR);
  int saved_errno = errno;
  Sactivate_thread();
  if (connection)
    Sunlock_object((void *)connection);
  if (addr_len > sizeof(addr)) {
    close(connect_sock);
    errno = saved_errno;
    return -1;
  }
  if (connect_sock == -1) {
    errno = saved_errno;
    if (saved_errno == EAGAIN || saved_errno == EWOULDBLOCK)
      return -2;
    return -1;
  }
  if (connection)
    memcpy(connection, &addr.sin6_addr.s6_addr, sizeof(addr.sin6_addr.s6_addr));
  return connect_sock;
}
```