user: What is the c source code of the assembly code below?

```asm
<strtol>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x1,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L161
L184:
  addq   $0x1,-0x18(%rbp)
L161:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L184
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L82
  movl   $0xffffffff,-0x10(%rbp)
  addq   $0x1,-0x18(%rbp)
  jmp    L230
L82:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L230
  addq   $0x1,-0x18(%rbp)
L230:
  cmpl   $0x0,-0x24(%rbp)
  je     L147
  cmpl   $0x10,-0x24(%rbp)
  jne    L1
L147:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L1
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L259
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L1
L259:
  addq   $0x2,-0x18(%rbp)
  movl   $0x10,-0x24(%rbp)
  jmp    L94
L1:
  cmpl   $0x0,-0x24(%rbp)
  jne    L192
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L192
  addq   $0x1,-0x18(%rbp)
  movl   $0x8,-0x24(%rbp)
  jmp    L94
L192:
  cmpl   $0x0,-0x24(%rbp)
  jne    L10
  movl   $0xa,-0x24(%rbp)
L94:
  jmp    L10
L176:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L256
  subl   $0x30,-0xc(%rbp)
  jmp    L217
L256:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L19
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L115
  mov    $0x37,%eax
  jmp    L156
L115:
  mov    $0x57,%eax
L156:
  sub    %eax,-0xc(%rbp)
L217:
  mov    -0xc(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jge    L227
  mov    -0x24(%rbp),%eax
  cltq
  mov    -0x8(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addq   $0x1,-0x18(%rbp)
L10:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L176
  jmp    L80
L19:
  nop
  jmp    L80
L227:
  nop
L80:
  cmpq   $0x0,-0x20(%rbp)
  je     L119
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
L119:
  mov    -0x10(%rbp),%eax
  cltq
  imul   -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
long int strtol(const char *nptr, char **endptr, int base) {
  int sign = 1;
  long int result = 0;
  int digit;
  while (isspace(*nptr))
    ++nptr;
  if (*nptr == '-') {
    sign = -1;
    ++nptr;
  } else if (*nptr == '+')
    ++nptr;
  if ((base == 0 || base == 16) && *nptr == '0' && (*(nptr + 1) == 'x' || *(nptr + 1) == 'X')) {
    nptr += 2;
    base = 16;
  } else if (base == 0 && *nptr == '0') {
    ++nptr;
    base = 8;
  } else if (base == 0)
    base = 10;
  while (*nptr) {
    digit = *nptr;
    if (isdigit(digit))
      digit -= '0';
    else if (isalpha(digit))
      digit -= isupper(digit) ? 'A' - 10 : 'a' - 10;
    else
      break;
    if (digit >= base)
      break;
    result *= base;
    result += digit;
    ++nptr;
  }
  if (endptr)
    *endptr = (char *)nptr;
  return sign * result;
}
```