user: Translate the below assembly code into C programming language:

```asm
<stringtohex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x1,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L60
L132:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jbe    L58
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  ja     L58
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  sub    $0x30,%eax
  imul   -0x8(%rbp),%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
L58:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jbe    L59
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jbe    L9
L59:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jbe    L143
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  ja     L143
L9:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  sub    $0x41,%eax
  cmp    $0x25,%eax
  ja     L143
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D18(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D18(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x2,%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
  mov    -0x8(%rbp),%eax
  imul   $0xe,%eax,%eax
  add    %eax,-0xc(%rbp)
  jmp    L143
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  add    %eax,-0xc(%rbp)
  nop
L143:
  shll   $0x4,-0x8(%rbp)
  addl   $0x1,-0x10(%rbp)
L60:
  mov    -0x10(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L132
  mov    -0xc(%rbp),%eax
  leave
  ret
```

assistant: ```c
int stringtohex(unsigned char *str) {
  int i, len, num = 0, multiplier = 1;
  len = strlen(str);
  for (i = 0; i < len; i++) {
    if ((str[(len - 1) - i]) >= '0' && (str[(len - 1) - i]) <= '9') {
      num += (str[(len - 1) - i] - 0x30) * multiplier;
    } else if (((str[(len - 1) - i]) >= 'a' && (str[(len - 1) - i]) <= 'f') || (((str[(len - 1) - i]) >= 'A' && (str[(len - 1) - i]) <= 'F'))) {
      switch (str[(len - 1) - i]) {
      case 'a':
      case 'A':
        num += 10 * multiplier;
        break;
      case 'b':
      case 'B':
        num += 11 * multiplier;
        break;
      case 'c':
      case 'C':
        num += 12 * multiplier;
        break;
      case 'd':
      case 'D':
        num += 13 * multiplier;
        break;
      case 'e':
      case 'E':
        num += 14 * multiplier;
        break;
      case 'f':
      case 'F':
        num += 15 * multiplier;
        break;
      }
    }
    multiplier *= 16;
  }
  return num;
}
```