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

```asm
<strtol>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %rsi,0x18(%rsp)
  nopw   0x0(%rax,%rax,1)
L91:
  mov    %r15,%rbp
  movzbl (%r15),%edi
  add    $0x1,%r15
  mov    %edi,%ebx
  call   <isspace@plt>
  test   %rax,%rax
  jne    L91
  mov    %r14d,%eax
  and    $0xffffffef,%eax
  cmp    $0x2d,%bl
  je     L107
  cmp    $0x2b,%bl
  je     L119
  test   %eax,%eax
  je     L217
L36:
  movslq %r14d,%rax
  mov    %rax,0x10(%rsp)
L58:
  mov    D24(%rip),%rax
  movl   $0x0,0x2c(%rsp)
  mov    (%rax),%rax
  jmp    L93
  nopl   0x0(%rax,%rax,1)
L107:
  movzbl (%r15),%ebx
  add    $0x2,%rbp
  test   %eax,%eax
  jne    L285
  mov    %rbp,%r15
  mov    $0x1,%eax
L217:
  cmp    $0x30,%bl
  je     L226
  test   %r14d,%r14d
  jne    L11
  movq   $0xa,0x10(%rsp)
  mov    $0xa,%r14d
L214:
  test   %eax,%eax
  je     L58
L305:
  mov    D18(%rip),%rax
  movl   $0x1,0x2c(%rsp)
  mov    (%rax),%rax
  neg    %rax
L93:
  xor    %edx,%edx
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  divq   0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,0x28(%rsp)
  jmp    L277
  nopl   0x0(%rax)
L225:
  sub    $0x30,%ebx
  movzbl %bl,%eax
  cmp    %r14d,%eax
  jge    L54
L232:
  mov    0x8(%rsp),%rcx
  cmp    %rcx,%r12
  ja     L6
  cmp    $0xffffffff,%ebp
  je     L6
  cmp    0x28(%rsp),%eax
  jle    L34
  mov    $0xffffffff,%ebp
  cmp    %rcx,%r12
  je     L162
L34:
  imul   0x10(%rsp),%r12
  movzbl %bl,%ebx
  mov    $0x1,%ebp
  add    %rbx,%r12
L162:
  movzbl (%r15),%ebx
  add    $0x1,%r15
L277:
  movzbl %bl,%r13d
  mov    %r13d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L225
  mov    %r13d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L54
  mov    %r13d,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ebx
  movzbl %bl,%eax
  cmp    %r14d,%eax
  jl     L232
L54:
  cmp    $0xffffffff,%ebp
  je     L245
  mov    0x2c(%rsp),%edx
  mov    %r12,%rax
  neg    %rax
  test   %edx,%edx
  cmovne %rax,%r12
  cmpq   $0x0,0x18(%rsp)
  je     L284
  test   %ebp,%ebp
  jne    L208
L160:
  mov    0x18(%rsp),%rax
  mov    0x20(%rsp),%rdx
  mov    %rdx,(%rax)
L284:
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L119:
  movzbl (%r15),%ebx
  lea    0x2(%rbp),%r15
  test   %eax,%eax
  je     L217
  jmp    L36
  nopl   (%rax)
L6:
  mov    $0xffffffff,%ebp
  jmp    L162
  nopw   0x0(%rax,%rax,1)
L245:
  mov    0x2c(%rsp),%ecx
  test   %ecx,%ecx
  je     L103
  mov    D18(%rip),%rax
  mov    (%rax),%r12
L179:
  cmpq   $0x0,0x18(%rsp)
  je     L284
L208:
  lea    -0x1(%r15),%rax
  mov    %rax,0x20(%rsp)
  jmp    L160
  nopl   (%rax)
L103:
  mov    D24(%rip),%rax
  mov    (%rax),%r12
  jmp    L179
  nopl   0x0(%rax)
L226:
  movzbl (%r15),%edx
  and    $0xffffffdf,%edx
  cmp    $0x58,%dl
  jne    L10
  movzbl 0x1(%r15),%ebx
  mov    $0x10,%r14d
  add    $0x2,%r15
  movq   $0x10,0x10(%rsp)
  jmp    L214
L10:
  test   %r14d,%r14d
  jne    L11
  movq   $0x8,0x10(%rsp)
  mov    $0x8,%r14d
  jmp    L214
L11:
  movslq %r14d,%rdx
  mov    %rdx,0x10(%rsp)
  jmp    L214
L285:
  movslq %r14d,%rax
  mov    %rbp,%r15
  mov    %rax,0x10(%rsp)
  jmp    L305
```

assistant: ```c
long strtol(const char *nptr, char **endptr, int base) {
  const char *s = nptr;
  unsigned long acc;
  unsigned char c;
  unsigned long cutoff;
  int neg = 0, any, cutlim;
  do {
    c = *s++;
  } while (isspace(c));
  if (c == '-') {
    neg = 1;
    c = *s++;
  } else if (c == '+') {
    c = *s++;
  }
  if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
    c = s[1];
    s += 2;
    base = 16;
  }
  if (base == 0) {
    base = c == '0' ? 8 : 10;
  }
  cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
  cutlim = cutoff % (unsigned long)base;
  cutoff /= (unsigned long)base;
  for (acc = 0, any = 0;; c = *s++) {
    if (isdigit(c)) {
      c -= '0';
    } else if (isalpha(c)) {
      c -= isupper(c) ? 'A' - 10 : 'a' - 10;
    } else {
      break;
    }
    if (c >= base) {
      break;
    }
    if (any < 0) {
      continue;
    }
    if (acc > cutoff || (acc == cutoff && c > cutlim)) {
      any = -1;
    } else {
      any = 1;
      acc *= base;
      acc += c;
    }
  }
  if (any < 0) {
    acc = neg ? LONG_MIN : LONG_MAX;
  } else if (neg) {
    acc = -acc;
  }
  if (endptr != 0) {
    *((const char **)endptr) = any ? s - 1 : nptr;
  }
  return acc;
}
```