user: Converte this assembly snippet into its equivalent C code:

```asm
<get_time_from_socket>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0xffffffffffffffff,-0x40(%rbp)
  mov    D1(%rip),%rax
  mov    (%rax),%ecx
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x48(%rbp)
  cmpl   $0x0,-0x48(%rbp)
  jns    L5
  mov    $0xffffffffffffffff,%rax
  jmp    L106
L5:
  lea    -0x38(%rbp),%rax
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x38(%rbp),%eax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <strcpy@plt>
  mov    -0x38(%rbp),%eax
  mov    %eax,%edi
  call   <strlen@plt>
  add    $0x5,%eax
  mov    %eax,-0x44(%rbp)
L116:
  mov    -0x44(%rbp),%edx
  lea    -0x38(%rbp),%rcx
  mov    -0x48(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <connect@plt>
  test   %rax,%rax
  jns    L63
  mov    D81(%rip),%rax
  mov    (%rax),%rdx
  mov    D12(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L75
  mov    D81(%rip),%rax
  mov    (%rax),%rdx
  mov    D75(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L75
  mov    D25(%rip),%eax
  test   %eax,%eax
  jne    L75
  movl   $0x1,D25(%rip)
  movl   $0x0,-0x4c(%rbp)
  jmp    L123
L103:
  lea    -0x50(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L2
  jmp    L116
L2:
  mov    $0x2710,%edi
  call   <usleep@plt>
  addl   $0x1,-0x4c(%rbp)
L123:
  cmpl   $0x63,-0x4c(%rbp)
  jle    L103
L75:
  mov    -0x48(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0xffffffffffffffff,%rax
  jmp    L106
L63:
  lea    -0x30(%rbp),%rcx
  mov    -0x48(%rbp),%eax
  mov    $0x1f,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x44(%rbp)
  mov    -0x48(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  cmpl   $0x0,-0x44(%rbp)
  jle    L83
  mov    -0x44(%rbp),%eax
  cltq
  movb   $0x0,-0x30(%rbp,%rax,1)
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <atol@plt>
  mov    %rax,-0x40(%rbp)
L83:
  mov    -0x40(%rbp),%rax
L106:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L94
  call   <__stack_chk_fail@plt>
L94:
  leave
  ret
```

assistant: ```c
long get_time_from_socket(const char *socket_name) {
  int fd;
  int len;
  struct sockaddr_un addr;
  char buf[32];
  long rem = -1;
  static int first_time = 0;
  if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
    return -1;
  }
  memset(&addr, 0, sizeof(addr));
  addr.sun_family = AF_UNIX;
  strcpy(addr.sun_path, socket_name);
  len = strlen(addr.sun_path) + 1 + sizeof(addr.sun_family);
again:
  if (connect(fd, (struct sockaddr *)&addr, len) < 0) {
    if (errno == ECONNREFUSED) {
    } else if (errno == ENOENT) {
      if (!first_time) {
        struct stat statbuf;
        int i;
        first_time = 1;
        for (i = 0; i < 100; i++) {
          if (stat(socket_name, &statbuf) == 0)
            goto again;
          usleep(10000);
        }
      }
    }
    close(fd);
    return -1;
  }
  len = read(fd, buf, 31);
  close(fd);
  if (len > 0) {
    buf[len] = '\0';
    rem = atol(buf);
  }
  return rem;
}
```