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

```asm
<strtol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r14
  mov    %edx,%r12d
  mov    %rdi,%rbx
L117:
  mov    %rbx,%r15
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
  movzbl %bpl,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L117
  cmp    $0x2d,%bpl
  je     L67
  mov    $0x0,%r8d
  cmp    $0x2b,%bpl
  je     L187
L17:
  test   $0xffffffef,%r12d
  jne    L78
  cmp    $0x30,%bpl
  je     L299
L78:
  test   %r12d,%r12d
  jne    L141
  cmp    $0x30,%bpl
  setne  %r12b
  movzbl %r12b,%r12d
  lea    0x8(%r12,%r12,1),%r12d
L56:
  test   %r8d,%r8d
  je     L194
  mov    D8(%rip),%rax
  mov    (%rax),%rax
  neg    %rax
L274:
  movslq %r12d,%r9
  mov    $0x0,%edx
  div    %r9
  mov    %rax,%rsi
  mov    $0x0,%r11d
  mov    $0x0,%eax
  mov    $0xffffffff,%edi
  mov    $0x1,%r10d
  jmp    L10
L67:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  mov    $0x1,%r8d
  jmp    L17
L187:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  jmp    L17
L299:
  movzbl (%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L71
  movzbl 0x1(%rbx),%ebp
  mov    %ebp,%eax
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L260
  lea    -0x30(%rbp),%eax
  cmp    $0x9,%al
  jbe    L260
L71:
  mov    $0x30,%ebp
  test   %r12d,%r12d
  jne    L141
  mov    $0x30,%ebp
  mov    $0x8,%r12d
  jmp    L56
L260:
  add    $0x2,%rbx
  mov    $0x10,%r12d
  jmp    L56
L141:
  lea    -0x2(%r12),%eax
  cmp    $0x22,%eax
  jbe    L56
  mov    $0x0,%eax
  test   %r14,%r14
  jne    L98
  jmp    L306
L194:
  mov    D33(%rip),%rax
  mov    (%rax),%rax
  jmp    L274
L189:
  mov    %edi,%r11d
L375:
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
L10:
  mov    %ebp,%r15d
  lea    -0x30(%rbp),%ecx
  cmp    $0x9,%cl
  jbe    L4
  sub    $0x41,%ebp
  lea    -0x37(%r15),%ecx
  cmp    $0x19,%bpl
  jbe    L4
  lea    -0x61(%r15),%ecx
  cmp    $0x19,%cl
  ja     L70
  lea    -0x57(%r15),%ecx
L4:
  movsbl %cl,%ebp
  cmp    %r12d,%ebp
  jge    L70
  test   %r11d,%r11d
  js     L189
  cmp    %rsi,%rax
  ja     L189
  cmp    %edx,%ebp
  jle    L254
  mov    %edi,%r11d
  cmp    %rsi,%rax
  je     L375
L254:
  imul   %r9,%rax
  movsbq %cl,%rcx
  add    %rcx,%rax
  mov    %r10d,%r11d
  jmp    L375
L70:
  test   %r11d,%r11d
  js     L52
  test   %r8d,%r8d
  je     L287
  test   %r11d,%r11d
  jne    L250
L287:
  test   %r14,%r14
  je     L306
  test   %r11d,%r11d
  je     L98
  jmp    L195
L52:
  test   %r8d,%r8d
  je     L345
  mov    D8(%rip),%rax
  mov    (%rax),%rax
L264:
  test   %r14,%r14
  je     L306
L195:
  lea    -0x1(%rbx),%r13
L98:
  mov    %r13,(%r14)
L306:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L345:
  mov    D33(%rip),%rax
  mov    (%rax),%rax
  jmp    L264
L250:
  neg    %rax
  jmp    L264
```

assistant: ```c
long strtol(const char *__restrict nptr, char **__restrict endptr, int base) {
  const char *s;
  unsigned long acc;
  char c;
  unsigned long cutoff;
  int neg, any, cutlim;
  s = nptr;
  do {
    c = *s++;
  } while (isspace((unsigned char)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') && ((s[1] >= '0' && s[1] <= '9') || (s[1] >= 'A' && s[1] <= 'F') || (s[1] >= 'a' && s[1] <= 'f'))) {
    c = s[1];
    s += 2;
    base = 16;
  }
  if (base == 0)
    base = c == '0' ? 8 : 10;
  acc = any = 0;
  if (base < 2 || base > 36)
    goto noconv;
  cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX;
  cutlim = cutoff % base;
  cutoff /= base;
  for (;; c = *s++) {
    if (c >= '0' && c <= '9')
      c -= '0';
    else if (c >= 'A' && c <= 'Z')
      c -= 'A' - 10;
    else if (c >= 'a' && c <= 'z')
      c -= '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;
  } else if (!any) {
  } else if (neg)
    acc = -acc;
noconv:
  if (endptr != NULL)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```