user: Demonstrate the C code that generates the assembly output below:

```asm
<strtol>:
  endbr64
  push   %r12
  mov    %edx,%r9d
  mov    %rdi,%rcx
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
L178:
  movzbl (%rcx),%eax
  cmp    $0xd,%al
  jg     L16
  cmp    $0x8,%al
  jg     L179
L2:
  lea    -0x2b(%rax),%edx
  xor    %r12d,%r12d
  and    $0xfd,%edx
  jne    L101
  xor    %r12d,%r12d
  add    $0x1,%rcx
  cmp    $0x2d,%al
  sete   %r12b
L101:
  test   %r9d,%r9d
  jne    L42
  cmpb   $0x30,(%rcx)
  mov    $0xa,%r9d
  je     L127
L191:
  xor    %esi,%esi
  xor    %edi,%edi
  xor    %r8d,%r8d
  movslq %r9d,%r11
  mov    $0x1,%r10d
  jmp    L48
  nopl   0x0(%rax)
L171:
  lea    -0x57(%rdx),%eax
L100:
  cmp    %r9d,%eax
  jge    L119
  mov    %r11,%rdx
  cltq
  imul   %r8,%rdx
  add    %rdx,%rax
  cmp    %rax,%r8
  mov    %rax,%r8
  cmovg  %r10d,%edi
  add    $0x1,%rcx
  add    $0x1,%esi
L48:
  movsbl (%rcx),%edx
  lea    -0x30(%rdx),%eax
  cmp    $0x9,%eax
  jbe    L100
  lea    -0x61(%rdx),%eax
  cmp    $0x19,%eax
  jbe    L171
  lea    -0x41(%rdx),%eax
  cmp    $0x19,%eax
  ja     L119
  lea    -0x37(%rdx),%eax
  jmp    L100
  nopl   (%rax)
L16:
  cmp    $0x20,%al
  jne    L2
L179:
  add    $0x1,%rcx
  jmp    L178
  nopl   0x0(%rax)
L119:
  test   %esi,%esi
  cmove  %rbx,%rcx
  test   %rbp,%rbp
  je     L134
  mov    %rcx,0x0(%rbp)
L134:
  test   %edi,%edi
  je     L135
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D15(%rip),%rax
  mov    %edx,(%rax)
  test   %r12d,%r12d
  je     L35
  mov    D30(%rip),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  mov    (%rax),%r8
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L42:
  cmp    $0x10,%r9d
  je     L22
  cmp    $0x24,%r9d
  jbe    L191
  xor    %r8d,%r8d
  test   %rbp,%rbp
  je     L135
  mov    %rbx,0x0(%rbp)
L135:
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  neg    %rax
  test   %r12d,%r12d
  pop    %r12
  cmovne %rax,%r8
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L35:
  mov    D38(%rip),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  mov    (%rax),%r8
  mov    %r8,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L127:
  movzbl 0x1(%rcx),%eax
  mov    $0x8,%r9d
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L191
  add    $0x2,%rcx
  mov    $0x10,%r9d
  jmp    L191
  nopl   0x0(%rax)
L22:
  cmpb   $0x30,(%rcx)
  jne    L191
  movzbl 0x1(%rcx),%eax
  lea    0x2(%rcx),%rdx
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  cmove  %rdx,%rcx
  jmp    L191
```

assistant: ```c
long strtol(const char *nptr, char **endptr, int base) {
  const char *p;
  long n, nn;
  int c, ovfl, v, neg, ndig;
  p = nptr;
  neg = 0;
  n = 0;
  ndig = 0;
  ovfl = 0;
  for (;; p++) {
    switch (*p) {
    case ' ':
    case '\t':
    case '\n':
    case '\f':
    case '\r':
    case '\v':
      continue;
    }
    break;
  }
  if (*p == '-' || *p == '+')
    if (*p++ == '-')
      neg = 1;
  if (base == 0) {
    if (*p != '0')
      base = 10;
    else {
      base = 8;
      if (p[1] == 'x' || p[1] == 'X') {
        p += 2;
        base = 16;
      }
    }
  } else if (base == 16 && *p == '0') {
    if (p[1] == 'x' || p[1] == 'X')
      p += 2;
  } else if (base < 0 || 36 < base)
    goto Return;
  for (;; p++, ndig++) {
    c = *p;
    v = base;
    if ('0' <= c && c <= '9')
      v = c - '0';
    else if ('a' <= c && c <= 'z')
      v = c - 'a' + 10;
    else if ('A' <= c && c <= 'Z')
      v = c - 'A' + 10;
    if (v >= base)
      break;
    nn = n * base + v;
    if (nn < n)
      ovfl = 1;
    n = nn;
  }
Return:
  if (ndig == 0)
    p = nptr;
  if (endptr)
    *endptr = (char *)p;
  if (ovfl) {
    errno = ERANGE;
    if (neg)
      return LONG_MIN;
    return LONG_MAX;
  }
  if (neg)
    return -n;
  return n;
}
```