user: 请从给定的汇编指令推导出C源代码:

```asm
<htoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  movl   $0x0,-0x24(%rbp)
  movq   $0x0,-0x18(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L165
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L183
L165:
  movl   $0x2,-0x1c(%rbp)
  jmp    L4
L183:
  movl   $0x0,-0x1c(%rbp)
L4:
  movl   $0x7,-0x24(%rbp)
  jmp    L69
L173:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L77
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L67
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L67
  cmpl   $0x0,-0x20(%rbp)
  jle    L131
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x30(%rax),%ebx
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   %ebx,%eax
  cltq
  add    %rax,-0x18(%rbp)
  jmp    L77
L131:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  add    %rax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
  jmp    L77
L67:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L89
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L89
  cmpl   $0x0,-0x20(%rbp)
  jle    L83
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x37(%rax),%ebx
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   %ebx,%eax
  cltq
  add    %rax,-0x18(%rbp)
  jmp    L77
L83:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  add    %rax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
  jmp    L77
L89:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L77
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L77
  cmpl   $0x0,-0x20(%rbp)
  jle    L48
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x57(%rax),%ebx
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   %ebx,%eax
  cltq
  add    %rax,-0x18(%rbp)
  jmp    L77
L48:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  cltq
  add    %rax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L77:
  subl   $0x1,-0x24(%rbp)
L69:
  mov    -0x24(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L173
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
uint32_t htoi(char s[]) {
  int i;
  int power;
  uint32_t total;
  int last_digit;
  i = 0;
  total = 0;
  power = 0;
  if (s[1] == 'x' || s[1] == 'X')
    last_digit = 2;
  else
    last_digit = 0;
  for (i = 8 - 1; i >= last_digit; i--) {
    if (s[i] != 0) {
      if (s[i] >= '0' && s[i] <= '9') {
        if (power > 0)
          total = total + ((s[i] - 48) * pow(16, power++));
        else {
          total = total + (s[i] - 48);
          power++;
        }
      } else if (s[i] >= 'A' && s[i] <= 'F') {
        if (power > 0)
          total = total + ((s[i] - 55) * pow(16, power++));
        else {
          total = total + (s[i] - 55);
          power++;
        }
      } else if (s[i] >= 'a' && s[i] <= 'f') {
        if (power > 0)
          total = total + ((s[i] - 87) * pow(16, power++));
        else {
          total = total + (s[i] - 87);
          power++;
        }
      }
    }
  }
  return total;
}
```