user: What is the c source code of the assembly code below?

```asm
<copy_hostent>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpq   $0x0,-0x30(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x34(%rbp),%eax
  sub    $0x28,%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L0
  mov    $0xffffffff,%eax
  jmp    L192
L0:
  mov    -0x28(%rbp),%rax
  mov    0x20(%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,0x20(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x28,-0x30(%rbp)
  mov    -0x8(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,0x8(%rax)
  mov    -0x28(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L88
L32:
  addq   $0x8,-0x18(%rbp)
  addq   $0x8,-0x10(%rbp)
  addl   $0x1,-0x1c(%rbp)
L88:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L32
  addl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x34(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L167
  mov    $0xffffffff,%eax
  jmp    L192
L167:
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x8(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,0x10(%rax)
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L178
L142:
  addq   $0x8,-0x18(%rbp)
  addq   $0x8,-0x10(%rbp)
  addl   $0x1,-0x1c(%rbp)
L178:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L142
  addl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x34(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L23
  mov    $0xffffffff,%eax
  jmp    L192
L23:
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L119
L169:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  sub    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L72
  mov    $0xffffffff,%eax
  jmp    L192
L72:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x10(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  cltq
  add    %rax,-0x30(%rbp)
  addq   $0x8,-0x18(%rbp)
  addq   $0x8,-0x10(%rbp)
L119:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L169
  mov    -0x10(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L48
L168:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strlcpy@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,-0x30(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L100
  mov    $0xffffffff,%eax
  jmp    L192
L100:
  addq   $0x8,-0x18(%rbp)
  addq   $0x8,-0x10(%rbp)
L48:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L168
  mov    -0x10(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,0x18(%rax)
  mov    -0x28(%rbp),%rax
  mov    0x18(%rax),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strlcpy@plt>
  mov    %eax,-0x1c(%rbp)
  addl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,-0x30(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L13
  mov    $0xffffffff,%eax
  jmp    L192
L13:
  mov    -0x8(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <validate_hostent_copy@plt>
  not    %rax
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    $0x0,%eax
L192:
  leave
  ret
```

assistant: ```c
int copy_hostent(const struct hostent *src, char *buf, int len) {
  struct hostent *dst;
  int n;
  char **p, **q;
  assert(src != NULL);
  assert(buf != NULL);
  dst = (struct hostent *)buf;
  if ((len -= sizeof(struct hostent)) < 0)
    return (-1);
  dst->h_addrtype = src->h_addrtype;
  dst->h_length = src->h_length;
  buf += sizeof(struct hostent);
  dst->h_aliases = (char **)buf;
  for (p = src->h_aliases, q = dst->h_aliases, n = 0; *p; p++, q++, n++) {
    ;
  }
  if ((len -= ++n * sizeof(char *)) < 0)
    return (-1);
  buf = (char *)(q + 1);
  dst->h_addr_list = (char **)buf;
  for (p = src->h_addr_list, q = dst->h_addr_list, n = 0; *p; p++, q++, n++) {
    ;
  }
  if ((len -= ++n * sizeof(char *)) < 0)
    return (-1);
  buf = (char *)(q + 1);
  for (p = src->h_addr_list, q = dst->h_addr_list; *p; p++, q++) {
    if ((len -= src->h_length) < 0)
      return (-1);
    memcpy(buf, *p, src->h_length);
    *q = buf;
    buf += src->h_length;
  }
  *q = NULL;
  for (p = src->h_aliases, q = dst->h_aliases; *p; p++, q++) {
    n = strlcpy(buf, *p, len);
    *q = buf;
    buf += ++n;
    if ((len -= n) < 0)
      return (-1);
  }
  *q = NULL;
  dst->h_name = buf;
  n = strlcpy(buf, src->h_name, len);
  buf += ++n;
  if ((len -= n) < 0)
    return (-1);
  assert(validate_hostent_copy(src, dst) >= 0);
  return (0);
}
```