user: What would the C source look like for the assembly code provided here:

```asm
<strtol>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x18(%rsp)
  test   %rdi,%rdi
  je     L283
  mov    %rdi,%r12
  mov    %edx,%ebx
  mov    $0x10,%r14d
  cmp    %r14d,%edx
  cmovle %edx,%r14d
  jmp    L5
L343:
  add    $0x1,%r12
L5:
  movsbl (%r12),%edi
  call   <isspace@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L343
  movzbl (%r12),%eax
  cmp    $0x2d,%al
  je     L197
  movl   $0x0,0x14(%rsp)
  cmp    $0x2b,%al
  je     L19
L23:
  mov    %ebx,%eax
  and    $0xfffffffd,%eax
  cmp    $0xf,%ebx
  jg     L148
  test   %ebx,%ebx
  je     L148
L339:
  test   %eax,%eax
  jne    L128
  cmpb   $0x30,(%r12)
  je     L273
L126:
  test   %ebx,%ebx
  jne    L128
  movzbl (%r12),%ebx
  cmp    $0x30,%bl
  je     L40
  mov    $0xa,%r14d
L128:
  mov    $0xffffffff80000000,%rax
  cmpl   $0x0,0x14(%rsp)
  jne    L103
L116:
  mov    $0x7fffffff,%eax
L103:
  movslq %r14d,%rsi
  mov    $0x0,%edx
  div    %rsi
  mov    %rdx,0x8(%rsp)
  mov    %rax,%r13
  movzbl (%r12),%ebx
  test   %bl,%bl
  je     L86
L350:
  movslq %r14d,%r15
  jmp    L367
L197:
  add    $0x1,%r12
  movl   $0x1,0x14(%rsp)
  jmp    L23
L19:
  add    $0x1,%r12
  jmp    L23
L148:
  cmpb   $0x30,(%r12)
  jne    L339
  movzbl 0x1(%r12),%edx
  and    $0xffffffdf,%edx
  cmp    $0x58,%dl
  jne    L117
  add    $0x2,%r12
  mov    $0x10,%r14d
  jmp    L128
L273:
  movzbl 0x1(%r12),%eax
  and    $0xffffffdf,%eax
  cmp    $0x42,%al
  jne    L126
  add    $0x2,%r12
  mov    $0x2,%r14d
  jmp    L128
L227:
  mov    %rbp,0x8(%rsp)
  movabs $0x1ffffffff0000000,%r13
  mov    $0x8,%r14d
  jmp    L350
L99:
  mov    %ebx,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L86
  mov    %ebx,%edi
  call   <isupper@plt>
  mov    %rax,%rdx
  lea    -0x37(%rbx),%eax
  sub    $0x57,%ebx
  test   %rdx,%rdx
  cmovne %eax,%ebx
  jmp    L244
L115:
  imul   %r15,%rbp
  movslq %ebx,%rbx
  add    %rbx,%rbp
  add    $0x1,%r12
  movzbl (%r12),%ebx
  test   %bl,%bl
  je     L86
L367:
  movsbl %bl,%ebx
  mov    %ebx,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L99
  sub    $0x30,%ebx
L244:
  cmp    %r14d,%ebx
  jge    L86
  cmp    %r13,%rbp
  ja     L86
  jne    L115
  movslq %ebx,%rax
  cmp    0x8(%rsp),%rax
  jle    L115
L86:
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L118
  mov    %r12,(%rax)
L118:
  mov    %rbp,%rax
  neg    %rax
  cmpl   $0x0,0x14(%rsp)
  cmovne %rax,%rbp
L248:
  mov    %rbp,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L283:
  mov    $0x0,%ebp
  jmp    L248
L40:
  cmpl   $0x0,0x14(%rsp)
  jne    L227
  movzbl (%r12),%ebx
  mov    $0xfffffff,%r13d
  movq   $0x7,0x8(%rsp)
  mov    $0x8,%r14d
  jmp    L350
L117:
  test   %eax,%eax
  je     L273
  cmpl   $0x0,0x14(%rsp)
  je     L116
  movslq %r14d,%rdx
  mov    $0xffffffff80000000,%rax
  mov    %rdx,%rcx
  mov    $0x0,%edx
  div    %rcx
  mov    %rdx,0x8(%rsp)
  mov    %rax,%r13
  movzbl (%r12),%ebx
  jmp    L350
```

assistant: ```c
long int strtol(const char *str, char **endptr, int base) {
  long int value = 0;
  int neg = 0;
  if (str == NULL)
    return (0);
  if (base >= 16)
    base = 16;
  while (isspace(*str))
    str++;
  if (*str == '-') {
    neg = 1;
    str++;
  } else if (*str == '+')
    str++;
  if ((base == 16 || base == 0) && *str == '0' && (*(str + 1) == 'x' || *(str + 1) == 'X')) {
    str += 2;
    base = 16;
  } else if ((base == 0 || base == 2) && *str == '0' && (*(str + 1) == 'b' || *(str + 1) == 'B')) {
    str += 2;
    base = 2;
  }
  if (base == 0) {
    if (*str == '0') {
      base = 8;
    } else
      base = 10;
  }
  unsigned long cutoff_value = 0;
  if (neg)
    cutoff_value = -(unsigned long)(0x80000000L);
  else
    cutoff_value = (unsigned long)(0x7FFFFFFFL);
  long int cutlim_value = cutoff_value % (unsigned long)base;
  cutoff_value /= base;
  while (*str != '\0') {
    int c = *str;
    if (isdigit(c))
      c -= '0';
    else if (isalpha(c)) {
      if (isupper(c))
        c -= ('A' - 10);
      else
        c -= ('a' - 10);
    } else
      break;
    if (c >= base)
      break;
    if (value > cutoff_value || (value == cutoff_value && c > cutlim_value))
      break;
    else {
      value *= base;
      value += c;
    }
    str++;
  }
  if (endptr)
    *endptr = (char *)str;
  if (neg)
    return -value;
  else
    return value;
}
```