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

```asm
<strtoll>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  movl   $0x0,-0x20(%rbp)
  lea    D9(%rip),%rax
  mov    %rax,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  je     L44
  cmpl   $0x1,-0x34(%rbp)
  jle    L140
  cmpl   $0x24,-0x34(%rbp)
  jle    L44
L140:
  mov    $0x0,%eax
  jmp    L114
L49:
  addq   $0x1,-0x28(%rbp)
L44:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L178
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L49
L178:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L26
  movl   $0x1,-0x20(%rbp)
  addq   $0x1,-0x28(%rbp)
  jmp    L146
L26:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L146
  addq   $0x1,-0x28(%rbp)
L146:
  cmpl   $0x0,-0x34(%rbp)
  je     L88
  cmpl   $0x10,-0x34(%rbp)
  jne    L66
L88:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L66
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  jne    L66
  movl   $0x10,-0x34(%rbp)
  addq   $0x2,-0x28(%rbp)
L66:
  cmpl   $0x0,-0x34(%rbp)
  jne    L149
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L149
  movl   $0x8,-0x34(%rbp)
L149:
  cmpl   $0x0,-0x34(%rbp)
  jne    L150
  movl   $0xa,-0x34(%rbp)
  jmp    L150
L177:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %eax,%ecx
  mov    -0x34(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L4
  mov    -0x34(%rbp),%eax
  cltq
  imul   -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  addq   $0x1,-0x28(%rbp)
L150:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jne    L177
  jmp    L128
L4:
  nop
L128:
  cmpq   $0x0,-0x30(%rbp)
  je     L16
  mov    -0x30(%rbp),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,(%rax)
L16:
  cmpl   $0x0,-0x20(%rbp)
  je     L215
  mov    -0x18(%rbp),%rax
  neg    %rax
  jmp    L114
L215:
  mov    -0x18(%rbp),%rax
L114:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D9
datatype: string

tool: D9: 0123456789abcdefghijklmnopqrstuvwxyz

assistant: ```c
long long strtoll(const char *str, char **endptr, int base) {
  int c, neg = 0;
  const char *alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
  long long val = 0;
  if (base != 0 && (base < 2 || base > 36))
    return 0;
  while (*str && isspace(*str))
    str++;
  if (*str == '-') {
    neg = 1;
    str++;
  } else if (*str == '+') {
    str++;
  }
  if (base == 0 || base == 16) {
    if (str[0] == '0' && str[1] == 'x') {
      base = 16;
      str += 2;
    }
  }
  if (base == 0) {
    if (str[0] == '0')
      base = 8;
  }
  if (base == 0)
    base = 10;
  while ((c = *str)) {
    const char *idx = (const char *)memchr(alphabet, tolower(c), base);
    if (idx == 0)
      break;
    val = val * base + (idx - alphabet);
    str++;
  }
  if (endptr)
    *endptr = (char *)str;
  if (neg)
    return -val;
  else
    return val;
}
```