user: Translate the below assembly code into C programming language:

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r14
  mov    %edx,%r12d
  mov    %rdi,%rbx
L282:
  mov    %rbx,%r15
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
  movzbl %bpl,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L282
  cmp    $0x2d,%bpl
  je     L300
  movl   $0x0,0xc(%rsp)
  cmp    $0x2b,%bpl
  je     L321
L274:
  test   $0xffffffef,%r12d
  jne    L146
  cmp    $0x30,%bpl
  je     L140
L146:
  test   %r12d,%r12d
  jne    L24
  cmp    $0x30,%bpl
  setne  %r12b
  movzbl %r12b,%r12d
  lea    0x8(%r12,%r12,1),%r12d
L272:
  mov    D1(%rip),%rax
  mov    (%rax),%r10d
  mov    %r10d,%eax
  cltd
  idiv   %r12d
  movslq %eax,%r8
  mov    $0x0,%esi
  mov    $0x0,%eax
  mov    $0xffffffff,%r9d
  movslq %r12d,%r15
  mov    $0x1,%r11d
  jmp    L2
L300:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  movl   $0x1,0xc(%rsp)
  jmp    L274
L321:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  jmp    L274
L140:
  movzbl (%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L150
  movzbl 0x1(%rbx),%ebp
  mov    %ebp,%eax
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L180
  lea    -0x30(%rbp),%eax
  cmp    $0x9,%al
  jbe    L180
L150:
  mov    $0x30,%ebp
  test   %r12d,%r12d
  jne    L24
  mov    $0x30,%ebp
  mov    $0x8,%r12d
  jmp    L272
L180:
  add    $0x2,%rbx
  mov    $0x10,%r12d
  jmp    L272
L24:
  lea    -0x2(%r12),%eax
  cmp    $0x22,%eax
  jbe    L272
  mov    $0x0,%eax
  test   %r14,%r14
  jne    L186
  jmp    L224
L239:
  mov    %r9d,%esi
L67:
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
L2:
  mov    %ebp,%edi
  lea    -0x30(%rbp),%ecx
  cmp    $0x9,%cl
  jbe    L212
  sub    $0x41,%ebp
  lea    -0x37(%rdi),%ecx
  cmp    $0x19,%bpl
  jbe    L212
  lea    -0x61(%rdi),%ecx
  cmp    $0x19,%cl
  ja     L178
  lea    -0x57(%rdi),%ecx
L212:
  movsbl %cl,%edi
  cmp    %r12d,%edi
  jge    L178
  test   %esi,%esi
  js     L239
  cmp    %r8,%rax
  ja     L239
  cmp    %edx,%edi
  jle    L115
  mov    %r9d,%esi
  cmp    %r8,%rax
  je     L67
L115:
  imul   %r15,%rax
  movsbq %cl,%rcx
  add    %rcx,%rax
  mov    %r11d,%esi
  jmp    L67
L178:
  test   %esi,%esi
  js     L231
  cmpl   $0x0,0xc(%rsp)
  je     L4
  test   %esi,%esi
  jne    L5
L4:
  test   %r14,%r14
  je     L224
  test   %esi,%esi
  je     L186
  jmp    L152
L231:
  movslq %r10d,%rax
L329:
  test   %r14,%r14
  je     L224
L152:
  lea    -0x1(%rbx),%r13
L186:
  mov    %r13,(%r14)
L224:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  neg    %rax
  jmp    L329
```

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;
  } else if (!any) {
  } else if (neg)
    acc = -acc;
noconv:
  if (endptr != NULL)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```