user: Please show me the C implementation that matches the assembly code listed below:

```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,%r15d
  mov    %rdi,%rbp
L87:
  mov    %rbp,%r12
  add    $0x1,%rbp
  movsbl -0x1(%rbp),%ebx
  mov    %ebx,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L87
  cmp    $0x2d,%ebx
  je     L77
  movl   $0x0,0xc(%rsp)
  cmp    $0x2b,%ebx
  je     L177
L20:
  cmp    $0x30,%ebx
  je     L163
L207:
  test   %r15d,%r15d
  jne    L196
  cmp    $0x30,%ebx
  setne  %r15b
  movzbl %r15b,%r15d
  lea    0x8(%r15,%r15,1),%r15d
L196:
  cmpl   $0x0,0xc(%rsp)
  je     L176
  mov    D19(%rip),%rax
  mov    (%rax),%rax
  neg    %rax
L86:
  movslq %r15d,%rcx
  mov    %rcx,(%rsp)
  mov    $0x0,%edx
  div    %rcx
  mov    %rax,%r14
  mov    %edx,0x8(%rsp)
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  jmp    L268
L77:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  movl   $0x1,0xc(%rsp)
  jmp    L20
L177:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  jmp    L20
L163:
  test   $0xffffffef,%r15d
  jne    L196
  movzbl 0x0(%rbp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L207
  movsbl 0x1(%rbp),%ebx
  add    $0x2,%rbp
  mov    $0x10,%r15d
  jmp    L196
L176:
  mov    D22(%rip),%rax
  mov    (%rax),%rax
  jmp    L86
L123:
  mov    %ebx,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L106
  mov    %ebx,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ebx
  jmp    L239
L146:
  mov    $0xffffffff,%r13d
L96:
  add    $0x1,%rbp
  movsbl -0x1(%rbp),%ebx
L268:
  mov    %ebx,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L123
  sub    $0x30,%ebx
L239:
  cmp    %ebx,%r15d
  jle    L106
  test   %r13d,%r13d
  js     L146
  cmp    %r14,%r12
  ja     L146
  jne    L15
  mov    $0xffffffff,%r13d
  cmp    0x8(%rsp),%ebx
  jg     L96
L15:
  imul   (%rsp),%r12
  movslq %ebx,%rbx
  add    %rbx,%r12
  mov    $0x1,%r13d
  jmp    L96
L106:
  test   %r13d,%r13d
  js     L134
  mov    %r12,%rax
  neg    %rax
  cmpl   $0x0,0xc(%rsp)
  cmovne %rax,%r12
  cmpq   $0x0,0x10(%rsp)
  je     L81
  test   %r13d,%r13d
  jne    L44
L257:
  mov    0x10(%rsp),%rax
  mov    0x18(%rsp),%rsi
  mov    %rsi,(%rax)
L81:
  mov    %r12,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L134:
  cmpl   $0x0,0xc(%rsp)
  je     L116
  mov    D19(%rip),%rax
  mov    (%rax),%r12
L22:
  cmpq   $0x0,0x10(%rsp)
  je     L81
L44:
  lea    -0x1(%rbp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L257
L116:
  mov    D22(%rip),%rax
  mov    (%rax),%r12
  jmp    L22
```

assistant: ```c
long strtol(const char *number_string, char **end_pointer, int base) {
  unsigned long acc, cutoff;
  int c, any, cutlim;
  const char *s = number_string;
  bool is_negative = false;
  do {
    c = *s++;
  } while (isspace(c));
  if (c == '-') {
    c = *s++;
    is_negative = true;
  } else if (c == '+')
    c = *s++;
  if (c == '0' && (base == 0 || base == 16) && (*s == 'x' || *s == 'X')) {
    c = s[1];
    s += 2;
    base = 16;
  }
  if (base == 0)
    base = c == '0' ? 8 : 10;
  cutoff = is_negative ? -(unsigned long)INT32_MIN : INT32_MAX;
  cutlim = cutoff % (unsigned long)base;
  cutoff /= 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 = is_negative ? INT32_MIN : INT32_MAX;
  else if (is_negative)
    acc = -acc;
  if (end_pointer != 0)
    *end_pointer = (char *)(any ? s - 1 : number_string);
  return acc;
}
```