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

```asm
<stringToNumber>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  cmpb   $0x30,(%rdi)
  je     L152
L85:
  mov    %r14,%rbx
  xor    %ebp,%ebp
  jmp    L197
  nopl   0x0(%rax,%rax,1)
L97:
  add    $0x1,%ebp
L197:
  movsbl (%rbx),%edi
  mov    %rbx,%r15
  add    $0x1,%rbx
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L97
L7:
  movzbl 0x0(%r13),%eax
  movzbl (%r15),%edx
  test   %al,%al
  jne    L137
  jmp    L189
  cs nopw 0x0(%rax,%rax,1)
L64:
  movzbl 0x1(%r13),%eax
  add    $0x1,%r13
  test   %al,%al
  je     L189
L137:
  cmp    %dl,%al
  jne    L64
  cmpb   $0x30,(%r14)
  lea    0x1(%rbp),%r13d
  jne    L54
L170:
  movsbl 0x1(%r14),%edi
  call   <tolower@plt>
  cmp    $0x78,%al
  jne    L54
  cmp    $0xa,%ebp
  jg     L187
  cmp    $0x2,%ebp
  jg     L172
L41:
  xor    %ebx,%ebx
L190:
  mov    %ebx,(%r12)
  jmp    L67
  nop
L189:
  test   %dl,%dl
  jne    L187
  xor    %r13d,%r13d
  cmpb   $0x30,(%r14)
  je     L170
L54:
  lea    -0x1(%rbp),%eax
  test   %ebp,%ebp
  je     L41
  movslq %ebp,%rbp
  movslq %eax,%r15
  mov    %eax,%eax
  xor    %ebx,%ebx
  lea    -0x2(%r14,%rbp,1),%rbp
  add    %r14,%r15
  mov    $0x1,%r14d
  sub    %rax,%rbp
  jmp    L133
  nopl   0x0(%rax)
L71:
  movsbl (%r15),%eax
  sub    $0x30,%eax
  imul   %r14d,%eax
  add    %eax,%ebx
  jns    L187
  lea    (%r14,%r14,4),%r14d
  sub    $0x1,%r15
  add    %r14d,%r14d
  cmp    %r15,%rbp
  je     L190
L133:
  movsbl (%r15),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L71
L187:
  mov    $0xffffffff,%r13d
L67:
  add    $0x18,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L152:
  movsbl 0x1(%rdi),%edi
  call   <tolower@plt>
  cmp    $0x78,%al
  jne    L85
  mov    %r14d,%eax
  lea    0x2(%r14),%rbx
  neg    %eax
  mov    %eax,0xc(%rsp)
  xchg   %ax,%ax
L73:
  mov    0xc(%rsp),%eax
  movsbl (%rbx),%edi
  mov    %rbx,%r15
  lea    (%rax,%rbx,1),%ebp
  add    $0x1,%rbx
  call   <isxdigit@plt>
  test   %rax,%rax
  jne    L73
  jmp    L7
L172:
  lea    -0x1(%rbp),%eax
  cltq
  movsbl (%r14,%rax,1),%edi
  call   <hexToDec@plt>
  jmp    L187
```

assistant: ```c
int stringToNumber(const char *string, unsigned int *number, const char *delimiter) {
  int isHex = (string[0] == '0' && tolower(string[1]) == 'x');
  uint64_t num = 0;
  int index = 0;
  int i;
  if (isHex)
    for (i = 2; isxdigit(string[i]); i++)
      ;
  else
    for (i = 0; isdigit(string[i]); i++)
      ;
  while (*delimiter != '\0' && *delimiter != string[i])
    ++delimiter;
  if (*delimiter != string[i])
    return -1;
  if (*delimiter != '\0')
    index = i + 1;
  if (string[0] == '0' && tolower(string[1]) == 'x') {
    int shift = 0;
    int dec;
    if (i > 10)
      return -1;
    while (i-- > 2) {
      dec = hexToDec(string[i]);
      if (dec < 0)
        return -1;
      num |= ((uint64_t)dec << shift);
      if (num > (uint64_t)((unsigned int)-1))
        return -1;
      shift += 4;
    }
  } else {
    uint64_t multiplier = 1;
    while (i-- > 0) {
      if (isdigit(string[i]))
        num += ((uint64_t)(string[i] - '0') * multiplier);
      else
        return -1;
      if (num > (uint64_t)((unsigned int)-1))
        return -1;
      multiplier *= 10;
    }
  }
  *number = (unsigned int)num;
  return index;
}
```