user: 请从给定的汇编指令推导出C源代码:

```asm
<inet_aton>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x50(%rbp),%r13
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
L368:
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L74
  mov    $0x0,%eax
  jmp    L216
L74:
  mov    $0x0,%r12d
  mov    $0xa,%r14d
  cmp    $0x30,%bl
  jne    L49
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
  cmp    $0x78,%bl
  je     L383
  cmp    $0x58,%bl
  jne    L158
L383:
  mov    $0x10,%r14d
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
  jmp    L49
L158:
  mov    $0x8,%r14d
L49:
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L96
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L96
  movslq %r14d,%rax
  mov    %r12,%rdx
  imul   %rax,%rdx
  movsbl %bl,%eax
  sub    $0x30,%eax
  cltq
  lea    (%rdx,%rax,1),%r12
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
  jmp    L405
L96:
  cmp    $0x10,%r14d
  jne    L41
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L41
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L41
  mov    %r12,%r15
  shl    $0x4,%r15
  movsbl %bl,%eax
  lea    0xa(%rax),%r12d
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %rax,%rax
  je     L407
  mov    $0x61,%edx
  jmp    L71
L407:
  mov    $0x41,%edx
L71:
  mov    %r12d,%eax
  sub    %edx,%eax
  cltq
  or     %rax,%r15
  mov    %r15,%r12
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
L405:
  jmp    L49
L41:
  cmp    $0x2e,%bl
  jne    L375
  lea    -0x50(%rbp),%rax
  add    $0xc,%rax
  cmp    %rax,%r13
  jb     L128
  mov    $0x0,%eax
  jmp    L216
L128:
  mov    %r13,%rax
  lea    0x4(%rax),%r13
  mov    %r12d,%edx
  mov    %edx,(%rax)
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%ebx
  jmp    L368
L375:
  nop
  test   %bl,%bl
  je     L217
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isascii@plt>
  test   %rax,%rax
  je     L192
  movsbl %bl,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L217
L192:
  mov    $0x0,%eax
  jmp    L216
L217:
  lea    -0x50(%rbp),%rdx
  mov    %r13,%rax
  sub    %rdx,%rax
  sar    $0x2,%rax
  add    $0x1,%eax
  mov    %eax,%ebx
  cmp    $0x4,%ebx
  ja     L390
  mov    %ebx,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D16(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D16(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x0,%eax
  jmp    L216
  cmp    $0xffffff,%r12
  ja     L247
  mov    -0x50(%rbp),%eax
  cmp    $0xff,%eax
  jbe    L144
L247:
  mov    $0x0,%eax
  jmp    L216
L144:
  mov    -0x50(%rbp),%eax
  shl    $0x18,%eax
  mov    %eax,%eax
  or     %rax,%r12
  jmp    L390
  cmp    $0xffff,%r12
  ja     L213
  mov    -0x50(%rbp),%eax
  cmp    $0xff,%eax
  ja     L213
  mov    -0x4c(%rbp),%eax
  cmp    $0xff,%eax
  jbe    L21
L213:
  mov    $0x0,%eax
  jmp    L216
L21:
  mov    -0x50(%rbp),%eax
  shl    $0x18,%eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  shl    $0x10,%eax
  or     %edx,%eax
  mov    %eax,%eax
  or     %rax,%r12
  jmp    L390
  cmp    $0xff,%r12
  ja     L402
  mov    -0x50(%rbp),%eax
  cmp    $0xff,%eax
  ja     L402
  mov    -0x4c(%rbp),%eax
  cmp    $0xff,%eax
  ja     L402
  mov    -0x48(%rbp),%eax
  cmp    $0xff,%eax
  jbe    L124
L402:
  mov    $0x0,%eax
  jmp    L216
L124:
  mov    -0x50(%rbp),%eax
  shl    $0x18,%eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0x48(%rbp),%eax
  shl    $0x8,%eax
  or     %edx,%eax
  mov    %eax,%eax
  or     %rax,%r12
  jmp    L390
  nop
L390:
  cmpq   $0x0,-0x60(%rbp)
  je     L268
  mov    %r12,%rdi
  call   <htonl@plt>
  mov    -0x60(%rbp),%rdx
  mov    %eax,(%rdx)
L268:
  mov    $0x1,%eax
L216:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L371
  call   <__stack_chk_fail@plt>
L371:
  add    $0x38,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

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);
}
```