user: Please show me the C implementation that matches the assembly code listed below:

```asm
<parse_canframe>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  xor    %esi,%esi
  mov    $0x18,%edx
  mov    %rbx,%rdi
  mov    %eax,%r12d
  call   <memset@plt>
  cmp    $0x3,%r12d
  jle    L75
  cmpb   $0x23,0x3(%rbp)
  movzbl 0x8(%rbp),%eax
  je     L40
  cmp    $0x23,%al
  jne    L75
L61:
  mov    %rbp,%r14
  mov    $0x1c,%r13d
L68:
  movsbl (%r14),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L75
  mov    %r13d,%ecx
  movzbl %al,%eax
  sub    $0x4,%r13d
  add    $0x1,%r14
  shl    %cl,%eax
  or     (%rbx),%al
  mov    %al,(%rbx)
  cmp    $0xfffffffc,%r13d
  jne    L68
  mov    D21(%rip),%rdx
  mov    (%rdx),%esi
  and    %eax,%esi
  test   %sil,%sil
  jne    L79
  mov    D15(%rip),%rdx
  mov    $0x9,%r14d
  or     (%rdx),%al
  mov    $0x9,%edx
  mov    %al,(%rbx)
  jmp    L13
  nop
L75:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L40:
  cmp    $0x23,%al
  je     L61
  mov    %rbp,%r14
  mov    $0x8,%r13d
L160:
  movsbl (%r14),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L75
  mov    %r13d,%ecx
  movzbl %al,%eax
  sub    $0x4,%r13d
  add    $0x1,%r14
  shl    %cl,%eax
  or     (%rbx),%al
  mov    %al,(%rbx)
  cmp    $0xfffffffc,%r13d
  jne    L160
  mov    $0x4,%edx
  mov    $0x4,%r14d
L13:
  movzbl 0x0(%rbp,%rdx,1),%edx
  xor    %r15d,%r15d
  mov    %edx,%ecx
  and    $0xffffffdf,%ecx
  cmp    $0x52,%cl
  je     L14
L151:
  xor    %eax,%eax
  cmp    $0x2e,%dl
  mov    %r15d,%ecx
  sete   %al
  add    %eax,%r14d
  cmp    %r12d,%r14d
  jge    L93
  movslq %r14d,%rax
  lea    0x1(%r14),%r13d
  movsbl 0x0(%rbp,%rax,1),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L75
  mov    0x8(%rbx),%rdx
  shl    $0x4,%eax
  movslq %r13d,%r13
  add    $0x2,%r14d
  mov    %al,(%rdx,%r15,1)
  movsbl 0x0(%rbp,%r13,1),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L75
  mov    0x8(%rbx),%rdx
  add    %r15,%rdx
  add    $0x1,%r15
  or     %al,(%rdx)
  cmp    $0x8,%r15
  je     L23
  movslq %r14d,%rax
  movzbl 0x0(%rbp,%rax,1),%edx
  jmp    L151
  nopl   0x0(%rax,%rax,1)
L23:
  mov    $0x8,%ecx
L93:
  mov    %ecx,0x10(%rbx)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L14:
  mov    D19(%rip),%rdx
  or     (%rdx),%al
  mov    %al,(%rbx)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L79:
  mov    $0x9,%edx
  mov    $0x9,%r14d
  jmp    L13
```

assistant: ```c
int parse_canframe(char *cs, struct can_frame *cf) {
  int i, idx, dlc, len;
  unsigned char tmp;
  len = strlen(cs);
  memset(cf, 0, sizeof(*cf));
  if (len < 4)
    return 1;
  if (!((cs[3] == '#') || (cs[8] == '#')))
    return 1;
  if (cs[8] == '#') {
    idx = 9;
    for (i = 0; i < 8; i++) {
      if ((tmp = asc2nibble(cs[i])) > 0x0F)
        return 1;
      cf->can_id |= (tmp << (7 - i) * 4);
    }
    if (!(cf->can_id & CAN_ERR_FLAG))
      cf->can_id |= CAN_EFF_FLAG;
  } else {
    idx = 4;
    for (i = 0; i < 3; i++) {
      if ((tmp = asc2nibble(cs[i])) > 0x0F)
        return 1;
      cf->can_id |= (tmp << (2 - i) * 4);
    }
  }
  if ((cs[idx] == 'R') || (cs[idx] == 'r')) {
    cf->can_id |= CAN_RTR_FLAG;
    return 0;
  }
  for (i = 0, dlc = 0; i < 8; i++) {
    if (cs[idx] == '.')
      idx++;
    if (idx >= len)
      break;
    if ((tmp = asc2nibble(cs[idx++])) > 0x0F)
      return 1;
    cf->data[i] = (tmp << 4);
    if ((tmp = asc2nibble(cs[idx++])) > 0x0F)
      return 1;
    cf->data[i] |= tmp;
    dlc++;
  }
  cf->can_dlc = dlc;
  return 0;
}
```