user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %edx,%ebp
  mov    %rdi,%rbx
  jmp    L156
L132:
  add    $0x1,%rbx
L156:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L132
  movzbl (%rbx),%eax
  cmp    $0x2d,%al
  je     L216
  mov    $0x0,%r14d
  cmp    $0x2b,%al
  je     L276
L238:
  cmp    $0x10,%ebp
  je     L80
  test   %ebp,%ebp
  jne    L41
  mov    $0xa,%ebp
  cmpb   $0x30,(%rbx)
  je     L62
L45:
  movzbl (%rbx),%edx
  mov    %rbx,%rcx
  mov    $0x0,%esi
  test   %dl,%dl
  je     L109
L100:
  mov    D1(%rip),%rax
  mov    (%rax),%r8d
  sar    $0x8,%r8d
  movslq %r8d,%r8
  mov    $0x0,%eax
  mov    $0x0,%esi
  mov    $0xffffffff,%r10d
  movslq %ebp,%rdi
  mov    $0x1,%r9d
  jmp    L40
L216:
  add    $0x1,%rbx
  mov    $0x1,%r14d
  jmp    L238
L276:
  add    $0x1,%rbx
  jmp    L238
L80:
  cmpb   $0x30,(%rbx)
  jne    L45
  jmp    L5
L41:
  lea    -0x2(%rbp),%eax
  cmp    $0x22,%eax
  jbe    L45
  mov    D79(%rip),%rax
  mov    (%rax),%edx
  mov    D17(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L260
L163:
  movsbl 0x2(%rbx),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L45
  lea    0x2(%rbx),%rcx
  movzbl 0x2(%rbx),%edx
  test   %dl,%dl
  je     L14
  mov    $0x10,%ebp
  jmp    L100
L30:
  lea    -0x30(%r15),%r11d
L286:
  movzbl %r11b,%edx
  cmp    %ebp,%edx
  jge    L63
  movzbl %al,%edx
  imul   %rdi,%rdx
  movzbl %r11b,%r11d
  add    %r11,%rdx
  shr    $0x8,%rax
  imul   %rdi,%rax
  mov    %rdx,%r11
  shr    $0x8,%r11
  add    %r11,%rax
  cmp    %rax,%r8
  cmovb  %r9d,%esi
  shl    $0x8,%rax
  movzbl %dl,%edx
  add    %rdx,%rax
  add    $0x1,%rcx
  movzbl (%rcx),%edx
  test   %dl,%dl
  je     L63
L40:
  mov    %edx,%r15d
  cmp    $0x40,%dl
  ja     L30
  mov    %r10d,%r11d
  cmp    $0x39,%dl
  ja     L286
  jmp    L30
L14:
  mov    $0x0,%eax
  mov    $0x0,%esi
L63:
  cmp    %rcx,%rbx
  je     L109
L133:
  test   %r12,%r12
  je     L203
  mov    %rcx,(%r12)
L203:
  test   %esi,%esi
  jne    L210
  mov    %rax,%rdx
  neg    %rdx
  test   %r14d,%r14d
  cmovne %rdx,%rax
L260:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L109:
  mov    D79(%rip),%rax
  mov    (%rax),%edx
  mov    D17(%rip),%rax
  mov    %edx,(%rax)
  mov    %r13,%rcx
  mov    $0x0,%eax
  jmp    L133
L210:
  mov    D40(%rip),%rax
  mov    (%rax),%edx
  mov    D17(%rip),%rax
  mov    %edx,(%rax)
  mov    D1(%rip),%rax
  movslq (%rax),%rax
  jmp    L260
L62:
  mov    $0x8,%ebp
L5:
  movzbl 0x1(%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L163
  movzbl (%rbx),%edx
  mov    %rbx,%rcx
  jmp    L100
```

assistant: ```c
unsigned long int strtoul(const char *ptr, char **endptr, int base) {
  int neg = 0, overflow = 0;
  unsigned long int v = 0;
  const char *orig;
  const char *nptr = ptr;
  while (isspace(*nptr))
    ++nptr;
  if (*nptr == '-') {
    neg = 1;
    nptr++;
  } else if (*nptr == '+')
    ++nptr;
  orig = nptr;
  if (base == 16 && nptr[0] == '0')
    goto skip0x;
  if (base) {
    register unsigned int b = base - 2;
    if (b > 34) {
      errno = EINVAL;
      return 0;
    }
  } else {
    if (*nptr == '0') {
      base = 8;
    skip0x:
      if ((nptr[1] == 'x' || nptr[1] == 'X') && isxdigit(nptr[2])) {
        nptr += 2;
        base = 16;
      }
    } else
      base = 10;
  }
  while (*nptr) {
    register unsigned char c = *nptr;
    c = (((c >= 'a' ? (c - 'a' + 10) : (c >= 'A')) ? (c - 'A' + 10) : (c <= '9')) ? (c - '0') : 0xff);
    if (c >= base)
      break;
    {
      register unsigned long x = (v & 0xff) * base + c;
      register unsigned long w = (v >> 8) * base + (x >> 8);
      if (w > (ULONG_MAX >> 8))
        overflow = 1;
      v = (w << 8) + (x & 0xff);
    }
    ++nptr;
  }
  if (nptr == orig) {
    nptr = ptr;
    errno = EINVAL;
    v = 0;
  }
  if (endptr)
    *endptr = (char *)nptr;
  if (overflow) {
    errno = ERANGE;
    return ULONG_MAX;
  }
  return (neg ? -v : v);
}
```