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     L39
  mov    %edx,%ebx
  mov    %rdi,%r15
  cmp    $0x24,%edx
  ja     L39
  nopl   0x0(%rax,%rax,1)
L348:
  mov    %r15,%rbp
  movzbl (%r15),%r14d
  add    $0x1,%r15
  mov    %r14d,%edi
  call   <isspace@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L348
  cmp    $0x2d,%r14d
  je     L329
  movl   $0x0,0x18(%rsp)
  cmp    $0x2b,%r14d
  je     L118
L394:
  test   $0xffffffef,%ebx
  jne    L191
  cmp    $0x30,%r14d
  je     L205
  test   %ebx,%ebx
  jne    L191
  movq   $0xa,0x10(%rsp)
  mov    $0xa,%ebx
  jmp    L132
  nopl   (%rax)
L39:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L384
  mov    %r13,(%rax)
L384:
  mov    D94(%rip),%rax
  xor    %r12d,%r12d
  mov    (%rax),%edx
  mov    D32(%rip),%rax
  mov    %edx,(%rax)
L26:
  add    $0x28,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L191:
  movslq %ebx,%rax
  mov    %rax,0x10(%rsp)
L132:
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  je     L181
  mov    D66(%rip),%rax
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,%edi
  test   %rdx,%rdx
  jle    L393
  addq   $0x1,0x8(%rsp)
  sub    %ebx,%edi
L393:
  neg    %edi
  xor    %ebp,%ebp
  mov    %edi,0x1c(%rsp)
  jmp    L221
  nopl   0x0(%rax,%rax,1)
L385:
  cmp    %ecx,%ebx
  jle    L325
L193:
  cmp    $0xffffffff,%ebp
  je     L268
  cmp    0x8(%rsp),%r12
  jl     L222
  jne    L332
  cmp    0x1c(%rsp),%ecx
  jle    L332
L222:
  mov    D66(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D32(%rip),%rax
  mov    %edx,(%rax)
L268:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L221:
  mov    %r14d,%edi
  call   <isdigit@plt>
  lea    -0x30(%r14),%ecx
  test   %rax,%rax
  jne    L385
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L325
  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     L193
  nopl   0x0(%rax,%rax,1)
L325:
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L26
  lea    -0x1(%r15),%rsi
  test   %ebp,%ebp
  cmovne %rsi,%r13
  mov    %r13,(%rax)
  jmp    L26
  nop
L332:
  imul   0x10(%rsp),%r12
  movslq %ecx,%rcx
  mov    0x18(%rsp),%ebp
  sub    %rcx,%r12
  jmp    L268
  nopl   (%rax)
L181:
  mov    D77(%rip),%rax
  xor    %ebp,%ebp
  mov    (%rax),%rax
  cqto
  idivq  0x10(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %edx,0x18(%rsp)
  jmp    L291
  cs nopw 0x0(%rax,%rax,1)
L219:
  cmp    %ebx,%eax
  jge    L325
  cmp    $0xffffffff,%ebp
  je     L298
  cmp    0x8(%rsp),%r12
  jg     L89
  cmp    0x18(%rsp),%eax
  jle    L99
  cmp    0x8(%rsp),%r12
  jne    L99
L89:
  mov    D77(%rip),%rax
  mov    $0xffffffff,%ebp
  mov    (%rax),%r12
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D32(%rip),%rax
  mov    %edx,(%rax)
L298:
  movzbl (%r15),%r14d
  add    $0x1,%r15
L291:
  mov    %r14d,%edi
  call   <isdigit@plt>
  mov    %rax,%r8
  lea    -0x30(%r14),%eax
  test   %r8,%r8
  jne    L219
  mov    %r14d,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  je     L325
  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    L219
  nopl   0x0(%rax)
L99:
  imul   0x10(%rsp),%r12
  cltq
  mov    $0x1,%ebp
  add    %rax,%r12
  jmp    L298
  nopw   0x0(%rax,%rax,1)
L118:
  movsbl (%r15),%r14d
  lea    0x2(%rbp),%r15
  jmp    L394
  nopl   (%rax)
L205:
  movzbl (%r15),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L108
  test   %ebx,%ebx
  jne    L191
  movq   $0x8,0x10(%rsp)
  mov    $0x8,%ebx
  jmp    L132
  xchg   %ax,%ax
L329:
  movsbl (%r15),%r14d
  movl   $0x1,0x18(%rsp)
  lea    0x2(%rbp),%r15
  jmp    L394
L108:
  movsbl 0x1(%r15),%r14d
  mov    $0x10,%ebx
  add    $0x2,%r15
  movq   $0x10,0x10(%rsp)
  jmp    L132
```

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);
}
```