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

```asm
<strtoull>:
  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
L246:
  mov    %rbx,%r15
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
  movzbl %bpl,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L246
  cmp    $0x2d,%bpl
  je     L184
  movl   $0x0,0xc(%rsp)
  cmp    $0x2b,%bpl
  je     L219
L58:
  test   $0xffffffef,%r12d
  jne    L98
  cmp    $0x30,%bpl
  je     L183
L98:
  test   %r12d,%r12d
  jne    L194
  cmp    $0x30,%bpl
  setne  %r12b
  movzbl %r12b,%r12d
  lea    0x8(%r12,%r12,1),%r12d
L176:
  mov    D4(%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    L65
L184:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  movl   $0x1,0xc(%rsp)
  jmp    L58
L219:
  movzbl (%rbx),%ebp
  lea    0x2(%r15),%rbx
  jmp    L58
L183:
  movzbl (%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L224
  movzbl 0x1(%rbx),%ebp
  add    $0x2,%rbx
  mov    $0x10,%r12d
  jmp    L176
L194:
  lea    -0x2(%r12),%eax
  cmp    $0x22,%eax
  jbe    L176
L167:
  mov    $0x0,%eax
  test   %r14,%r14
  jne    L99
  jmp    L186
L245:
  mov    %r9d,%esi
L95:
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%ebp
L65:
  mov    %ebp,%edi
  lea    -0x30(%rbp),%ecx
  cmp    $0x9,%cl
  jbe    L230
  sub    $0x41,%ebp
  lea    -0x37(%rdi),%ecx
  cmp    $0x19,%bpl
  jbe    L230
  lea    -0x61(%rdi),%ecx
  cmp    $0x19,%cl
  ja     L22
  lea    -0x57(%rdi),%ecx
L230:
  movsbl %cl,%edi
  cmp    %r12d,%edi
  jge    L22
  test   %esi,%esi
  js     L245
  cmp    %r8,%rax
  ja     L245
  cmp    %edx,%edi
  jle    L152
  mov    %r9d,%esi
  cmp    %r8,%rax
  je     L95
L152:
  imul   %r15,%rax
  movsbq %cl,%rcx
  add    %rcx,%rax
  mov    %r11d,%esi
  jmp    L95
L22:
  test   %esi,%esi
  js     L251
  je     L167
  mov    %rax,%rdx
  neg    %rdx
  cmpl   $0x0,0xc(%rsp)
  cmovne %rdx,%rax
  jmp    L215
L251:
  movslq %r10d,%rax
L215:
  lea    -0x1(%rbx),%r13
  test   %r14,%r14
  je     L186
L99:
  mov    %r13,(%r14)
L186:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L224:
  mov    $0x30,%ebp
  test   %r12d,%r12d
  jne    L194
  mov    $0x30,%ebp
  mov    $0x8,%r12d
  jmp    L176
```

assistant: ```c
unsigned long long strtoull(const char *__restrict nptr, char **__restrict endptr, int base) {
  const char *s;
  unsigned long long acc;
  char c;
  unsigned long 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')) {
    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 = ULLONG_MAX / base;
  cutlim = ULLONG_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 = ULLONG_MAX;
  } else if (!any) {
  noconv:
    acc = 0;
  } else if (neg)
    acc = -acc;
  if (endptr != NULL)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```