user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<__dn_expand>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rcx,-0x18(%rsp)
  cmp    %rsi,%rdx
  je     L33
  test   %r8d,%r8d
  jle    L33
  mov    $0xfe,%eax
  mov    %rdi,%r15
  mov    %rsi,%r11
  mov    %rsi,%rbp
  cmp    %eax,%r8d
  mov    %rcx,%rdi
  cmovg  %eax,%r8d
  sub    %r15,%r11
  movslq %r8d,%r8
  add    %rcx,%r8
  mov    %r8,-0x10(%rsp)
  test   %r11,%r11
  jle    L33
  mov    %r15,-0x20(%rsp)
  mov    %rdx,%r12
  xor    %esi,%esi
  mov    $0xffffffff,%r8d
  jmp    L307
  cs nopw 0x0(%rax,%rax,1)
L312:
  lea    0x1(%rdx),%rcx
  cmp    %rcx,%rbp
  je     L33
  movzbl 0x1(%rdx),%ecx
  shl    $0x8,%eax
  add    $0x2,%rdx
  and    $0x3f00,%eax
  sub    %r12,%rdx
  or     %ecx,%eax
  test   %r8d,%r8d
  cltq
  cmovs  %edx,%r8d
  cmp    %r11,%rax
  jge    L33
  mov    -0x20(%rsp),%rbx
  lea    (%rbx,%rax,1),%rdx
L84:
  add    $0x2,%rsi
  cmp    %rsi,%r11
  jle    L33
L307:
  movzbl (%rdx),%eax
  mov    %rax,%r9
  test   $0xc0,%al
  jne    L312
  test   %al,%al
  je     L304
  mov    -0x18(%rsp),%rbx
  mov    %rbx,%rcx
  cmp    %rdi,%rbx
  je     L228
  movb   $0x2e,(%rdi)
  movzbl (%rdx),%eax
  lea    0x1(%rdi),%rcx
  mov    %rax,%r9
L228:
  lea    0x1(%rdx),%r13
  mov    %rbp,%rdi
  sub    %r13,%rdi
  cmp    %rdi,%r9
  jge    L33
  mov    -0x10(%rsp),%rdi
  sub    %rcx,%rdi
  cmp    %rdi,%r9
  jge    L33
  lea    -0x1(%rax),%edi
  test   %eax,%eax
  je     L360
  lea    0x2(%rdx),%r10
  mov    %rcx,%r9
  sub    %r10,%r9
  cmp    $0xe,%r9
  jbe    L194
  cmp    $0x6,%edi
  jbe    L194
  cmp    $0xe,%edi
  jbe    L291
  movdqu 0x1(%rdx),%xmm0
  mov    %eax,%r9d
  shr    $0x4,%r9d
  movups %xmm0,(%rcx)
  cmp    $0x1,%r9d
  je     L379
  movdqu 0x11(%rdx),%xmm1
  movups %xmm1,0x10(%rcx)
  cmp    $0x2,%r9d
  je     L379
  movdqu 0x21(%rdx),%xmm2
  movups %xmm2,0x20(%rcx)
  cmp    $0x3,%r9d
  je     L379
  movdqu 0x31(%rdx),%xmm3
  movups %xmm3,0x30(%rcx)
  cmp    $0x4,%r9d
  je     L379
  movdqu 0x41(%rdx),%xmm4
  movups %xmm4,0x40(%rcx)
  cmp    $0x5,%r9d
  je     L379
  movdqu 0x51(%rdx),%xmm5
  movups %xmm5,0x50(%rcx)
  cmp    $0x6,%r9d
  je     L379
  movdqu 0x61(%rdx),%xmm6
  movups %xmm6,0x60(%rcx)
  cmp    $0x7,%r9d
  je     L379
  movdqu 0x71(%rdx),%xmm7
  movups %xmm7,0x70(%rcx)
  cmp    $0x8,%r9d
  je     L379
  movdqu 0x81(%rdx),%xmm7
  movups %xmm7,0x80(%rcx)
  cmp    $0x9,%r9d
  je     L379
  movdqu 0x91(%rdx),%xmm6
  movups %xmm6,0x90(%rcx)
  cmp    $0xa,%r9d
  je     L379
  movdqu 0xa1(%rdx),%xmm5
  movups %xmm5,0xa0(%rcx)
  cmp    $0xb,%r9d
  je     L379
  movdqu 0xb1(%rdx),%xmm4
  movups %xmm4,0xb0(%rcx)
  cmp    $0xc,%r9d
  je     L379
  movdqu 0xc1(%rdx),%xmm7
  movups %xmm7,0xc0(%rcx)
  cmp    $0xd,%r9d
  je     L379
  movdqu 0xd1(%rdx),%xmm6
  movups %xmm6,0xd0(%rcx)
  cmp    $0xf,%r9d
  jne    L379
  movdqu 0xe1(%rdx),%xmm5
  movups %xmm5,0xe0(%rcx)
  nopw   0x0(%rax,%rax,1)
