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

```asm
<parse_key>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%rbx
  mov    %rdx,%r12
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  test   %rbx,%rbx
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  test   %r12,%r12
  je     L32
  cmpb   $0x30,(%rbx)
  jne    L116
  movzbl 0x1(%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L116
  lea    0x2(%rbx),%r14
  lea    D7(%rip),%rsi
  mov    %r14,%rdi
  call   <strspn@plt>
  mov    %rax,%rbp
  mov    %r14,%rdi
  call   <strlen@plt>
  cmp    %rax,%rbp
  je     L27
L116:
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strlcpy@plt>
  mov    %eax,%ebp
  cltq
  cmp    %r12,%rax
  jae    L115
  mov    $0x1,%edi
  test   %ebp,%ebp
  jns    L223
L119:
  mov    $0x0,%edi
L223:
  call   <assert@plt>
L227:
  mov    %ebp,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  lea    -0x1(%r13,%r12,1),%rax
  mov    %rax,0x8(%rsp)
  movzbl 0x2(%rbx),%edi
  cmp    %rax,%r13
  jae    L60
  test   %dil,%dil
  je     L60
  lea    0x3(%rbx),%r14
  mov    %r13,%r15
  mov    $0x0,%ebp
  jmp    L72
L142:
  mov    %r14,(%rsp)
  movsbl %dil,%edi
  call   <toint@plt>
  lea    0x1(%r15),%rdx
  and    $0xf,%eax
  or     (%r15),%al
L85:
  mov    %al,(%r15)
  mov    (%rsp),%rax
  movzbl (%rax),%edi
  add    $0x1,%r14
  cmp    0x8(%rsp),%rdx
  jae    L163
  test   %dil,%dil
  je     L163
  mov    %rdx,%r15
L72:
  lea    -0x1(%r14),%rax
  sub    %rbx,%rax
  test   $0x1,%al
  jne    L142
  mov    %r14,(%rsp)
  movsbl %dil,%edi
  call   <toint@plt>
  shl    $0x4,%eax
  add    $0x1,%ebp
  mov    %r15,%rdx
  jmp    L85
L163:
  movslq %ebp,%rax
  movb   $0x0,0x0(%r13,%rax,1)
  mov    (%rsp),%rax
  cmpb   $0x0,(%rax)
  jne    L117
  test   %ebp,%ebp
  js     L119
  movslq %ebp,%rax
  cmp    %r12,%rax
  jae    L119
  mov    $0x1,%edi
  jmp    L223
L32:
  mov    $0xffffffff,%ebp
  jmp    L227
L117:
  mov    $0xffffffff,%ebp
  jmp    L227
L115:
  mov    $0xffffffff,%ebp
  jmp    L227
L26:
  mov    $0xffffffff,%ebp
  jmp    L227
L60:
  movb   $0x0,0x0(%r13)
  cmpb   $0x0,0x2(%rbx)
  jne    L26
  mov    $0x0,%ebp
  mov    $0x1,%edi
  jmp    L223
```

tool_calls: name: parse_data
arguments: label: D7
datatype: string

tool: D7: 0123456789ABCDEFabcdef

assistant: ```c
int parse_key(char *dst, const char *src, size_t dstlen) {
  const char *hexdigits = "0123456789ABCDEFabcdef";
  char *dstend;
  char *p;
  char *q;
  int n;
  assert(dst != NULL);
  assert(src != NULL);
  if (dstlen == 0) {
    return (-1);
  }
  if ((src[0] == '0') && (src[1] == 'x' || src[1] == 'X') && (strspn(src + 2, hexdigits) == strlen(src + 2))) {
    dstend = dst + dstlen - 1;
    p = (char *)src + 2;
    q = dst;
    n = 0;
    while (*p && (q < dstend)) {
      if (((p - src) & 0x01) == 0) {
        *q = (toint(*p++) << 4) & 0xf0;
        n++;
      } else {
        *q++ |= (toint(*p++)) & 0x0f;
      }
    }
    dst[n] = '\0';
    if (*p) {
      return (-1);
    }
  } else {
    n = strlcpy(dst, src, dstlen);
    if ((size_t)n >= dstlen) {
      return (-1);
    }
  }
  assert((n >= 0) && ((size_t)n < dstlen));
  return (n);
}
```