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

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x8(%rsp)
  mov    %edx,%r14d
  mov    %rdi,%rbp
L41:
  mov    %rbp,%r12
  add    $0x1,%rbp
  movzbl -0x1(%rbp),%ebx
  mov    %ebx,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L41
  cmp    $0x2d,%ebx
  je     L86
  movl   $0x0,0x14(%rsp)
  cmp    $0x2b,%ebx
  je     L250
L165:
  test   $0xffffffef,%r14d
  jne    L121
  cmp    $0x30,%ebx
  je     L54
L121:
  test   %r14d,%r14d
  jne    L191
  cmp    $0x30,%ebx
  setne  %r14b
  movzbl %r14b,%r14d
  lea    0x8(%r14,%r14,1),%r14d
L191:
  mov    D10(%rip),%rax
  mov    (%rax),%rax
  movslq %r14d,%rcx
  mov    %rcx,(%rsp)
  mov    $0x0,%edx
  div    %rcx
  mov    %rax,%r15
  mov    %edx,0x10(%rsp)
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  jmp    L238
L86:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  movl   $0x1,0x14(%rsp)
  jmp    L165
L250:
  movsbl 0x0(%rbp),%ebx
  lea    0x2(%r12),%rbp
  jmp    L165
L54:
  movzbl 0x0(%rbp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L211
  movsbl 0x1(%rbp),%ebx
  add    $0x2,%rbp
  mov    $0x10,%r14d
  jmp    L191
L211:
  mov    $0x30,%ebx
  jmp    L121
L196:
  mov    %ebx,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L263
  mov    %ebx,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ebx
  jmp    L149
L1:
  mov    D10(%rip),%rax
  mov    (%rax),%r12
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%r13d
L184:
  add    $0x1,%rbp
  movzbl -0x1(%rbp),%ebx
L238:
  mov    %ebx,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L196
  sub    $0x30,%ebx
L149:
  cmp    %ebx,%r14d
  jle    L263
  test   %r13d,%r13d
  js     L184
  cmp    %r15,%r12
  ja     L1
  jne    L242
  cmp    0x10(%rsp),%ebx
  jg     L1
L242:
  imul   (%rsp),%r12
  movslq %ebx,%rbx
  add    %rbx,%r12
  mov    $0x1,%r13d
  jmp    L184
L263:
  cmpl   $0x0,0x14(%rsp)
  je     L96
  test   %r13d,%r13d
  jle    L96
  neg    %r12
  cmpq   $0x0,0x8(%rsp)
  je     L60
L189:
  lea    -0x1(%rbp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L106
L96:
  cmpq   $0x0,0x8(%rsp)
  je     L60
  test   %r13d,%r13d
  jne    L189
L106:
  mov    0x8(%rsp),%rax
  mov    0x18(%rsp),%rsi
  mov    %rsi,(%rax)
L60:
  mov    %r12,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned long strtoul(const char *nptr, char **endptr, int base) {
  const char *s;
  unsigned long acc, cutoff;
  int c;
  int neg, any, cutlim;
  s = nptr;
  do {
    c = (unsigned char)*s++;
  } while (isspace(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')) {
    c = s[1];
    s += 2;
    base = 16;
  }
  if (base == 0)
    base = c == '0' ? 8 : 10;
  cutoff = ULONG_MAX / (unsigned long)base;
  cutlim = ULONG_MAX % (unsigned long)base;
  for (acc = 0, any = 0;; c = (unsigned char)*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)
      continue;
    if (acc > cutoff || (acc == cutoff && c > cutlim)) {
      any = -1;
      acc = ULONG_MAX;
      errno = ERANGE;
    } else {
      any = 1;
      acc *= (unsigned long)base;
      acc += c;
    }
  }
  if (neg && any > 0)
    acc = -acc;
  if (endptr != 0)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```