user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strtoll>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,(%rsp)
  cmp    $0x1,%edx
  je     L322
  mov    %edx,%ebx
  mov    %rdi,%r15
  cmp    $0x24,%edx
  ja     L322
  nopl   0x0(%rax,%rax,1)
L334:
  mov    %r15,%rbp
  movzbl (%r15),%r14d
  add    $0x1,%r15
  mov    %r14d,%edi
  call   <isspace@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L334
  cmp    $0x2d,%r14d
  je     L229
  movl   $0x0,0x18(%rsp)
  cmp    $0x2b,%r14d
  je     L341
L8:
  test   $0xffffffef,%ebx
  jne    L252
  cmp    $0x30,%r14d
  je     L53
  test   %ebx,%ebx
  jne    L252
  movq   $0xa,0x10(%rsp)
  mov    $0xa,%ebx
  jmp    L290
  nopl   (%rax)
L322:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L137
  mov    %r13,(%rax)
L137:
  mov    D69(%rip),%rax
  xor    %r12d,%r12d
  mov    (%rax),%edx
  mov    D85(%rip),%rax
  mov    %edx,(%rax)
L264:
  add    $0x28,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L252:
  movslq %ebx,%rax
  mov    %rax,0x10(%rsp)
L290:
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  je     L213
  mov    D23(%rip),%rax
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,%edi
  test   %rdx,%rdx
  jle    L197
  addq   $0x1,0x8(%rsp)
  sub    %ebx,%edi
L197:
  neg    %edi
  xor    %ebp,%ebp
  mov    %edi,0x1c(%rsp)
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L149:
  cmp    %ecx,%ebx
  jle    L47
L206:
  cmp    $0xffffffff,%ebp
  je     L106
  cmp    0x8(%rsp),%r12
  jl     L31
  jne    L396
  cmp    0x1c(%rsp),%ecx
  jle    L396
L31:
  mov    D23(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    D85(%rip),%rax
  mov    %edx,(%rax)
L106:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L22:
  mov    %r14d,%edi
  call   <isdigit@plt>
  lea    -0x30(%r14),%ecx
  test   %rax,%rax
  jne    L149
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L47
  mov    %r14d,%edi
  call   <isupper@plt>
  mov    %r14d,%ecx
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0x20,%eax
  add    $0x37,%eax
  sub    %eax,%ecx
  cmp    %ecx,%ebx
  jg     L206
  nopl   0x0(%rax,%rax,1)
L47:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L264
  lea    -0x1(%r15),%rsi
  test   %ebp,%ebp
  cmovne %rsi,%r13
  mov    %r13,(%rax)
  jmp    L264
  nop
L396:
  imul   0x10(%rsp),%r12
  movslq %ecx,%rcx
  mov    0x18(%rsp),%ebp
  sub    %rcx,%r12
  jmp    L106
  nopl   (%rax)
L213:
  mov    D16(%rip),%rax
  xor    %ebp,%ebp
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,0x18(%rsp)
  jmp    L253
  cs nopw 0x0(%rax,%rax,1)
L258:
  cmp    %ebx,%eax
  jge    L47
  cmp    $0xffffffff,%ebp
  je     L174
  cmp    0x8(%rsp),%r12
  jg     L234
  cmp    0x18(%rsp),%eax
  jle    L18
  cmp    0x8(%rsp),%r12
  jne    L18
L234:
  mov    D16(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    D85(%rip),%rax
  mov    %edx,(%rax)
L174:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L253:
  mov    %r14d,%edi
  call   <isdigit@plt>
  mov    %rax,%r8
  lea    -0x30(%r14),%eax
  test   %r8,%r8
  jne    L258
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L47
  mov    %r14d,%edi
  call   <isupper@plt>
  cmp    $0x1,%rax
  mov    %r14d,%eax
  sbb    %edx,%edx
  and    $0x20,%edx
  add    $0x37,%edx
  sub    %edx,%eax
  jmp    L258
  nopl   0x0(%rax)
L18:
  imul   0x10(%rsp),%r12
  cltq
  mov    $0x1,%ebp
  add    %rax,%r12
  jmp    L174
  nopw   0x0(%rax,%rax,1)
L341:
  movsbl (%r15),%r14d
  lea    0x2(%rbp),%r15
  jmp    L8
  nopl   (%rax)
L53:
  movzbl (%r15),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L395
  test   %ebx,%ebx
  jne    L252
  movq   $0x8,0x10(%rsp)
  mov    $0x8,%ebx
  jmp    L290
  xchg   %ax,%ax
L229:
  movsbl (%r15),%r14d
  movl   $0x1,0x18(%rsp)
  lea    0x2(%rbp),%r15
  jmp    L8
L395:
  movsbl 0x1(%r15),%r14d
  mov    $0x10,%ebx
  add    $0x2,%r15
  movq   $0x10,0x10(%rsp)
  jmp    L290
```

assistant: ```c
long long strtoll(const char *nptr, char **endptr, int base) {
  const char *s;
  long long acc, cutoff;
  int c;
  int neg, any, cutlim;
  if (base < 0 || base == 1 || base > 36) {
    if (endptr != 0)
      *endptr = (char *)nptr;
    errno = EINVAL;
    return 0;
  }
  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 = neg ? LLONG_MIN : LLONG_MAX;
  cutlim = cutoff % base;
  cutoff /= base;
  if (neg) {
    if (cutlim > 0) {
      cutlim -= base;
      cutoff += 1;
    }
    cutlim = -cutlim;
  }
  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 (neg) {
      if (acc < cutoff || (acc == cutoff && c > cutlim)) {
        any = -1;
        acc = LLONG_MIN;
        errno = ERANGE;
      } else {
        any = 1;
        acc *= base;
        acc -= c;
      }
    } else {
      if (acc > cutoff || (acc == cutoff && c > cutlim)) {
        any = -1;
        acc = LLONG_MAX;
        errno = ERANGE;
      } else {
        any = 1;
        acc *= base;
        acc += c;
      }
    }
  }
  if (endptr != 0)
    *endptr = (char *)(any ? s - 1 : nptr);
  return (acc);
}
```