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

```asm
<validate_netmask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x38(%rbp)
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x12,%eax
  jle    L373
  mov    $0x0,%eax
  jmp    L262
L521:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %eax,%eax
  jne    L408
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L408
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  je     L408
  movl   $0x1,-0x34(%rbp)
L408:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L476
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L369
L476:
  addl   $0x1,-0x30(%rbp)
  movl   $0x0,-0x34(%rbp)
L369:
  addl   $0x1,-0x38(%rbp)
L373:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x38(%rbp)
  jge    L190
  cmpl   $0x0,-0x34(%rbp)
  je     L521
L190:
  movl   $0x0,-0x38(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jne    L39
  cmpl   $0x1,-0x30(%rbp)
  jne    L39
  movl   $0x0,-0x38(%rbp)
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L299
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L450
L299:
  movl   $0x1,-0x38(%rbp)
L450:
  cmpl   $0x0,-0x38(%rbp)
  jne    L39
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L39
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L152
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L39
L152:
  movl   $0x1,-0x38(%rbp)
L39:
  cmpl   $0x1,-0x38(%rbp)
  jne    L333
  mov    $0x3,%eax
  jmp    L262
L333:
  lea    -0x20(%rbp),%rax
  mov    $0x10,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x48(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L345
  movl   $0x0,-0x38(%rbp)
  jmp    L462
L459:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x38(%rbp),%eax
  cltq
  mov    %dl,-0x20(%rbp,%rax,1)
  addl   $0x1,-0x38(%rbp)
L462:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L539
  cmpl   $0xe,-0x38(%rbp)
  jle    L459
  jmp    L539
L345:
  mov    -0x48(%rbp),%rcx
  lea    -0x20(%rbp),%rax
  mov    $0x10,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strlcpy@plt>
L539:
  lea    -0x3c(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <quadtonum@plt>
  test   %rax,%rax
  je     L353
  mov    $0x0,%eax
  jmp    L262
L353:
  mov    -0x48(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L154
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x38(%rbp)
  jmp    L331
L278:
  cmpl   $0x0,-0x34(%rbp)
  jne    L140
  mov    -0x3c(%rbp),%edx
  mov    $0x1f,%eax
  sub    -0x38(%rbp),%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L140
  movl   $0x1,-0x34(%rbp)
L140:
  cmpl   $0x1,-0x34(%rbp)
  jne    L382
  mov    -0x3c(%rbp),%edx
  mov    $0x1f,%eax
  sub    -0x38(%rbp),%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L382
  movl   $0x2,-0x34(%rbp)
L382:
  addl   $0x1,-0x38(%rbp)
L331:
  cmpl   $0x1f,-0x38(%rbp)
  jle    L278
  cmpl   $0x2,-0x34(%rbp)
  jne    L367
  mov    $0xffffffff,%eax
  jmp    L262
L367:
  mov    $0x1,%eax
  jmp    L262
L154:
  addq   $0x1,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L204
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x2,%eax
  jle    L85
L204:
  mov    $0x0,%eax
  jmp    L262
L85:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L509
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L254
L509:
  mov    $0x0,%eax
  jmp    L262
L254:
  movl   $0x0,-0x38(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L327
L111:
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L197
L69:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x30(%rbp),%eax
  cltq
  lea    D14(%rip),%rcx
  movzbl (%rax,%rcx,1),%eax
  cmp    %al,%dl
  jne    L436
  movl   $0x1,-0x34(%rbp)
L436:
  addl   $0x1,-0x30(%rbp)
L197:
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x30(%rbp)
  jge    L448
  cmpl   $0x0,-0x34(%rbp)
  je     L69
L448:
  cmpl   $0x0,-0x34(%rbp)
  jne    L343
  mov    $0x0,%eax
  jmp    L262
L343:
  addl   $0x1,-0x38(%rbp)
L327:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x38(%rbp)
  jl     L111
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  js     L308
  cmpl   $0x20,-0x2c(%rbp)
  jle    L17
L308:
  mov    $0x0,%eax
  jmp    L262
L17:
  mov    $0x2,%eax
L262:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L266
  call   <__stack_chk_fail@plt>
L266:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D14
data_type: string

tool: D14: 0123456789.

assistant: ```c
int validate_netmask(char *in_addr) {
  int i = 0, j = 0, k = 0, m;
  char addr[16];
  char *sl;
  u_int32_t sm;
  if (strlen(in_addr) > 18)
    return 0;
  while (i < (int)strlen(in_addr) && !j) {
    if (!isxdigit(in_addr[i]) && in_addr[i] != 'x' && in_addr[i] != 'X')
      j = 1;
    if (in_addr[i] == 'x' || in_addr[i] == 'X') {
      k++;
      j = 0;
    }
    i++;
  }
  i = 0;
  if (!j && k == 1) {
    i = 0;
    if (in_addr[0] == 'x' || in_addr[0] == 'X')
      i = 1;
    if (!i && in_addr[0] == '0' && (in_addr[1] == 'x' || in_addr[1] == 'X'))
      i = 1;
  }
  if (i == 1)
    return 3;
  memset(addr, 0, sizeof(addr));
  if (strstr(in_addr, "/")) {
    i = 0;
    while (in_addr[i] != '/' && i < 15) {
      addr[i] = in_addr[i];
      i++;
    }
  } else {
    strlcpy(addr, in_addr, sizeof(addr));
  }
  if (quadtonum(addr, &sm))
    return 0;
  if (!(sl = strstr(in_addr, "/"))) {
    j = 0;
    for (i = 0; i < 32; i++) {
      if (!j && !((sm >> (31 - i)) & 1))
        j = 1;
      if (j == 1 && ((sm >> (31 - i)) & 1))
        j = 2;
    }
    if (j == 2)
      return -1;
    return 1;
  }
  sl++;
  if (strlen(sl) < 1 || strlen(sl) > 2)
    return 0;
  if (sl[0] == '.' || sl[1] == '.')
    return 0;
  i = 0;
  j = 0;
  while (i < (int)strlen(sl)) {
    k = 0;
    j = 0;
    while (k < (int)strlen("0123456789.") && !j) {
      if (sl[i] == "0123456789."[k])
        j = 1;
      k++;
    }
    if (!j)
      return 0;
    i++;
  }
  m = atoi(sl);
  if (m < 0 || m > 32)
    return 0;
  return 2;
}
```