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     L273
  mov    %rcx,%r13
  test   %rcx,%rcx
  je     L273
  mov    %rdi,%rbx
  mov    %rsi,%r12
  mov    %rdx,%rbp
  cmp    %rcx,%rsi
  je     L123
L4:
  lea    -0x1(%rbx,%r12,1),%r8
  cmpb   $0x0,(%r8)
  jne    L273
  lea    -0x1(%rbp,%r13,1),%r9
  cmpb   $0x0,(%r9)
  jne    L273
  add    %rbx,%r12
  cmp    %rbx,%r12
  jbe    L2
  add    %rbp,%r13
  cmp    %rbp,%r13
  jbe    L2
  xor    %r15d,%r15d
  xor    %r14d,%r14d
  jmp    L79
  nopw   0x0(%rax,%rax,1)
L161:
  test   %sil,%sil
  jne    L108
  mov    %rax,%rbx
  mov    $0x1,%r14d
  cmp    %rbp,%r9
  je     L141
  lea    0x1(%rbp),%rdx
  cmp    %rdx,%r9
  jne    L273
  mov    $0x1,%r15d
  mov    $0x1,%r14d
L141:
  cmp    %rbx,%r12
  jbe    L92
L94:
  cmp    %rbp,%r13
  jbe    L92
L79:
  movsbq (%rbx),%rcx
  cmp    $0x3f,%cl
  jg     L273
  movzbl 0x0(%rbp),%esi
  cmp    $0x3f,%sil
  jg     L273
  lea    0x1(%rcx),%eax
  movsbq %al,%rax
  add    %rbx,%rax
  cmp    %rax,%r12
  jb     L273
  lea    0x1(%rsi),%edx
  movsbq %dl,%rdx
  add    %rbp,%rdx
  cmp    %rdx,%r13
  jb     L273
  test   %cl,%cl
  je     L138
  test   %r14d,%r14d
  je     L161
  mov    %rax,%rbx
  cmp    %rbx,%r12
  ja     L94
L92:
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L108:
  cmp    %sil,%cl
  je     L261
  lea    0x1(%rbx,%rcx,1),%rbx
L265:
  mov    $0x1,%r15d
  mov    $0x1,%r14d
  jmp    L141
  nopl   0x0(%rax,%rax,1)
L138:
  cmp    %rbx,%r8
  je     L92
  add    $0x1,%rbx
  cmp    %rbx,%r8
  je     L92
  xchg   %ax,%ax
L273:
  mov    $0xffffffff,%r15d
  jmp    L92
  nopl   0x0(%rax,%rax,1)
L261:
  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    L265
  movsbl 0x0(%rbp),%eax
  add    $0x1,%eax
  cltq
  add    %rax,%rbp
  jmp    L141
  nopl   0x0(%rax)
L123:
  movsbl %sil,%edx
  mov    %rbp,%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L4
L2:
  xor    %r15d,%r15d
  jmp    L92
```

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