user: What would the C source look like for the assembly code provided here?

```asm
<ares_expand_name>:
  endbr64
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8,%rbx
  call   <name_length@plt>
  mov    %rax,%r14
  mov    $0x8,%eax
  test   %r14,%r14
  js     L59
  lea    0x1(%r14),%edi
  call   <malloc@plt>
  mov    %rax,0x0(%rbp)
  mov    %rax,%rsi
  test   %rax,%rax
  je     L69
  test   %r14,%r14
  je     L58
  movzbl (%r12),%r8d
  mov    %r12,%rdx
  xor    %r9d,%r9d
  test   %r8b,%r8b
  jne    L163
  jmp    L130
  nopl   (%rax)
L47:
  test   %r9d,%r9d
  jne    L153
  lea    0x2(%rdx),%rax
  sub    %r12,%rax
  mov    %rax,(%rbx)
L153:
  movzbl (%rdx),%eax
  movzbl 0x1(%rdx),%edx
  mov    $0x1,%r9d
  shl    $0x8,%eax
  and    $0xffff3f00,%eax
  or     %edx,%eax
  cltq
  lea    0x0(%r13,%rax,1),%rdx
  movzbl (%rdx),%r8d
  test   %r8b,%r8b
  je     L129
L163:
  mov    %r8d,%eax
  and    $0xffffffc0,%eax
  cmp    $0xc0,%al
  je     L47
  lea    0x1(%r8),%edi
  lea    0x1(%rdx),%r10
  movzbl %dil,%edi
  mov    %r10,%rax
  add    %rdx,%rdi
  jmp    L104
  nopl   0x0(%rax)
L143:
  add    $0x1,%rax
  mov    %dl,(%rcx)
  lea    0x1(%rcx),%rsi
  cmp    %rdi,%rax
  je     L15
L104:
  movzbl (%rax),%edx
  cmp    $0x2e,%dl
  je     L62
  mov    %rsi,%rcx
  cmp    $0x5c,%dl
  jne    L143
L62:
  movb   $0x5c,(%rsi)
  movzbl (%rax),%edx
  lea    0x1(%rsi),%rcx
  add    $0x1,%rax
  lea    0x1(%rcx),%rsi
  mov    %dl,(%rcx)
  cmp    %rdi,%rax
  jne    L104
L15:
  movzbl %r8b,%edx
  movb   $0x2e,0x1(%rcx)
  lea    0x2(%rcx),%rsi
  add    %r10,%rdx
  movzbl (%rdx),%r8d
  test   %r8b,%r8b
  jne    L163
L129:
  mov    0x0(%rbp),%rax
  test   %r9d,%r9d
  je     L130
  cmp    %rax,%rsi
  jbe    L29
L175:
  movb   $0x0,-0x1(%rsi)
  xor    %eax,%eax
L59:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L58:
  movb   $0x0,(%rax)
  xor    %eax,%eax
  movq   $0x1,(%rbx)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L130:
  add    $0x1,%rdx
  sub    %r12,%rdx
  mov    %rdx,(%rbx)
  cmp    %rax,%rsi
  ja     L175
L29:
  movb   $0x0,(%rsi)
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L69:
  mov    $0xf,%eax
  jmp    L59
```

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;
}
```