user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  nopl   (%rax)
L228:
  mov    %rbx,%r15
  movzbl (%rbx),%edi
  add    $0x1,%rbx
  mov    %edi,%r14d
  call   <isspace@plt>
  test   %rax,%rax
  jne    L228
  cmp    $0x2d,%r14b
  je     L179
  xor    %r8d,%r8d
  cmp    $0x2b,%r14b
  je     L121
L1:
  test   $0xffffffef,%ebp
  je     L350
L11:
  lea    -0x2(%rbp),%edx
  xor    %eax,%eax
  cmp    $0x22,%edx
  jbe    L83
L116:
  mov    D18(%rip),%rdx
  mov    (%rdx),%ecx
  mov    D9(%rip),%rdx
  mov    %ecx,(%rdx)
  test   %r13,%r13
  je     L97
L7:
  mov    %r12,0x0(%r13)
L97:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L350:
  cmp    $0x30,%r14b
  je     L46
  test   %ebp,%ebp
  jne    L11
  mov    $0xa,%ebp
L83:
  mov    D5(%rip),%rax
  xor    %r11d,%r11d
  movslq %ebp,%r10
  mov    (%rax),%r9d
  mov    %r9d,%eax
  cltd
  idiv   %ebp
  movslq %eax,%rdi
  xor    %eax,%eax
  jmp    L263
L243:
  lea    -0x37(%r14),%ecx
L181:
  movsbl %cl,%esi
  cmp    %ebp,%esi
  jge    L50
L88:
  test   %r11d,%r11d
  js     L109
  cmp    %rdi,%rax
  ja     L109
  cmp    %edx,%esi
  jle    L196
  mov    $0xffffffff,%r11d
  cmp    %rdi,%rax
  je     L111
L196:
  imul   %r10,%rax
  movsbq %cl,%rcx
  mov    $0x1,%r11d
  add    %rcx,%rax
L111:
  movzbl (%rbx),%r14d
  add    $0x1,%rbx
L263:
  lea    -0x30(%r14),%ecx
  cmp    $0x9,%cl
  jbe    L181
  lea    -0x41(%r14),%ecx
  cmp    $0x19,%cl
  jbe    L243
  lea    -0x61(%r14),%ecx
  cmp    $0x19,%cl
  ja     L50
  lea    -0x57(%r14),%ecx
  movsbl %cl,%esi
  cmp    %ebp,%esi
  jl     L88
  nopl   0x0(%rax,%rax,1)
L50:
  cmp    $0xffffffff,%r11d
  je     L348
  test   %r11d,%r11d
  je     L116
  test   %r8d,%r8d
  je     L23
  neg    %rax
  test   %r13,%r13
  je     L97
L26:
  lea    -0x1(%rbx),%r12
  jmp    L7
  nopl   (%rax)
L109:
  mov    $0xffffffff,%r11d
  jmp    L111
  nopl   0x0(%rax,%rax,1)
L348:
  mov    D10(%rip),%rdx
  movslq %r9d,%rax
  mov    (%rdx),%ecx
  mov    D9(%rip),%rdx
  mov    %ecx,(%rdx)
  test   %r13,%r13
  je     L97
  lea    -0x1(%rbx),%r12
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L121:
  movzbl (%rbx),%r14d
  lea    0x2(%r15),%rbx
  jmp    L1
  nopl   (%rax)
L179:
  movzbl (%rbx),%r14d
  mov    $0x1,%r8d
  lea    0x2(%r15),%rbx
  jmp    L1
  nopl   0x0(%rax,%rax,1)
L46:
  movzbl (%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L94
  movzbl 0x1(%rbx),%edx
  mov    %edx,%eax
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L67
  lea    -0x30(%rdx),%eax
  cmp    $0x9,%al
  jbe    L67
L94:
  test   %ebp,%ebp
  jne    L11
  mov    $0x8,%ebp
  jmp    L83
  nopl   0x0(%rax,%rax,1)
L23:
  test   %r13,%r13
  jne    L26
  jmp    L97
L67:
  add    $0x2,%rbx
  mov    %edx,%r14d
  mov    $0x10,%ebp
  jmp    L83
```

assistant: ```c
unsigned long strtoul(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 = ULONG_MAX / base;
  cutlim = ULONG_MAX % 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 = ULONG_MAX;
    errno = ERANGE;
  } else if (!any) {
  noconv:
    errno = EINVAL;
  } else if (neg)
    acc = -acc;
  if (endptr != NULL)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```