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

```asm
<string_decode_base16>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L78
  cmpq   $0x0,-0x30(%rbp)
  jne    L180
L78:
  mov    $0x0,%eax
  jmp    L22
L180:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L18
L61:
  mov    -0x14(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0xc(%rbp)
  movb   $0x0,-0x19(%rbp)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L160
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L160
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
  jmp    L121
L160:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L21
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L21
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
  jmp    L121
L21:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L121
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L121
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
L121:
  addl   $0x1,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L53
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L53
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  sub    $0x30,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
  jmp    L132
L53:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L195
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L195
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  sub    $0x57,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
  jmp    L132
L195:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L132
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L132
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  sub    $0x37,%eax
  mov    %eax,%edx
  movzbl -0x19(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x19(%rbp)
L132:
  mov    -0x8(%rbp),%rax
  movzbl -0x19(%rbp),%edx
  mov    %dl,(%rax)
  addq   $0x1,-0x8(%rbp)
  addl   $0x1,-0x18(%rbp)
  addl   $0x1,-0x14(%rbp)
L18:
  mov    -0x14(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jl     L61
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%eax
L22:
  leave
  ret
```

assistant: ```c
int string_decode_base16(const char *from, char *to) {
  int length, to_length, i, pos;
  unsigned char *ptr_to, value;
  if (!from || !to)
    return 0;
  length = strlen(from) / 2;
  ptr_to = (unsigned char *)to;
  ptr_to[0] = '\0';
  to_length = 0;
  for (i = 0; i < length; i++) {
    pos = i * 2;
    value = 0;
    if ((from[pos] >= '0') && (from[pos] <= '9'))
      value |= (from[pos] - '0') << 4;
    else if ((from[pos] >= 'a') && (from[pos] <= 'f'))
      value |= (from[pos] - 'a' + 10) << 4;
    else if ((from[pos] >= 'A') && (from[pos] <= 'F'))
      value |= (from[pos] - 'A' + 10) << 4;
    pos++;
    if ((from[pos] >= '0') && (from[pos] <= '9'))
      value |= from[pos] - '0';
    else if ((from[pos] >= 'a') && (from[pos] <= 'f'))
      value |= from[pos] - 'a' + 10;
    else if ((from[pos] >= 'A') && (from[pos] <= 'F'))
      value |= from[pos] - 'A' + 10;
    ptr_to[0] = value;
    ptr_to++;
    to_length++;
  }
  ptr_to[0] = '\0';
  return to_length;
}
```