user: Please show me the C implementation that matches the assembly code listed below:

```asm
<inet_network>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    $0xa,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  movzbl (%rdi),%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x14(%rsp),%rax
  mov    %rax,0x8(%rsp)
  mov    %rax,(%rsp)
  cmp    $0x30,%r14b
  jne    L23
L39:
  movzbl 0x1(%rdi),%r14d
  mov    $0x8,%r13d
  add    $0x1,%rdi
L23:
  mov    %r14d,%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L22
  movzbl 0x1(%rdi),%r14d
  mov    $0x10,%r13d
  add    $0x1,%rdi
L22:
  test   %r14b,%r14b
  je     L161
  lea    0x1(%rdi),%rbx
  xor    %ebp,%ebp
L78:
  movzbl %r14b,%r12d
  lea    -0x1(%rbx),%r15
  mov    %r12d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L167
  cmp    $0x10,%r13b
  jne    L52
  mov    %r12d,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  jne    L146
L52:
  movzbl (%r15),%r14d
  cmp    $0x2e,%r14b
  jne    L89
  lea    0x17(%rsp),%rax
  cmp    %rax,(%rsp)
  je     L51
  addq   $0x1,(%rsp)
  movzbl 0x1(%r15),%r14d
  lea    0x1(%r15),%rdi
  mov    $0xa,%r13d
  mov    (%rsp),%rax
  mov    %bpl,-0x1(%rax)
  cmp    $0x30,%r14b
  jne    L23
  jmp    L39
  nopl   0x0(%rax,%rax,1)
L167:
  mov    %ebp,%eax
  imul   %r13d,%eax
  mov    %eax,%ebp
  lea    -0x30(%r14,%rbp,1),%ebp
L145:
  movzbl (%rbx),%r14d
  add    $0x1,%rbx
  test   %r14b,%r14b
  jne    L78
L72:
  mov    %ebp,%r14d
  nopl   0x0(%rax)
L161:
  mov    (%rsp),%rax
  lea    0x1(%rax),%r12
  sub    0x8(%rsp),%r12
  mov    %r14b,(%rax)
  test   %r12b,%r12b
  jle    L100
  sub    $0x1,%r12d
  movsbq %r12b,%r12
  movzbl 0x14(%rsp,%r12,1),%eax
  jmp    L104
L89:
  test   %r14b,%r14b
  je     L72
  movzbl %r14b,%edi
  mov    %ebp,%r14d
  call   <isspace@plt>
  test   %eax,%eax
  jne    L161
  nopw   0x0(%rax,%rax,1)
L51:
  mov    D2(%rip),%rax
  movzbl (%rax),%eax
L104:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L113
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L146:
  mov    %r12d,%edi
  shl    $0x4,%ebp
  call   <islower@plt>
  lea    0xa(%r14,%rbp,1),%ebp
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0xffffffe0,%eax
  add    $0x61,%eax
  sub    %eax,%ebp
  jmp    L145
L100:
  xor    %eax,%eax
  jmp    L104
L113:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
in_addr_t inet_network(const char *cp) {
  register u_long val, base, n, i;
  register char c;
  u_long parts[4], *pp = parts;
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((unsigned char)c)) {
      val = (val * base) + (c - '0');
      cp++;
      continue;
    }
    if (base == 16 && isxdigit((unsigned char)c)) {
      val = (val << 4) + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
      cp++;
      continue;
    }
    break;
  }
  if (*cp == '.') {
    if (pp >= parts + 3)
      return (INADDR_NONE);
    *pp++ = val, cp++;
    goto again;
  }
  if (*cp && !isspace((unsigned char)*cp))
    return (INADDR_NONE);
  *pp++ = val;
  n = pp - parts;
  for (val = 0, i = 0; i < n; i++) {
    val <<= 8;
    val |= parts[i] & 0xff;
  }
  return (val);
}
```