user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strtol>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L26:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  movzbl -0x25(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L26
  cmpb   $0x2d,-0x25(%rbp)
  jne    L459
  movl   $0x1,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  jmp    L405
L459:
  movl   $0x0,-0x24(%rbp)
  cmpb   $0x2b,-0x25(%rbp)
  jne    L405
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
L405:
  cmpl   $0x0,-0x44(%rbp)
  je     L196
  cmpl   $0x10,-0x44(%rbp)
  jne    L107
L196:
  cmpb   $0x30,-0x25(%rbp)
  jne    L107
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L37
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L107
L37:
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L3
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L285
L3:
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L403
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jle    L285
L403:
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L107
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L107
L285:
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  addq   $0x2,-0x18(%rbp)
  movl   $0x10,-0x44(%rbp)
L107:
  cmpl   $0x0,-0x44(%rbp)
  jne    L49
  cmpb   $0x30,-0x25(%rbp)
  jne    L90
  mov    $0x8,%eax
  jmp    L325
L90:
  mov    $0xa,%eax
L325:
  mov    %eax,-0x44(%rbp)
L49:
  movl   $0x0,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  cmpl   $0x1,-0x44(%rbp)
  jle    L98
  cmpl   $0x24,-0x44(%rbp)
  jg     L98
  cmpl   $0x0,-0x24(%rbp)
  je     L199
  mov    D9(%rip),%rax
  mov    (%rax),%rax
  neg    %rax
  jmp    L210
L199:
  mov    D24(%rip),%rax
  mov    (%rax),%rax
L210:
  mov    %rax,-0x8(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  mov    $0x0,%edx
  div    %rcx
  mov    %rdx,%rax
  mov    %eax,-0x1c(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rsi
  mov    -0x8(%rbp),%rax
  mov    $0x0,%edx
  div    %rsi
  mov    %rax,-0x8(%rbp)
L367:
  cmpb   $0x2f,-0x25(%rbp)
  jle    L346
  cmpb   $0x39,-0x25(%rbp)
  jg     L346
  movzbl -0x25(%rbp),%eax
  sub    $0x30,%eax
  mov    %al,-0x25(%rbp)
  jmp    L412
L346:
  cmpb   $0x40,-0x25(%rbp)
  jle    L189
  cmpb   $0x5a,-0x25(%rbp)
  jg     L189
  movzbl -0x25(%rbp),%eax
  sub    $0x37,%eax
  mov    %al,-0x25(%rbp)
  jmp    L412
L189:
  cmpb   $0x60,-0x25(%rbp)
  jle    L304
  cmpb   $0x7a,-0x25(%rbp)
  jg     L304
  movzbl -0x25(%rbp),%eax
  sub    $0x57,%eax
  mov    %al,-0x25(%rbp)
L412:
  movsbl -0x25(%rbp),%eax
  cmp    %eax,-0x44(%rbp)
  jle    L338
  cmpl   $0x0,-0x20(%rbp)
  js     L68
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  ja     L68
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jne    L211
  movsbl -0x25(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jge    L211
L68:
  movl   $0xffffffff,-0x20(%rbp)
  jmp    L14
L211:
  movl   $0x1,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  mov    -0x10(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x10(%rbp)
  movsbq -0x25(%rbp),%rax
  add    %rax,-0x10(%rbp)
L14:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x25(%rbp)
  jmp    L367
L338:
  nop
L304:
  cmpl   $0x0,-0x20(%rbp)
  jns    L195
  cmpl   $0x0,-0x24(%rbp)
  je     L296
  mov    D9(%rip),%rax
  mov    (%rax),%rax
  jmp    L77
L296:
  mov    D24(%rip),%rax
  mov    (%rax),%rax
L77:
  mov    %rax,-0x10(%rbp)
  jmp    L122
L195:
  cmpl   $0x0,-0x20(%rbp)
  je     L122
  cmpl   $0x0,-0x24(%rbp)
  je     L54
  negq   -0x10(%rbp)
  jmp    L122
L98:
  nop
  jmp    L122
L54:
  nop
L122:
  cmpq   $0x0,-0x40(%rbp)
  je     L27
  cmpl   $0x0,-0x20(%rbp)
  je     L445
  mov    -0x18(%rbp),%rax
  sub    $0x1,%rax
  jmp    L267
L445:
  mov    -0x38(%rbp),%rax
L267:
  mov    -0x40(%rbp),%rdx
  mov    %rax,(%rdx)
L27:
  mov    -0x10(%rbp),%rax
  leave
  ret
```

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);
}
```