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

```asm
<dns_ptodn>:
  endbr64
  mov    %rdi,%rcx
  mov    %edx,%edi
  lea    0x1(%rsi),%rax
  mov    %rsi,%r9
  sub    $0x1,%rdi
  cmp    $0x100,%edx
  mov    $0xfe,%edx
  mov    %rax,%r8
  cmovae %rdx,%rdi
  movzbl (%rcx),%edx
  add    %rsi,%rdi
  lea    0x1(%rcx),%rsi
  test   %edx,%edx
  jne    L18
  jmp    L47
  nopl   0x0(%rax)
L89:
  cmp    $0x5c,%edx
  je     L78
L101:
  cmp    %rax,%rdi
  jbe    L121
  mov    %dl,(%rax)
  mov    %rsi,%rcx
  add    $0x1,%rax
L81:
  movzbl (%rcx),%edx
  add    $0x1,%rsi
  test   %edx,%edx
  je     L26
L18:
  cmp    $0x2e,%edx
  jne    L89
  mov    %rax,%rdx
  sub    %r8,%rdx
  cmp    %r8d,%eax
  je     L20
  cmp    $0x3f,%edx
  ja     L121
  mov    %rsi,%rcx
  mov    %dl,-0x1(%r8)
  add    $0x1,%rax
  add    $0x1,%rsi
  movzbl (%rcx),%edx
  mov    %rax,%r8
  test   %edx,%edx
  jne    L18
  nopl   0x0(%rax)
L26:
  mov    %rax,%rdx
  sub    %r8,%rdx
  cmp    $0x3f,%edx
  ja     L121
  mov    %dl,-0x1(%r8)
  test   %dl,%dl
  je     L104
  movb   $0x0,(%rax)
  add    $0x1,%rax
L104:
  sub    %r9d,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L78:
  movzbl 0x1(%rcx),%edx
  lea    0x2(%rcx),%rsi
  test   %edx,%edx
  je     L26
  lea    -0x30(%rdx),%r10d
  cmp    $0x9,%r10d
  ja     L101
  movsbl 0x2(%rcx),%edx
  lea    -0x30(%rdx),%r11d
  cmp    $0x9,%r11b
  ja     L156
  lea    (%r10,%r10,4),%esi
  movsbl 0x3(%rcx),%r10d
  lea    -0x30(%rdx,%rsi,2),%edx
  lea    -0x30(%r10),%esi
  cmp    $0x9,%sil
  ja     L184
  lea    (%rdx,%rdx,4),%edx
  lea    0x4(%rcx),%rsi
  lea    -0x30(%r10,%rdx,2),%edx
  cmp    $0xff,%edx
  jbe    L101
  mov    D24(%rip),%rax
  mov    (%rax),%edx
  mov    D16(%rip),%rax
  mov    %edx,(%rax)
  xor    %eax,%eax
  ret
  nopl   0x0(%rax)
L121:
  mov    D4(%rip),%rax
  mov    (%rax),%edx
  mov    D16(%rip),%rax
  mov    %edx,(%rax)
  xor    %eax,%eax
  ret
  nopl   (%rax)
L20:
  mov    %rsi,%rcx
  jmp    L81
  nopl   0x0(%rax,%rax,1)
L156:
  mov    %r10d,%edx
  jmp    L101
  nopl   0x0(%rax,%rax,1)
L184:
  lea    0x3(%rcx),%rsi
  jmp    L101
L47:
  movb   $0x0,(%r9)
  jmp    L104
```

assistant: ```c
unsigned dns_ptodn(const char *name, unsigned char *dn, unsigned dnsiz) {
  unsigned char *d;
  unsigned char *label;
  unsigned char *m;
  unsigned l;
  unsigned c;
  d = dn + 1;
  label = d;
  m = dn + (dnsiz > 255 ? 255 : dnsiz) - 1;
  while ((c = (unsigned char)*name++) != 0) {
    if (c == '.') {
      if ((l = d - label) != 0) {
        if (l > 63) {
          errno = EMSGSIZE;
          return 0;
        }
        label[-1] = (char)l;
        label = ++d;
      }
      continue;
    }
    if (c == '\\') {
      if (!(c = (unsigned char)*name++))
        break;
      if (c >= '0' && c <= '9') {
        c -= '0';
        if (*name >= '0' && *name <= '9') {
          c = (c * 10) + (*name++ - '0');
          if (*name >= '0' && *name <= '9') {
            c = (c * 10) + (*name++ - '0');
            if (c > 255) {
              errno = EINVAL;
              return 0;
            }
          }
        }
      }
    }
    if (d >= m) {
      errno = EMSGSIZE;
      return 0;
    }
    *d++ = (char)c;
  }
  if ((l = d - label) > 63) {
    errno = EMSGSIZE;
    return 0;
  }
  if ((label[-1] = (char)l) != 0)
    *d++ = 0;
  return d - dn;
}
```