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

```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)
L222:
  movsbl %r12b,%r15d
  mov    %r15d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L13
  mov    $0xa,%r14d
  cmp    $0x30,%r12b
  je     L38
L316:
  movslq %r14d,%rax
  add    $0x1,%rbx
  xor    %ebp,%ebp
  mov    %rax,(%rsp)
  jmp    L16
  nopl   0x0(%rax)
L189:
  cmp    $0x10,%r14d
  jne    L218
  mov    %r15d,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L218
  mov    %r15d,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L218
  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
L79:
  add    $0x1,%rbx
  movsbl %r12b,%r15d
L16:
  mov    %r15d,%edi
  lea    -0x1(%rbx),%r13
  call   <isascii@plt>
  test   %rax,%rax
  je     L189
  mov    %r15d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L189
  imul   (%rsp),%rbp
  lea    -0x30(%r15),%edi
  movzbl (%rbx),%r12d
  movslq %edi,%rdi
  add    %rdi,%rbp
  jmp    L79
L218:
  cmp    $0x2e,%r12b
  jne    L358
  mov    0x8(%rsp),%rcx
  lea    0x2c(%rsp),%rax
  cmp    %rax,%rcx
  je     L13
  add    $0x4,%rcx
  movzbl 0x1(%r13),%r12d
  lea    0x1(%r13),%rbx
  mov    %ebp,-0x4(%rcx)
  mov    %rcx,0x8(%rsp)
  jmp    L222
  nopl   0x0(%rax,%rax,1)
L38:
  movzbl 0x1(%rbx),%r12d
  mov    %r12d,%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L128
  add    $0x1,%rbx
  mov    $0x8,%r14d
  movsbl %r12b,%r15d
  jmp    L316
L211:
  mov    %r15d,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L13
  mov    %r15d,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L152
  nopl   0x0(%rax,%rax,1)
L13:
  xor    %r12d,%r12d
L367:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L349
  add    $0x48,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L128:
  movsbl 0x2(%rbx),%r15d
  mov    $0x10,%r14d
  add    $0x2,%rbx
  mov    %r15d,%r12d
  jmp    L316
L358:
  test   %r12b,%r12b
  jne    L211
L152:
  mov    0x8(%rsp),%rax
  sub    0x10(%rsp),%rax
  sar    $0x2,%rax
  add    $0x1,%eax
  cmp    $0x3,%eax
  je     L157
  ja     L161
  xor    %r12d,%r12d
  test   %eax,%eax
  je     L367
  cmp    $0x2,%eax
  jne    L58
  cmp    $0xffffff,%rbp
  ja     L13
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L13
  shl    $0x18,%eax
  or     %rax,%rbp
  jmp    L58
  nopl   0x0(%rax)
L161:
  cmp    $0x4,%eax
  jne    L58
  cmp    $0xff,%rbp
  ja     L13
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L13
  mov    0x24(%rsp),%ecx
  cmp    $0xff,%ecx
  ja     L13
  mov    0x28(%rsp),%edx
  cmp    $0xff,%edx
  ja     L13
  shl    $0x18,%eax
  shl    $0x10,%ecx
  or     %ecx,%eax
  shl    $0x8,%edx
  or     %edx,%eax
  or     %rax,%rbp
L58:
  mov    0x18(%rsp),%rbx
  mov    $0x1,%r12d
  test   %rbx,%rbx
  je     L367
  mov    %rbp,%rdi
  call   <htonl@plt>
  mov    %eax,(%rbx)
  jmp    L367
L157:
  cmp    $0xffff,%rbp
  ja     L13
  mov    0x20(%rsp),%eax
  cmp    $0xff,%eax
  ja     L13
  mov    0x24(%rsp),%edx
  cmp    $0xff,%edx
  ja     L13
  shl    $0x18,%eax
  shl    $0x10,%edx
  or     %edx,%eax
  or     %rax,%rbp
  jmp    L58
L349:
  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);
}
```