user: 请将以下的汇编代码转换成C语言代码:

```asm
<valid_domainname>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L162
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L51
L162:
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    D42(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L57
L51:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x10(%rbp)
  movl   $0x1,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x18(%rbp)
L15:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x1d(%rbp)
  cmpb   $0x0,-0x1d(%rbp)
  jne    L269
  mov    $0x1,%eax
  jmp    L57
L269:
  cmpb   $0x20,-0x1d(%rbp)
  jne    L291
  mov    -0x28(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x8(%rbp)
  je     L2
  mov    -0x2c(%rbp),%eax
  and    $0x100,%eax
  test   %eax,%eax
  je     L17
  cmpl   $0x0,-0x1c(%rbp)
  jne    L292
  movl   $0x1,-0x1c(%rbp)
  mov    -0x28(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,-0x10(%rbp)
L292:
  cmpl   $0x0,-0x18(%rbp)
  je     L23
  movl   $0x0,-0x18(%rbp)
  jmp    L23
L291:
  cmpb   $0x2e,-0x1d(%rbp)
  jne    L45
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L65
  movl   $0x0,-0x18(%rbp)
  jmp    L63
L45:
  cmpb   $0x2d,-0x1d(%rbp)
  je     L170
  cmpb   $0x5f,-0x1d(%rbp)
  jne    L116
L170:
  cmpl   $0x0,-0x1c(%rbp)
  jne    L116
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L116
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L179
L116:
  movzbl -0x1d(%rbp),%eax
  mov    %eax,%edi
  call   <isalnum@plt>
  test   %rax,%rax
  je     L257
L179:
  addl   $0x1,-0x18(%rbp)
  cmpl   $0x3f,-0x18(%rbp)
  jle    L182
  mov    D17(%rip),%rax
  mov    (%rax),%edx
  mov    D42(%rip),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x14(%rbp)
  jmp    L257
L182:
  cmpl   $0x0,-0x1c(%rbp)
  je     L15
  movl   $0x0,-0x1c(%rbp)
  jmp    L15
L23:
  nop
L63:
  jmp    L15
L2:
  nop
  jmp    L257
L17:
  nop
  jmp    L257
L65:
  nop
L257:
  cmpl   $0x0,-0x14(%rbp)
  jne    L47
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    D42(%rip),%rax
  mov    %edx,(%rax)
L47:
  cmpq   $0x0,-0x10(%rbp)
  je     L253
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x1,%eax
  jmp    L57
L253:
  mov    $0x0,%eax
L57:
  leave
  ret
```

assistant: ```c
int valid_domainname(char *lbl, int type) {
  char *slbl, *lst;
  unsigned char c;
  int start, len, errset;
  if (lbl == NULL || *lbl == '\0') {
    errno = EINVAL;
    return 0;
  }
  slbl = lbl;
  lst = NULL;
  start = 1;
  len = errset = 0;
  for (;;) {
    c = (unsigned char)*lbl++;
    if (c == '\0')
      return 1;
    if (c == ' ') {
      if (lbl - 1 == slbl)
        break;
      if (!(type & (1 << 8)))
        break;
      if (!start) {
        start = 1;
        lst = lbl - 1;
      }
      if (len)
        len = 0;
      continue;
    }
    if (c == '.') {
      if (*lbl == '.')
        break;
      len = 0;
      continue;
    }
    if (((c == '-' || c == '_') && !start && *lbl != ' ' && *lbl != '\0') || isalnum(c)) {
      if (++len > 63) {
        errno = ERANGE;
        errset = 1;
        break;
      }
    } else
      break;
    if (start)
      start = 0;
  }
  if (!errset)
    errno = EINVAL;
  if (lst) {
    *lst = '\0';
    return 1;
  }
  return 0;
}
```