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

```asm
<strtol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,(%rsp)
  cmp    $0x1,%edx
  je     L393
  mov    %edx,%ebx
  mov    %rdi,%r15
  cmp    $0x24,%edx
  ja     L393
  nopl   0x0(%rax,%rax,1)
L93:
  mov    %r15,%rbp
  movzbl (%r15),%r14d
  add    $0x1,%r15
  mov    %r14d,%edi
  call   <isspace@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L93
  cmp    $0x2d,%r14d
  je     L84
  movl   $0x0,0x18(%rsp)
  cmp    $0x2b,%r14d
  je     L208
L382:
  test   $0xffffffef,%ebx
  jne    L273
  cmp    $0x30,%r14d
  je     L322
  test   %ebx,%ebx
  jne    L273
  movq   $0xa,0x10(%rsp)
  mov    $0xa,%ebx
  jmp    L342
  nopl   (%rax)
L393:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L260
  mov    %r13,(%rax)
L260:
  mov    D43(%rip),%rax
  xor    %r12d,%r12d
  mov    (%rax),%edx
  mov    D60(%rip),%rax
  mov    %edx,(%rax)
L324:
  add    $0x28,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L273:
  movslq %ebx,%rax
  mov    %rax,0x10(%rsp)
L342:
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  je     L157
  mov    D71(%rip),%rax
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,%edi
  test   %rdx,%rdx
  jle    L383
  addq   $0x1,0x8(%rsp)
  sub    %ebx,%edi
L383:
  neg    %edi
  xor    %ebp,%ebp
  mov    %edi,0x1c(%rsp)
  jmp    L255
  nopl   0x0(%rax,%rax,1)
L174:
  cmp    %ecx,%ebx
  jle    L300
L49:
  cmp    $0xffffffff,%ebp
  je     L193
  cmp    0x8(%rsp),%r12
  jl     L351
  jne    L234
  cmp    0x1c(%rsp),%ecx
  jle    L234
L351:
  mov    D71(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D29(%rip),%rax
  mov    (%rax),%edx
  mov    D60(%rip),%rax
  mov    %edx,(%rax)
L193:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L255:
  mov    %r14d,%edi
  call   <isdigit@plt>
  lea    -0x30(%r14),%ecx
  test   %rax,%rax
  jne    L174
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L300
  mov    %r14d,%edi
  call   <isupper@plt>
  mov    %r14d,%ecx
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ecx
  cmp    %ecx,%ebx
  jg     L49
  nopl   0x0(%rax,%rax,1)
L300:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L324
  lea    -0x1(%r15),%rsi
  test   %ebp,%ebp
  cmovne %rsi,%r13
  mov    %r13,(%rax)
  jmp    L324
  nop
L234:
  imul   0x10(%rsp),%r12
  movslq %ecx,%rcx
  mov    0x18(%rsp),%ebp
  sub    %rcx,%r12
  jmp    L193
  nopl   (%rax)
L157:
  mov    D56(%rip),%rax
  xor    %ebp,%ebp
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,0x18(%rsp)
  jmp    L367
  cs nopw 0x0(%rax,%rax,1)
L386:
  cmp    %ebx,%eax
  jge    L300
  cmp    $0xffffffff,%ebp
  je     L178
  cmp    0x8(%rsp),%r12
  jg     L179
  cmp    0x18(%rsp),%eax
  jle    L287
  cmp    0x8(%rsp),%r12
  jne    L287
L179:
  mov    D56(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D29(%rip),%rax
  mov    (%rax),%edx
  mov    D60(%rip),%rax
  mov    %edx,(%rax)
L178:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L367:
  mov    %r14d,%edi
  call   <isdigit@plt>
  mov    %rax,%r8
  lea    -0x30(%r14),%eax
  test   %r8,%r8
  jne    L386
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L300
  mov    %r14d,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  mov    %r14d,%eax
  sbb    %edx,%edx
  and    $0x20,%edx
  add    $0x37,%edx
  sub    %edx,%eax
  jmp    L386
  nopl   0x0(%rax)
L287:
  imul   0x10(%rsp),%r12
  cltq
  mov    $0x1,%ebp
  add    %rax,%r12
  jmp    L178
  nopw   0x0(%rax,%rax,1)
L208:
  movsbl (%r15),%r14d
  lea    0x2(%rbp),%r15
  jmp    L382
  nopl   (%rax)
L322:
  movzbl (%r15),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L35
  test   %ebx,%ebx
  jne    L273
  movq   $0x8,0x10(%rsp)
  mov    $0x8,%ebx
  jmp    L342
  xchg   %ax,%ax
L84:
  movsbl (%r15),%r14d
  movl   $0x1,0x18(%rsp)
  lea    0x2(%rbp),%r15
  jmp    L382
L35:
  movsbl 0x1(%r15),%r14d
  mov    $0x10,%ebx
  add    $0x2,%r15
  movq   $0x10,0x10(%rsp)
  jmp    L342
```

assistant: ```c
long strtol(const char *nptr, char **endptr, int base) {
  const char *s;
  long acc, cutoff;
  int c;
  int neg, any, cutlim;
  if (base < 0 || base == 1 || base > 36) {
    if (endptr != 0)
      *endptr = (char *)nptr;
    errno = EINVAL;
    return 0;
  }
  s = nptr;
  do {
    c = (unsigned char)*s++;
  } while (isspace(c));
  if (c == '-') {
    neg = 1;
    c = *s++;
  } else {
    neg = 0;
    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 ? LONG_MIN : LONG_MAX;
  cutlim = cutoff % base;
  cutoff /= base;
  if (neg) {
    if (cutlim > 0) {
      cutlim -= base;
      cutoff += 1;
    }
    cutlim = -cutlim;
  }
  for (acc = 0, any = 0;; c = (unsigned char)*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 (neg) {
      if (acc < cutoff || (acc == cutoff && c > cutlim)) {
        any = -1;
        acc = LONG_MIN;
        errno = ERANGE;
      } else {
        any = 1;
        acc *= base;
        acc -= c;
      }
    } else {
      if (acc > cutoff || (acc == cutoff && c > cutlim)) {
        any = -1;
        acc = LONG_MAX;
        errno = ERANGE;
      } else {
        any = 1;
        acc *= base;
        acc += c;
      }
    }
  }
  if (endptr != 0)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```