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

```asm
<parse_key>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  xor    %edi,%edi
  test   %rbp,%rbp
  setne  %dil
  call   <assert@plt>
  test   %rbx,%rbx
  je     L137
  cmpb   $0x30,0x0(%rbp)
  jne    L80
  movzbl 0x1(%rbp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L138
L80:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strlcpy@plt>
  mov    %eax,%r12d
  cltq
  cmp    %rbx,%rax
  jae    L137
  xor    %edi,%edi
  test   %r12d,%r12d
  js     L106
L116:
  xor    %edi,%edi
  cmp    %rax,%rbx
  seta   %dil
L106:
  call   <assert@plt>
L40:
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L138:
  lea    0x2(%rbp),%r14
  lea    D9(%rip),%rsi
  mov    %r14,%rdi
  call   <strspn@plt>
  mov    %r14,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  cmp    %rax,%r12
  jne    L80
  movsbl 0x2(%rbp),%edi
  lea    -0x1(%r13,%rbx,1),%rax
  mov    %rax,(%rsp)
  test   %dil,%dil
  je     L149
  cmp    %rax,%r13
  jae    L149
  lea    0x3(%rbp),%rdx
  mov    %r13,%r15
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L30:
  lea    -0x1(%rdx),%rax
  mov    %rdx,0x8(%rsp)
  mov    %rdx,%r14
  sub    %rbp,%rax
  test   $0x1,%al
  jne    L100
  call   <toint@plt>
  mov    0x8(%rsp),%rdx
  add    $0x1,%r12d
  shl    $0x4,%eax
  mov    %al,(%r15)
  movsbl (%rdx),%edi
  add    $0x1,%rdx
  test   %dil,%dil
  je     L105
  cmp    %r15,(%rsp)
  ja     L30
L105:
  movslq %r12d,%rax
  add    %rax,%r13
L8:
  movb   $0x0,0x0(%r13)
  cmpb   $0x0,(%r14)
  je     L116
  xchg   %ax,%ax
L137:
  mov    $0xffffffff,%r12d
  jmp    L40
  nopl   0x0(%rax,%rax,1)
L100:
  call   <toint@plt>
  mov    0x8(%rsp),%rdx
  lea    0x1(%r15),%rsi
  and    $0xf,%eax
  or     %al,(%r15)
  add    $0x1,%rdx
  movsbl -0x1(%rdx),%edi
  cmp    %rsi,(%rsp)
  jbe    L105
  test   %dil,%dil
  je     L105
  mov    %rsi,%r15
  jmp    L30
L149:
  xor    %eax,%eax
  xor    %r12d,%r12d
  jmp    L8
```

tool_calls: name: unpack_data
arguments: data_label: D9
datatype: string

tool: D9: 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);
}
```