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

```asm
<strtol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x20(%rsp)
  mov    %edx,0x8(%rsp)
  cmp    $0x1,%edx
  je     L331
  cmp    $0x24,%edx
  jbe    L110
L331:
  movl   $0xa,0x8(%rsp)
L110:
  mov    0x18(%rsp),%rbx
  jmp    L405
  nopl   0x0(%rax)
L228:
  add    $0x1,%rbx
L405:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L228
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L36
  cmp    $0x2d,%dil
  je     L203
  movl   $0x0,0x2c(%rsp)
  cmp    $0x2b,%dil
  jne    L4
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  cmpl   $0x10,0x8(%rsp)
  jne    L261
L318:
  movq   $0x10,0x10(%rsp)
  cmp    $0x30,%dil
  jne    L322
  movsbl 0x1(%rbx),%edi
  call   <toupper@plt>
  cmp    $0x58,%al
  je     L135
  movzbl (%rbx),%edi
  jmp    L322
  nopl   0x0(%rax,%rax,1)
L203:
  movl   $0x1,0x2c(%rsp)
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
L4:
  cmpl   $0x10,0x8(%rsp)
  je     L318
L261:
  mov    0x8(%rsp),%esi
  test   %esi,%esi
  jne    L13
  movq   $0xa,0x10(%rsp)
  movl   $0xa,0x8(%rsp)
  cmp    $0x30,%dil
  je     L73
L322:
  mov    D18(%rip),%rax
  xor    %edx,%edx
  mov    %edi,%r15d
  mov    (%rax),%rax
  divq   0x10(%rsp)
  mov    %rax,(%rsp)
  mov    %edx,0x28(%rsp)
  test   %dil,%dil
  je     L36
  movl   $0x0,0xc(%rsp)
  mov    %rbx,%rbp
  xor    %r13d,%r13d
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L82:
  je     L227
L57:
  imul   0x10(%rsp),%r13
  movzbl 0x1(%rbp),%r15d
  movzbl %dl,%edx
  add    $0x1,%rbp
  add    %rdx,%r13
  test   %r15b,%r15b
  je     L337
L3:
  movzbl %r15b,%r14d
  mov    %r14d,%edi
  call   <isdigit@plt>
  lea    -0x30(%r15),%edx
  test   %rax,%rax
  je     L347
L305:
  movzbl %dl,%eax
  cmp    0x8(%rsp),%eax
  jge    L337
  cmp    (%rsp),%r13
  jbe    L82
  movl   $0x1,0xc(%rsp)
L362:
  movzbl 0x1(%rbp),%r15d
  add    $0x1,%rbp
  test   %r15b,%r15b
  jne    L3
L337:
  cmp    %rbp,%rbx
  je     L36
  mov    0x20(%rsp),%rax
  test   %rax,%rax
  je     L131
  mov    %rbp,(%rax)
L131:
  mov    0x2c(%rsp),%ecx
  test   %ecx,%ecx
  je     L312
  mov    D2(%rip),%rax
  mov    (%rax),%r12
  mov    %r12,%rax
  neg    %rax
  cmp    %rax,%r13
  ja     L71
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  jne    L71
  mov    %r13,%r12
  neg    %r12
  jmp    L151
  nopl   (%rax)
L347:
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L337
  movsbl %r15b,%edi
  call   <toupper@plt>
  lea    -0x37(%rax),%edx
  jmp    L305
  cs nopw 0x0(%rax,%rax,1)
L227:
  cmp    0x28(%rsp),%eax
  jbe    L57
  movl   $0x1,0xc(%rsp)
  jmp    L362
  nopw   0x0(%rax,%rax,1)
L312:
  mov    D48(%rip),%rax
  mov    (%rax),%r12
  cmp    %r12,%r13
  jbe    L113
L71:
  mov    D17(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    %edx,(%rax)
L151:
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L36:
  mov    0x20(%rsp),%rax
  test   %rax,%rax
  je     L151
  mov    0x18(%rsp),%rcx
  mov    %rcx,(%rax)
  jmp    L151
  nopl   0x0(%rax)
L113:
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L71
  mov    %r13,%r12
  jmp    L151
  nopl   (%rax)
L13:
  movslq 0x8(%rsp),%rax
  mov    %rax,0x10(%rsp)
  jmp    L322
L73:
  movsbl 0x1(%rbx),%edi
  call   <toupper@plt>
  cmp    $0x58,%al
  je     L313
  movq   $0x8,0x10(%rsp)
  movzbl (%rbx),%edi
  movl   $0x8,0x8(%rsp)
  jmp    L322
L313:
  movzbl 0x2(%rbx),%edi
  movl   $0x10,0x8(%rsp)
  add    $0x2,%rbx
  movq   $0x10,0x10(%rsp)
  jmp    L322
L135:
  movzbl 0x2(%rbx),%edi
  add    $0x2,%rbx
  jmp    L322
```

assistant: ```c
long int strtol(const char *nptr, char **endptr, int base) {
  int negative;
  register unsigned long int cutoff;
  register unsigned int cutlim;
  register unsigned long int i;
  register const char *s;
  register unsigned char c;
  const char *save;
  int overflow;
  if (base < 0 || base == 1 || base > 36)
    base = 10;
  s = nptr;
  while (isspace(*s))
    ++s;
  if (*s == '\0')
    goto noconv;
  if (*s == '-') {
    negative = 1;
    ++s;
  } else if (*s == '+') {
    negative = 0;
    ++s;
  } else
    negative = 0;
  if (base == 16 && s[0] == '0' && toupper(s[1]) == 'X')
    s += 2;
  if (base == 0)
    if (*s == '0') {
      if (toupper(s[1]) == 'X') {
        s += 2;
        base = 16;
      } else
        base = 8;
    } else
      base = 10;
  save = s;
  cutoff = ULONG_MAX / (unsigned long int)base;
  cutlim = ULONG_MAX % (unsigned long int)base;
  overflow = 0;
  i = 0;
  for (c = *s; c != '\0'; c = *++s) {
    if (isdigit(c))
      c -= '0';
    else if (isalpha(c))
      c = toupper(c) - 'A' + 10;
    else
      break;
    if (c >= base)
      break;
    if (i > cutoff || (i == cutoff && c > cutlim))
      overflow = 1;
    else {
      i *= (unsigned long int)base;
      i += c;
    }
  }
  if (s == save)
    goto noconv;
  if (endptr != NULL)
    *endptr = (char *)s;
  if (i > (negative ? -(unsigned long int)LONG_MIN : (unsigned long int)LONG_MAX))
    overflow = 1;
  if (overflow) {
    errno = ERANGE;
    return negative ? LONG_MIN : LONG_MAX;
  }
  return (negative ? -i : i);
noconv:
  if (endptr != NULL)
    *endptr = (char *)nptr;
  return 0L;
}
```