user: Translate the below assembly code into C programming language:

```asm
<valid_domain>:
  endbr64
  movzbl (%rdi),%eax
  cmp    $0x5b,%al
  je     L188
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  sub    $0x41,%edx
  cmp    $0x19,%dl
  ja     L175
L45:
  lea    0x1(%rdi),%rax
  mov    $0x1,%edx
  nopl   0x0(%rax)
L68:
  movzbl (%rax),%ecx
  cmp    $0x2d,%cl
  je     L58
L25:
  cmp    $0x2e,%cl
  je     L58
  mov    %ecx,%esi
  and    $0xffffffdf,%esi
  sub    $0x41,%esi
  cmp    $0x19,%sil
  jbe    L1
  lea    -0x30(%rcx),%esi
  cmp    $0x9,%sil
  ja     L88
L1:
  add    $0x1,%rdx
  cmp    $0x100,%rdx
  je     L99
  movzbl 0x1(%rax),%ecx
  add    $0x1,%rax
  cmp    $0x2d,%cl
  jne    L25
L58:
  cmp    $0xff,%rdx
  je     L99
  movzbl 0x1(%rax),%esi
  mov    %esi,%ecx
  and    $0xffffffdf,%ecx
  sub    $0x41,%ecx
  cmp    $0x19,%cl
  jbe    L3
  sub    $0x30,%esi
  cmp    $0x9,%sil
  ja     L99
L3:
  add    $0x2,%rdx
  cmp    $0x100,%rdx
  je     L99
  add    $0x2,%rax
  jmp    L68
  nopl   0x0(%rax)
L188:
  lea    0x1(%rdi),%rax
  xor    %edi,%edi
  cs nopw 0x0(%rax,%rax,1)
L46:
  movzbl (%rax),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  ja     L99
  sub    $0x30,%edx
L98:
  movzbl 0x1(%rax),%ecx
  add    $0x1,%rax
  cmp    $0x2e,%cl
  je     L202
  lea    -0x30(%rcx),%esi
  cmp    $0x9,%sil
  ja     L83
  lea    (%rdx,%rdx,4),%edx
  lea    -0x30(%rcx,%rdx,2),%edx
  cmp    $0xff,%edx
  jle    L98
L99:
  mov    $0xffffffff,%eax
  ret
L175:
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L45
  jmp    L99
  cs nopw 0x0(%rax,%rax,1)
L202:
  add    $0x1,%edi
  cmp    $0x4,%edi
  je     L99
  add    $0x1,%rax
  jmp    L46
L83:
  cmp    $0x5d,%cl
  jne    L99
  cmp    $0x3,%edi
  jne    L99
  movzbl 0x1(%rax),%ecx
L88:
  neg    %cl
  sbb    %eax,%eax
  ret
```

assistant: ```c
int valid_domain(const unsigned char *domain) {
  const unsigned char *ptr;
  int state;
  int n;
  int ndots;
  size_t len;
  ptr = domain;
  if (*ptr == '[') {
    ptr++;
    ndots = 0;
    state = 0;
    do {
      if (state == 0) {
        if (!((*ptr >= '0') && (*ptr <= '9'))) {
          return -1;
        }
        n = *ptr - '0';
        state = 1;
      } else {
        if (*ptr == '.') {
          if (++ndots > 3) {
            return -1;
          }
          state = 0;
        } else if (((*ptr >= '0') && (*ptr <= '9'))) {
          n = (n * 10) + (*ptr - '0');
          if (n > 255) {
            return -1;
          }
        } else if (*ptr == ']') {
          break;
        } else {
          return -1;
        }
      }
      ptr++;
    } while (1);
    if (ndots != 3) {
      return -1;
    }
    ptr++;
  } else {
    if ((!(((*ptr >= 'A') && (*ptr <= 'Z')) || ((*ptr >= 'a') && (*ptr <= 'z')))) && (!((*ptr >= '0') && (*ptr <= '9')))) {
      return -1;
    }
    ptr++;
    len = 1;
    state = 0;
    do {
      if (state == 0) {
        if (*ptr == '-') {
          state = 1;
        } else if (*ptr == '.') {
          state = 2;
        } else if ((!(((*ptr >= 'A') && (*ptr <= 'Z')) || ((*ptr >= 'a') && (*ptr <= 'z')))) && (!((*ptr >= '0') && (*ptr <= '9')))) {
          break;
        }
      } else if (state == 1) {
        if ((!(((*ptr >= 'A') && (*ptr <= 'Z')) || ((*ptr >= 'a') && (*ptr <= 'z')))) && (!((*ptr >= '0') && (*ptr <= '9')))) {
          return -1;
        }
        state = 0;
      } else {
        if ((!(((*ptr >= 'A') && (*ptr <= 'Z')) || ((*ptr >= 'a') && (*ptr <= 'z')))) && (!((*ptr >= '0') && (*ptr <= '9')))) {
          return -1;
        }
        state = 0;
      }
      if (++len > 255) {
        return -1;
      }
      ptr++;
    } while (1);
  }
  if (*ptr) {
    return -1;
  }
  return 0;
}
```