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

```asm
<simple_socket_connect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  lea    -0x40(%rbp),%rdx
  add    $0x10,%rdx
  mov    -0x58(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <inet_pton@plt>
  cmp    $0x1,%eax
  jne    L55
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x40(%rbp)
  mov    -0x5c(%rbp),%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    %rax,-0x38(%rbp)
  jmp    L97
L55:
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  lea    -0x20(%rbp),%rdx
  add    $0x10,%rdx
  mov    -0x58(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <inet_pton@plt>
  cmp    $0x1,%eax
  jne    L65
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x5c(%rbp),%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L97
L65:
  mov    $0xffffffff,%eax
  jmp    L129
L97:
  mov    D1(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x4c(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0xffffffff,-0x44(%rbp)
  jne    L11
  mov    $0xfffffffe,%eax
  jmp    L129
L11:
  movl   $0xffffffff,-0x48(%rbp)
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4c(%rbp)
  jne    L111
  lea    -0x40(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    $0x18,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <connect@plt>
  mov    %eax,-0x48(%rbp)
  jmp    L9
L111:
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4c(%rbp)
  jne    L9
  lea    -0x20(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    $0x18,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <connect@plt>
  mov    %eax,-0x48(%rbp)
L9:
  cmpl   $0x0,-0x48(%rbp)
  je     L79
  mov    -0x44(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0xfffffffd,%eax
  jmp    L129
L79:
  mov    -0x44(%rbp),%eax
L129:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L43
  call   <__stack_chk_fail@plt>
L43:
  leave
  ret
```

assistant: ```c
int simple_socket_connect(const char *address, int port) {
  int family;
  int sock;
  struct sockaddr_in host;
  struct sockaddr_in6 host6;
  if (inet_pton(AF_INET, address, &host.sin_addr.s_addr) == 1) {
    family = AF_INET;
    host.sin_family = family;
    host.sin_port = htons(port);
  } else if (inet_pton(AF_INET6, address, &host6.sin6_addr.s6_addr) == 1) {
    family = AF_INET6;
    host6.sin6_family = family;
    host6.sin6_port = htons(port);
  } else {
    return -1;
  }
  if ((sock = socket(family, SOCK_STREAM, 0)) == -1) {
    return -2;
  }
  int cr = -1;
  if (family == AF_INET) {
    cr = connect(sock, (struct sockaddr *)(&host), sizeof(struct sockaddr_in));
  } else if (family == AF_INET6) {
    cr = connect(sock, (struct sockaddr *)(&host6), sizeof(struct sockaddr_in6));
  }
  if (cr != 0) {
    close(sock);
    return -3;
  }
  return sock;
}
```