L379:
  mov    %eax,%r9d
  and    $0xfffffff0,%r9d
  mov    %r9d,%r10d
  sub    %r9d,%edi
  lea    (%rcx,%r10,1),%rbx
  add    %r13,%r10
  cmp    %r9d,%eax
  je     L233
L243:
  mov    %eax,%r14d
  sub    %r9d,%r14d
  lea    -0x1(%r14),%r15d
  cmp    $0x6,%r15d
  jbe    L39
  mov    0x1(%rdx,%r9,1),%rdx
  mov    %rdx,(%rcx,%r9,1)
  mov    %r14d,%edx
  and    $0xfffffff8,%edx
  mov    %edx,%r9d
  sub    %edx,%edi
  add    %r9,%rbx
  add    %r9,%r10
  cmp    %edx,%r14d
  je     L233
L39:
  movzbl (%r10),%edx
  mov    %dl,(%rbx)
  test   %edi,%edi
  je     L233
  movzbl 0x1(%r10),%edx
  mov    %dl,0x1(%rbx)
  cmp    $0x1,%edi
  je     L233
  movzbl 0x2(%r10),%edx
  mov    %dl,0x2(%rbx)
  cmp    $0x2,%edi
  je     L233
  movzbl 0x3(%r10),%edx
  mov    %dl,0x3(%rbx)
  cmp    $0x3,%edi
  je     L233
  movzbl 0x4(%r10),%edx
  mov    %dl,0x4(%rbx)
  cmp    $0x4,%edi
  je     L233
  movzbl 0x5(%r10),%edx
  mov    %dl,0x5(%rbx)
  cmp    $0x5,%edi
  je     L233
  movzbl 0x6(%r10),%edx
  mov    %dl,0x6(%rbx)
L233:
  cltq
L113:
  add    $0x2,%rsi
  lea    0x0(%r13,%rax,1),%rdx
  lea    (%rcx,%rax,1),%rdi
  cmp    %rsi,%r11
  jg     L307
  nopw   0x0(%rax,%rax,1)
L33:
  mov    $0xffffffff,%r8d
L8:
  pop    %rbx
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L194:
  mov    -0x20(%rsp),%r15
  cltq
  xor    %edi,%edi
  nopl   0x0(%rax)
L40:
  movzbl 0x1(%rdx,%rdi,1),%r9d
  mov    %r9b,(%rcx,%rdi,1)
  add    $0x1,%rdi
  cmp    %rax,%rdi
  jne    L40
  mov    %r15,-0x20(%rsp)
  jmp    L113
  nopw   0x0(%rax,%rax,1)
L360:
  mov    %r13,%rdx
  mov    %rcx,%rdi
  jmp    L84
L291:
  mov    %r13,%r10
  mov    %rcx,%rbx
  xor    %r9d,%r9d
  jmp    L243
L304:
  add    $0x1,%rdx
  movb   $0x0,(%rdi)
  sub    %r12,%rdx
  test   %r8d,%r8d
  cmovs  %edx,%r8d
  jmp    L8
```

assistant: ```c
int __dn_expand(const unsigned char *base, const unsigned char *end, const unsigned char *src, char *dest, int space) {
  const unsigned char *p = src;
  char *dend, *dbegin = dest;
  int len = -1, i, j;
  if (p == end || space <= 0)
    return -1;
  dend = dest + (space > 254 ? 254 : space);
  for (i = 0; i < end - base; i += 2) {
    if (*p & 0xc0) {
      if (p + 1 == end)
        return -1;
      j = ((p[0] & 0x3f) << 8) | p[1];
      if (len < 0)
        len = p + 2 - src;
      if (j >= end - base)
        return -1;
      p = base + j;
    } else if (*p) {
      if (dest != dbegin)
        *dest++ = '.';
      j = *p++;
      if (j >= end - p || j >= dend - dest)
        return -1;
      while (j--)
        *dest++ = *p++;
    } else {
      *dest = 0;
      if (len < 0)
        len = p + 1 - src;
      return len;
    }
  }
  return -1;
}
```