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

```asm
<strtol>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x1,-0x8(%rbp)
  nop
L272:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L272
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L166
  movq   $0xffffffffffffffff,-0x8(%rbp)
  addq   $0x1,-0x18(%rbp)
  jmp    L157
L166:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L157
  addq   $0x1,-0x18(%rbp)
L157:
  cmpl   $0x0,-0x24(%rbp)
  je     L121
  cmpl   $0x10,-0x24(%rbp)
  jne    L177
L121:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L177
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  jne    L177
  addq   $0x2,-0x18(%rbp)
  movl   $0x10,-0x24(%rbp)
  jmp    L26
L177:
  cmpl   $0x0,-0x24(%rbp)
  je     L141
  cmpl   $0x8,-0x24(%rbp)
  jne    L2
L141:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L2
  addq   $0x1,-0x18(%rbp)
  movl   $0x8,-0x24(%rbp)
  jmp    L26
L2:
  cmpl   $0x0,-0x24(%rbp)
  jne    L26
  movl   $0xa,-0x24(%rbp)
L26:
  cmpl   $0x1,-0x24(%rbp)
  jle    L40
  cmpl   $0x24,-0x24(%rbp)
  jle    L170
L40:
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  imul   -0x10(%rbp),%rax
  jmp    L9
L183:
  mov    -0x24(%rbp),%eax
  cltq
  mov    -0x10(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L201
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L201
  mov    -0x24(%rbp),%eax
  lea    0x2f(%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    %eax,%edx
  jl     L201
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  add    %rax,-0x10(%rbp)
  jmp    L127
L201:
  cmpl   $0xa,-0x24(%rbp)
  jle    L217
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L217
  mov    -0x24(%rbp),%eax
  lea    0x56(%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    %eax,%edx
  jl     L217
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  cltq
  add    %rax,-0x10(%rbp)
  jmp    L127
L217:
  cmpl   $0xa,-0x24(%rbp)
  jle    L176
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L176
  mov    -0x24(%rbp),%eax
  lea    0x36(%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    %eax,%edx
  jl     L176
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  add    %rax,-0x10(%rbp)
L127:
  addq   $0x1,-0x18(%rbp)
L170:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L183
L176:
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  imul   -0x10(%rbp),%rax
L9:
  pop    %rbp
  ret
```

assistant: ```c
long int strtol(const char *nptr, char **endptr, int base) {
  long int n = 0;
  long int sign = 1;
  while (*nptr == ' ')
    ;
  if (*nptr == '-') {
    sign = -1;
    nptr++;
  } else if (*nptr == '+') {
    nptr++;
  }
  if ((base == 0 || base == 16) && nptr[0] == '0' && nptr[1] == 'x') {
    nptr += 2;
    base = 16;
  } else if ((base == 0 || base == 8) && nptr[0] == '0') {
    nptr++;
    base = 8;
  } else if (base == 0) {
    base = 10;
  }
  if (base < 2 || base > 36) {
    *endptr = (char *)nptr;
    return sign * n;
  }
  while (*nptr != '\0') {
    n *= base;
    if (*nptr >= '0' && *nptr <= '9' && *nptr < ('0' + base)) {
      n += *nptr - '0';
    } else if (base > 10 && *nptr >= 'a' && *nptr < ('a' + (base - 10))) {
      n += *nptr - 'a' + 10;
    } else if (base > 10 && *nptr >= 'A' && *nptr < ('A' + (base - 10))) {
      n += *nptr - 'A' + 10;
    } else {
      break;
    }
    nptr++;
  }
  *endptr = (char *)nptr;
  return sign * n;
}
```