user: Converte this assembly snippet into its equivalent C code:

```asm
<inet_network>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r14
  jmp    L4
L57:
  add    $0x1,%rbx
  mov    $0x8,%r15d
  jmp    L103
L229:
  imul   %r15d,%r12d
  lea    -0x30(%rbp,%r12,1),%r12d
  mov    %r13,%rbx
L12:
  movzbl (%rbx),%ebp
  add    $0x1,%r13
  test   %bpl,%bpl
  jne    L33
  jmp    L51
L44:
  mov    %r12d,%ebx
  shl    $0x4,%ebx
  lea    0xa(%rbp),%r12d
  mov    %ebp,%edi
  call   <islower@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0xffffffe0,%eax
  add    $0x61,%eax
  sub    %eax,%r12d
  add    %ebx,%r12d
  mov    %r13,%rbx
  jmp    L12
L152:
  movzbl (%rbx),%ebp
  lea    0x1(%rbx),%r13
  mov    $0x0,%r12d
  test   %bpl,%bpl
  je     L51
L33:
  lea    -0x1(%r13),%rbx
  movsbl %bpl,%ebp
  mov    %ebp,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L229
  cmp    $0x10,%r15d
  jne    L51
  mov    %ebp,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  jne    L44
L51:
  movzbl (%rbx),%eax
  cmp    $0x2e,%al
  jne    L137
  lea    0x10(%rsp),%rax
  cmp    %rax,%r14
  je     L165
  add    $0x4,%r14
  mov    %r12d,-0x4(%r14)
  add    $0x1,%rbx
L4:
  mov    $0xa,%r15d
  cmpb   $0x30,(%rbx)
  je     L57
L103:
  movzbl (%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L152
  add    $0x1,%rbx
  mov    $0x10,%r15d
  jmp    L152
L137:
  test   %al,%al
  jne    L89
L206:
  mov    %r12d,(%r14)
  lea    0x20(%rsp),%rax
  sub    %rax,%r14
  lea    0x24(%r14),%rax
  sar    $0x2,%rax
  cmp    $0x4,%eax
  jg     L121
  test   %eax,%eax
  jle    L215
  mov    %rsp,%rdx
  lea    -0x1(%rax),%eax
  lea    0x4(%rsp,%rax,4),%rsi
  mov    $0x0,%eax
L41:
  shl    $0x8,%eax
  movzbl (%rdx),%ecx
  or     %ecx,%eax
  add    $0x4,%rdx
  cmp    %rsi,%rdx
  jne    L41
  jmp    L23
L89:
  movsbl %al,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L206
  mov    $0xffffffff,%eax
  jmp    L23
L165:
  mov    $0xffffffff,%eax
L23:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L227
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L121:
  mov    $0xffffffff,%eax
  jmp    L23
L215:
  mov    $0x0,%eax
  jmp    L23
L227:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
u_long inet_network(register char *cp) {
  register u_long val, base, n;
  register char c;
  u_long parts[4], *pp = parts;
  register int i;
again:
  val = 0;
  base = 10;
  if (*cp == '0')
    base = 8, cp++;
  if (*cp == 'x' || *cp == 'X')
    base = 16, cp++;
  while ((c = *cp) != '\0') {
    if (isdigit(c)) {
      val = (val * base) + ((u_long)c - '0');
      cp++;
      continue;
    }
    if (base == 16 && isxdigit(c)) {
      val = (val << 4) + ((u_long)c + 10 - (islower(c) ? 'a' : 'A'));
      cp++;
      continue;
    }
    break;
  }
  if (*cp == '.') {
    if (pp >= parts + 4)
      return (-1);
    *pp++ = val, cp++;
    goto again;
  }
  if (*cp && !isspace(*cp))
    return (-1);
  *pp++ = val;
  n = pp - parts;
  if (n > 4)
    return (-1);
  for (val = 0, i = 0; i < n; i++) {
    val <<= 8;
    val |= parts[i] & 0xff;
  }
  return (val);
}
```