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

```asm
<inet_aton>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x48,%rsp
  movzbl (%rdi),%r12d
  mov    %rsi,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    %rax,0x8(%rsp)
L316:
  movsbl %r12b,%r14d
  mov    %r14d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L288
  mov    $0xa,%eax
  cmp    $0x30,%r12b
  je     L93
L250:
  mov    %rbx,%r13
  xor    %ebp,%ebp
  movslq %eax,%rbx
  nopl   (%rax)
L55:
  mov    %r14d,%edi
  mov    %r14d,%r15d
  call   <isascii@plt>
  test   %rax,%rax
  jne    L235
L176:
  cmp    $0x2e,%r12b
  jne    L343
  mov    0x8(%rsp),%rcx
  lea    0x2c(%rsp),%rax
  cmp    %rax,%rcx
  je     L288
  add    $0x4,%rcx
  movzbl 0x1(%r13),%r12d
  lea    0x1(%r13),%rbx
  mov    %ebp,-0x4(%rcx)
  mov    %rcx,0x8(%rsp)
  jmp    L316
L93:
  movzbl 0x1(%rbx),%r12d
  mov    %r12d,%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L366
  add    $0x1,%rbx
  mov    $0x8,%eax
  movsbl %r12b,%r14d
  jmp    L250
  xchg   %ax,%ax
L366:
  movzbl 0x2(%rbx),%r12d
  xor    %ebp,%ebp
  add    $0x3,%rbx
  jmp    L164
  nopl   (%rax)
L138:
  mov    %r15d,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L176
  mov    %r15d,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L176
  mov    %r15d,%edi
  shl    $0x4,%rbp
  lea    0xa(%r15),%r12d
  call   <islower@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0xffffffe0,%eax
  add    $0x61,%eax
  sub    %eax,%r12d
  movslq %r12d,%r12
  or     %r12,%rbp
  movzbl (%rbx),%r12d
L206:
  add    $0x1,%rbx
L164:
  movsbl %r12b,%r15d
  lea    -0x1(%rbx),%r13
  mov    %r15d,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L138
  mov    %r15d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L138
  lea    -0x30(%r15),%r8d
  shl    $0x4,%rbp
  movzbl (%rbx),%r12d
  movslq %r8d,%r8
  add    %r8,%rbp
  jmp    L206
L54:
  mov    %r15d,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L288
  mov    %r15d,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L9
  cs nopw 0x0(%rax,%rax,1)
L288:
  xor    %r12d,%r12d
L102:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L192
  add    $0x48,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L235:
  mov    %r14d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L176
  imul   %rbx,%rbp
  add    $0x1,%r13
  lea    -0x30(%r14),%edx
  movsbl 0x0(%r13),%r14d
  movslq %edx,%rdx
  add    %rdx,%rbp
  mov    %r14d,%r12d
  jmp    L55
L343:
  test   %r12b,%r12b
  jne    L54
L9:
  mov    0x8(%rsp),%rax
  sub    0x10(%rsp),%rax
  sar    $0x2,%rax
  add    $0x1,%eax
  cmp    $0x3,%eax
  je     L21
  ja     L106
  xor    %r12d,%r12d
  test   %eax,%eax
  je     L102
  cmp    $0x2,%eax
  jne    L289
  cmp    $0xffffff,%rbp
  ja     L288
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L288
  shl    $0x18,%eax
  or     %rax,%rbp
  jmp    L289
  nopl   0x0(%rax)
L106:
  cmp    $0x4,%eax
  jne    L289
  cmp    $0xff,%rbp
  ja     L288
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L288
  mov    0x24(%rsp),%ecx
  cmp    $0xff,%ecx
  ja     L288
  mov    0x28(%rsp),%edx
  cmp    $0xff,%edx
  ja     L288
  shl    $0x18,%eax
  shl    $0x10,%ecx
  or     %ecx,%eax
  shl    $0x8,%edx
  or     %edx,%eax
  or     %rax,%rbp
L289:
  mov    0x18(%rsp),%rbx
  mov    $0x1,%r12d
  test   %rbx,%rbx
  je     L102
  mov    %rbp,%rdi
  call   <htonl@plt>
  mov    %eax,(%rbx)
  jmp    L102
L21:
  cmp    $0xffff,%rbp
  ja     L288
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L288
  mov    0x24(%rsp),%edx
  cmp    $0xff,%edx
  ja     L288
  shl    $0x18,%eax
  shl    $0x10,%edx
  or     %edx,%eax
  or     %rax,%rbp
  jmp    L289
L192:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int inet_aton(const char *cp, struct in_addr *addr) {
  register unsigned long val;
  register int base, n;
  register char c;
  unsigned int parts[4];
  register unsigned int *pp = parts;
  c = *cp;
  for (;;) {
    if (!isdigit(c))
      return (0);
    val = 0;
    base = 10;
    if (c == '0') {
      c = *++cp;
      if (c == 'x' || c == 'X')
        base = 16, c = *++cp;
      else
        base = 8;
    }
    for (;;) {
      if (isascii(c) && isdigit(c)) {
        val = (val * base) + (c - '0');
        c = *++cp;
      } else if (base == 16 && isascii(c) && isxdigit(c)) {
        val = (val << 4) | (c + 10 - (islower(c) ? 'a' : 'A'));
        c = *++cp;
      } else
        break;
    }
    if (c == '.') {
      if (pp >= parts + 3)
        return (0);
      *pp++ = val;
      c = *++cp;
    } else
      break;
  }
  if (c != '\0' && (!isascii(c) || !isspace(c)))
    return (0);
  n = pp - parts + 1;
  switch (n) {
  case 0:
    return (0);
  case 1:
    break;
  case 2:
    if ((val > 0xffffff) || (parts[0] > 0xff))
      return (0);
    val |= parts[0] << 24;
    break;
  case 3:
    if ((val > 0xffff) || (parts[0] > 0xff) || (parts[1] > 0xff))
      return (0);
    val |= (parts[0] << 24) | (parts[1] << 16);
    break;
  case 4:
    if ((val > 0xff) || (parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff))
      return (0);
    val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
    break;
  }
  if (addr)
    addr->s_addr = htonl(val);
  return (1);
}
```