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

```asm
<parse_canframe>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbp
  call   <strlen@plt>
  mov    %eax,%r14d
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x1,%eax
  cmp    $0x3,%r14d
  jle    L180
  cmpb   $0x23,0x3(%r12)
  je     L111
  cmpb   $0x23,0x8(%r12)
  jne    L180
L53:
  mov    %r12,%r13
  mov    $0x1c,%ebx
L51:
  movsbl 0x0(%r13),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L139
  movzbl %al,%eax
  mov    %ebx,%ecx
  shl    %cl,%eax
  or     0x0(%rbp),%al
  mov    %al,0x0(%rbp)
  add    $0x1,%r13
  sub    $0x4,%ebx
  cmp    $0xfffffffc,%ebx
  jne    L51
  movzbl %al,%edx
  mov    D23(%rip),%rcx
  and    (%rcx),%edx
  mov    $0x9,%ebx
  jne    L136
  mov    D9(%rip),%rdx
  or     (%rdx),%al
  mov    %al,0x0(%rbp)
  jmp    L136
L111:
  cmpb   $0x23,0x8(%r12)
  je     L53
  mov    %r12,%r13
  mov    $0x8,%ebx
L63:
  movsbl 0x0(%r13),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L167
  movzbl %al,%eax
  mov    %ebx,%ecx
  shl    %cl,%eax
  or     %al,0x0(%rbp)
  add    $0x1,%r13
  sub    $0x4,%ebx
  cmp    $0xfffffffc,%ebx
  jne    L63
  mov    $0x4,%ebx
L136:
  movslq %ebx,%rax
  movzbl (%r12,%rax,1),%eax
  and    $0xffffffdf,%eax
  mov    $0x0,%r13d
  cmp    $0x52,%al
  je     L55
L11:
  mov    %r13d,0xc(%rsp)
  mov    %r13d,%eax
  movslq %ebx,%rdx
  cmpb   $0x2e,(%r12,%rdx,1)
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%ebx
  cmp    %r14d,%ebx
  jge    L102
  lea    0x1(%rbx),%r15d
  movslq %ebx,%rax
  movsbl (%r12,%rax,1),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L158
  mov    0x8(%rbp),%rdx
  shl    $0x4,%eax
  mov    %al,(%rdx,%r13,1)
  add    $0x2,%ebx
  movslq %r15d,%r15
  movsbl (%r12,%r15,1),%edi
  call   <asc2nibble@plt>
  cmp    $0xf,%al
  ja     L73
  mov    %r13,%rdx
  add    0x8(%rbp),%rdx
  or     %al,(%rdx)
  mov    0xc(%rsp),%eax
  add    $0x1,%eax
  add    $0x1,%r13
  cmp    $0x8,%r13
  jne    L11
L102:
  mov    %eax,0x10(%rbp)
  mov    $0x0,%eax
L180:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L55:
  mov    D22(%rip),%rax
  movzbl (%rax),%eax
  or     %al,0x0(%rbp)
  mov    $0x0,%eax
  jmp    L180
L139:
  mov    $0x1,%eax
  jmp    L180
L167:
  mov    $0x1,%eax
  jmp    L180
L158:
  mov    $0x1,%eax
  jmp    L180
L73:
  mov    $0x1,%eax
  jmp    L180
```

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;
}
```