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

```asm
<ares_expand_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <name_length@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  test   %rax,%rax
  jns    L85
  mov    $0x8,%eax
  jmp    L7
L85:
  mov    -0x18(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    -0x40(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L57
  mov    $0xf,%eax
  jmp    L7
L57:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  test   %rax,%rax
  jne    L20
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x48(%rbp),%rax
  movq   $0x1,(%rax)
  mov    $0x0,%eax
  jmp    L7
L20:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L66
L31:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0xc0,%eax
  jne    L109
  cmpl   $0x0,-0x1c(%rbp)
  jne    L55
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,(%rax)
  movl   $0x1,-0x1c(%rbp)
L55:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  and    $0xffff3f00,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L66
L109:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  addq   $0x1,-0x8(%rbp)
  jmp    L100
L52:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L58
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L88
L58:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
L88:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addq   $0x1,-0x8(%rbp)
L100:
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  test   %eax,%eax
  jne    L52
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x2e,(%rax)
L66:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L31
  cmpl   $0x0,-0x1c(%rbp)
  jne    L107
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,(%rax)
L107:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x10(%rbp)
  jbe    L74
  mov    -0x10(%rbp),%rax
  sub    $0x1,%rax
  movb   $0x0,(%rax)
  jmp    L81
L74:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
L81:
  mov    $0x0,%eax
L7:
  leave
  ret
```

assistant: ```c
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, int alen, char **s, long *enclen) {
  int len, indir = 0;
  char *q;
  const unsigned char *p;
  union {
    ssize_t sig;
    size_t uns;
  } nlen;
  nlen.sig = name_length(encoded, abuf, alen);
  if (nlen.sig < 0)
    return 8;
  *s = malloc(nlen.uns + 1);
  if (!*s)
    return 15;
  q = *s;
  if (nlen.uns == 0) {
    q[0] = '\0';
    *enclen = 1;
    return 0;
  }
  p = encoded;
  while (*p) {
    if ((*p & 0xc0) == 0xc0) {
      if (!indir) {
        *enclen = p + 2 - encoded;
        indir = 1;
      }
      p = abuf + ((*p & ~0xc0) << 8 | *(p + 1));
    } else {
      len = *p;
      p++;
      while (len--) {
        if (*p == '.' || *p == '\\')
          *q++ = '\\';
        *q++ = *p;
        p++;
      }
      *q++ = '.';
    }
  }
  if (!indir)
    *enclen = p + 1 - encoded;
  if (q > *s)
    *(q - 1) = 0;
  else
    *q = 0;
  return 0;
}
```