user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<compare_dnsname>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rsi,%rsi
  je     L171
  mov    %rcx,%r13
  test   %rcx,%rcx
  je     L171
  mov    %rdi,%rbx
  mov    %rsi,%r12
  mov    %rdx,%rbp
  cmp    %rcx,%rsi
  je     L284
L70:
  lea    -0x1(%rbx,%r12,1),%r8
  cmpb   $0x0,(%r8)
  jne    L171
  lea    -0x1(%rbp,%r13,1),%r9
  cmpb   $0x0,(%r9)
  jne    L171
  add    %rbx,%r12
  cmp    %rbx,%r12
  jbe    L134
  add    %rbp,%r13
  cmp    %rbp,%r13
  jbe    L134
  xor    %r15d,%r15d
  xor    %r14d,%r14d
  jmp    L129
  nopw   0x0(%rax,%rax,1)
L173:
  test   %sil,%sil
  jne    L23
  mov    %rax,%rbx
  mov    $0x1,%r14d
  cmp    %rbp,%r9
  je     L220
  lea    0x1(%rbp),%rdx
  cmp    %rdx,%r9
  jne    L171
  mov    $0x1,%r15d
  mov    $0x1,%r14d
L220:
  cmp    %rbx,%r12
  jbe    L43
L101:
  cmp    %rbp,%r13
  jbe    L43
L129:
  movsbq (%rbx),%rcx
  cmp    $0x3f,%cl
  jg     L171
  movzbl 0x0(%rbp),%esi
  cmp    $0x3f,%sil
  jg     L171
  lea    0x1(%rcx),%eax
  movsbq %al,%rax
  add    %rbx,%rax
  cmp    %rax,%r12
  jb     L171
  lea    0x1(%rsi),%edx
  movsbq %dl,%rdx
  add    %rbp,%rdx
  cmp    %rdx,%r13
  jb     L171
  test   %cl,%cl
  je     L190
  test   %r14d,%r14d
  je     L173
  mov    %rax,%rbx
  cmp    %rbx,%r12
  ja     L101
L43:
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L23:
  cmp    %sil,%cl
  je     L281
  lea    0x1(%rbx,%rcx,1),%rbx
L10:
  mov    $0x1,%r15d
  mov    $0x1,%r14d
  jmp    L220
  nopl   0x0(%rax,%rax,1)
L190:
  cmp    %rbx,%r8
  je     L43
  add    $0x1,%rbx
  cmp    %rbx,%r8
  je     L43
  xchg   %ax,%ax
L171:
  mov    $0xffffffff,%r15d
  jmp    L43
  nopl   0x0(%rax,%rax,1)
L281:
  lea    0x1(%rbx),%rdi
  movsbl %cl,%edx
  lea    0x1(%rbp),%rsi
  mov    %r9,0x8(%rsp)
  mov    %r8,(%rsp)
  call   <memcmp@plt>
  mov    (%rsp),%r8
  mov    0x8(%rsp),%r9
  test   %rax,%rax
  movsbq (%rbx),%rax
  lea    0x1(%rbx,%rax,1),%rbx
  jne    L10
  movsbl 0x0(%rbp),%eax
  add    $0x1,%eax
  cltq
  add    %rax,%rbp
  jmp    L220
  nopl   0x0(%rax)
L284:
  movsbl %sil,%edx
  mov    %rbp,%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L70
L134:
  xor    %r15d,%r15d
  jmp    L43
```

assistant: ```c
int compare_dnsname(const char *s, size_t slen, const char *n, size_t nlen) {
  const char *s0 = s, *n0 = n;
  int done = 0, retcode = 0;
  if (slen < 1 || nlen < 1)
    return -1;
  if (slen == nlen && memcmp(s, n, slen) == 0)
    return 0;
  if (*(s0 + slen - 1) || *(n0 + nlen - 1))
    return -1;
  while (s < s0 + slen && n < n0 + nlen) {
    if (*s >= 0x40 || *n >= 0x40)
      return -1;
    if (s + *s + 1 > s0 + slen || n + *n + 1 > n0 + nlen)
      return -1;
    if (*s == '\0') {
      if (s == s0 + slen - 1)
        break;
      else if (s + 1 == s0 + slen - 1)
        return retcode;
      else
        return -1;
    }
    if (!done) {
      if (*n == '\0') {
        if (n == n0 + nlen - 1) {
          done = 1;
        } else if (n + 1 == n0 + nlen - 1) {
          retcode = 1;
          done = 1;
        } else
          return -1;
      } else {
        if (*s != *n) {
          done = 1;
          retcode = 1;
        } else {
          if (memcmp(s + 1, n + 1, *s)) {
            done = 1;
            retcode = 1;
          }
        }
      }
    }
    s += *s + 1;
    n += done ? 0 : (*n + 1);
  }
  return retcode;
}
```