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

```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     L142
  lea    0x1(%r14),%edi
  call   <malloc@plt>
  mov    %rax,0x0(%rbp)
  mov    %rax,%rdx
  test   %rax,%rax
  je     L128
  test   %r14,%r14
  je     L12
  movzbl (%r12),%esi
  mov    %r12,%rax
  xor    %r8d,%r8d
  mov    %rdx,%rcx
  test   %sil,%sil
  jne    L185
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L177:
  test   %r8d,%r8d
  jne    L131
  lea    0x2(%rax),%rcx
  sub    %r12,%rcx
  mov    %rcx,(%rbx)
  movzbl (%rax),%esi
L131:
  movzbl 0x1(%rax),%eax
  shl    $0x8,%esi
  mov    $0x1,%r8d
  and    $0x3f00,%esi
  or     %esi,%eax
  cltq
  add    %r13,%rax
  movzbl (%rax),%esi
  test   %sil,%sil
  je     L83
L185:
  mov    %esi,%ecx
  and    $0xffffffc0,%ecx
  cmp    $0xc0,%cl
  je     L177
  lea    0x1(%rsi),%edi
  lea    0x1(%rax),%r9
  movzbl %dil,%edi
  add    %rax,%rdi
  mov    %r9,%rax
  jmp    L162
  nopl   0x0(%rax)
L14:
  add    $0x1,%rax
  mov    %cl,(%rdx)
  lea    0x1(%rdx),%r10
  cmp    %rdi,%rax
  je     L89
L112:
  mov    %r10,%rdx
L162:
  movzbl (%rax),%ecx
  cmp    $0x2e,%cl
  je     L160
  cmp    $0x5c,%cl
  jne    L14
L160:
  movb   $0x5c,(%rdx)
  movzbl (%rax),%ecx
  add    $0x1,%rax
  lea    0x1(%rdx),%r11
  lea    0x2(%rdx),%r10
  mov    %cl,0x1(%rdx)
  cmp    %rdi,%rax
  jne    L112
  movb   $0x2e,0x1(%r11)
  movzbl %sil,%eax
  lea    0x2(%r11),%rdx
  add    %r9,%rax
L60:
  movzbl (%rax),%esi
  test   %sil,%sil
  jne    L185
L83:
  mov    0x0(%rbp),%rcx
  test   %r8d,%r8d
  je     L102
  cmp    %rcx,%rdx
  jbe    L149
L61:
  movb   $0x0,-0x1(%rdx)
  xor    %eax,%eax
L142:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L12:
  movb   $0x0,(%rax)
  xor    %eax,%eax
  movq   $0x1,(%rbx)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L89:
  mov    %rdx,%r11
  movzbl %sil,%eax
  movb   $0x2e,0x1(%r11)
  add    %r9,%rax
  lea    0x2(%r11),%rdx
  jmp    L60
  nopl   (%rax)
L102:
  add    $0x1,%rax
  sub    %r12,%rax
  mov    %rax,(%rbx)
  cmp    %rcx,%rdx
  ja     L61
L149:
  movb   $0x0,(%rdx)
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L128:
  mov    $0xf,%eax
  jmp    L142
```

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