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

```asm
<strntoumax>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  lea    (%rdi,%rcx,1),%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  cmp    %rbp,%rdi
  jb     L114
  jmp    L237
  nopl   0x0(%rax)
L158:
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  je     L237
L114:
  movzbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L158
  cmp    %rbx,%rbp
  jbe    L237
  movzbl (%rbx),%eax
  xor    %r14d,%r14d
  lea    -0x2b(%rax),%edx
  and    $0xfd,%edx
  je     L22
L191:
  test   %r12d,%r12d
  jne    L144
L30:
  lea    0x2(%rbx),%rax
  cmp    %rbp,%rax
  jae    L32
  cmpb   $0x30,(%rbx)
  mov    $0xa,%r12d
  je     L23
  nopl   (%rax)
L283:
  cmp    %rbp,%rbx
  jae    L108
L104:
  xor    %r15d,%r15d
  jmp    L164
  xchg   %ax,%ax
L247:
  cmp    %eax,%r12d
  jle    L238
  imul   %r12d,%r15d
  add    $0x1,%rbx
  add    %eax,%r15d
  cmp    %rbx,%rbp
  jbe    L238
L164:
  movzbl (%rbx),%edi
  call   <digitval@plt>
  test   %eax,%eax
  jns    L247
L238:
  test   %r13,%r13
  je     L58
  mov    %rbx,0x0(%r13)
L58:
  mov    %r15d,%eax
  neg    %eax
  test   %r14d,%r14d
  cmovne %eax,%r15d
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  mov    %r15d,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L237:
  xor    %r14d,%r14d
  test   %r12d,%r12d
  je     L30
L144:
  cmp    $0x10,%r12d
  jne    L283
  lea    0x2(%rbx),%rax
  cmp    %rbp,%rax
  jae    L283
  cmpb   $0x30,(%rbx)
  jne    L283
  movzbl 0x1(%rbx),%edx
  and    $0xffffffdf,%edx
  cmp    $0x58,%dl
  jne    L283
  mov    %rax,%rbx
  jmp    L104
  nopl   0x0(%rax,%rax,1)
L32:
  lea    0x1(%rbx),%rax
  cmp    %rbp,%rax
  jae    L279
  cmpb   $0x30,(%rbx)
  jne    L279
L134:
  mov    %rax,%rbx
  mov    $0x8,%r12d
  jmp    L104
  nopl   0x0(%rax)
L22:
  xor    %r14d,%r14d
  cmp    $0x2d,%al
  sete   %r14b
  add    $0x1,%rbx
  jmp    L191
  nopw   0x0(%rax,%rax,1)
L279:
  mov    $0xa,%r12d
  jmp    L283
L23:
  movzbl 0x1(%rbx),%edx
  and    $0xffffffdf,%edx
  cmp    $0x58,%dl
  jne    L50
  mov    %rax,%rbx
  mov    $0x10,%r12d
  jmp    L104
L50:
  lea    0x1(%rbx),%rax
  cmp    %rax,%rbp
  jbe    L283
  jmp    L134
L108:
  xor    %r15d,%r15d
  jmp    L238
```

assistant: ```c
uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) {
  const unsigned char *p = (const unsigned char *)nptr;
  const unsigned char *end = p + n;
  int minus = 0;
  uintmax_t v = 0;
  int d;
  while (p < end && isspace(*p))
    p++;
  if (p < end) {
    char c = p[0];
    if (c == '-' || c == '+') {
      minus = (c == '-');
      p++;
    }
  }
  if (base == 0) {
    if (p + 2 < end && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
      p += 2;
      base = 16;
    } else if (p + 1 < end && p[0] == '0') {
      p += 1;
      base = 8;
    } else {
      base = 10;
    }
  } else if (base == 16) {
    if (p + 2 < end && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
      p += 2;
    }
  }
  while (p < end && (d = digitval(*p)) >= 0 && d < base) {
    v = v * base + d;
    p += 1;
  }
  if (endptr)
    *endptr = (char *)p;
  return minus ? -v : v;
}
```