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

```asm
<strtol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %edx,%r14d
  mov    %rdi,%rbp
L113:
  mov    %rbp,%r12
  add    $0x1,%rbp
  movsbl -0x1(%rbp),%ebx
  mov    %ebx,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L113
  cmp    $0x2d,%ebx
  je     L164
  movl   $0x0,0xc(%rsp)
  cmp    $0x2b,%ebx
  je     L60
L88:
  test   $0xffffffef,%r14d
  jne    L278
  cmp    $0x30,%ebx
  je     L212
L278:
  test   %r14d,%r14d
  jne    L220
  cmp    $0x30,%ebx
  setne  %r14b
  movzbl %r14b,%r14d
  lea    0x8(%r14,%r14,1),%r14d
L220:
  cmpl   $0x0,0xc(%rsp)
  je     L222
  mov    D28(%rip),%rax
  mov    (%rax),%rax
  neg    %rax
L43:
  movslq %r14d,%rcx
  mov    %rcx,(%rsp)
  mov    $0x0,%edx
  div    %rcx
  mov    %rax,%r15
  mov    %edx,0x8(%rsp)
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  jmp    L42
L164:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  movl   $0x1,0xc(%rsp)
  jmp    L88
L60:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  jmp    L88
L212:
  movzbl 0x0(%rbp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L93
  movsbl 0x1(%rbp),%ebx
  add    $0x2,%rbp
  mov    $0x10,%r14d
  jmp    L220
L93:
  mov    $0x30,%ebx
  jmp    L278
L222:
  mov    D13(%rip),%rax
  mov    (%rax),%rax
  jmp    L43
L66:
  mov    %ebx,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L228
  mov    %ebx,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ebx
  jmp    L172
L230:
  mov    $0xffffffff,%r13d
L204:
  add    $0x1,%rbp
  movsbl -0x1(%rbp),%ebx
L42:
  mov    %ebx,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L66
  sub    $0x30,%ebx
L172:
  cmp    %ebx,%r14d
  jle    L228
  test   %r13d,%r13d
  js     L230
  cmp    %r15,%r12
  ja     L230
  jne    L80
  mov    $0xffffffff,%r13d
  cmp    0x8(%rsp),%ebx
  jg     L204
L80:
  imul   (%rsp),%r12
  movslq %ebx,%rbx
  add    %rbx,%r12
  mov    $0x1,%r13d
  jmp    L204
L228:
  test   %r13d,%r13d
  js     L54
  mov    %r12,%rax
  neg    %rax
  cmpl   $0x0,0xc(%rsp)
  cmovne %rax,%r12
  cmpq   $0x0,0x10(%rsp)
  je     L223
  test   %r13d,%r13d
  jne    L33
L156:
  mov    0x10(%rsp),%rax
  mov    0x18(%rsp),%rsi
  mov    %rsi,(%rax)
L223:
  mov    %r12,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  cmpl   $0x0,0xc(%rsp)
  je     L155
  mov    D28(%rip),%rax
  mov    (%rax),%r12
L53:
  mov    D55(%rip),%rax
  mov    (%rax),%edx
  mov    D4(%rip),%rax
  mov    %edx,(%rax)
  cmpq   $0x0,0x10(%rsp)
  je     L223
L33:
  lea    -0x1(%rbp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L156
L155:
  mov    D13(%rip),%rax
  mov    (%rax),%r12
  jmp    L53
```

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