user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<htoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x1,-0x4(%rbp)
  jle    L8
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L8
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L129
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L8
L129:
  addl   $0x2,-0xc(%rbp)
  subl   $0x2,-0x4(%rbp)
  jmp    L8
L83:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L37
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L37
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  mov    -0xc(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movsbl %dl,%edx
  sub    $0x30,%edx
  imul   %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L85
L37:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L80
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L80
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  mov    -0xc(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movsbl %dl,%edx
  sub    $0x37,%edx
  imul   %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L85
L80:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L92
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L92
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  mov    -0xc(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movsbl %dl,%edx
  sub    $0x57,%edx
  imul   %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L85
L92:
  mov    $0xffffffff,%eax
  jmp    L158
L85:
  addl   $0x1,-0xc(%rbp)
  subl   $0x1,-0x4(%rbp)
L8:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L83
  mov    -0x8(%rbp),%eax
L158:
  leave
  ret
```

assistant: ```c
int htoi(char s[]) {
  int i = 0, v = 0, l = strlen(s);
  if ((l >= 2) && (s[0] == '0') && ((s[1] == 'x') || (s[1] == 'X'))) {
    i += 2;
    l -= 2;
  }
  while (s[i] != '\0') {
    if (('0' <= s[i]) && (s[i] <= '9'))
      v += pow(16, l - 1) * (s[i] - '0');
    else if (('A' <= s[i]) && (s[i] <= 'F'))
      v += pow(16, l - 1) * (10 + s[i] - 'A');
    else if (('a' <= s[i]) && (s[i] <= 'f'))
      v += pow(16, l - 1) * (10 + s[i] - 'a');
    else
      return -1;
    ++i;
    --l;
  }
  return v;
}
```