user: Converte this assembly snippet into its equivalent C code:

```asm
<parse_cores>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  movl   $0x0,-0x2c(%rbp)
L95:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L61
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L216
L61:
  mov    -0x48(%rbp),%rax
  jmp    L161
L216:
  lea    -0x28(%rbp),%rcx
  mov    -0x48(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L234
  mov    -0x48(%rbp),%rax
  jmp    L161
L234:
  cmpl   $0x0,-0x2c(%rbp)
  je     L70
  mov    -0x10(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jb     L70
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L101
L65:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  or     $0x1,%edx
  mov    %edx,(%rax)
  addq   $0x1,-0x20(%rbp)
L101:
  mov    -0x20(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jbe    L65
  jmp    L176
L70:
  cmpl   $0x0,-0x2c(%rbp)
  je     L69
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L212
L158:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  or     $0x1,%edx
  mov    %edx,(%rax)
  subq   $0x1,-0x20(%rbp)
L212:
  mov    -0x20(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L176
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jbe    L158
  jmp    L176
L69:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L176
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  or     $0x1,%edx
  mov    %edx,(%rax)
L176:
  movl   $0x0,-0x2c(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x2d,%eax
  je     L166
  cmp    $0x2d,%eax
  jg     L42
  test   %eax,%eax
  je     L59
  cmp    $0x2c,%eax
  jmp    L42
L166:
  movl   $0x1,-0x2c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L42
L59:
  mov    $0x0,%eax
  jmp    L161
L42:
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x48(%rbp)
  jmp    L95
L161:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L229
  call   <__stack_chk_fail@plt>
L229:
  leave
  ret
```

assistant: ```c
const char *parse_cores(uint8_t *dest, size_t len, const char *str) {
  size_t i, start = 0, val;
  uint8_t range = 0;
  char *err;
  while (1) {
    if (*str < '0' || *str > '9')
      return str;
    val = strtol(str, &err, 10);
    if (val >= len)
      return str;
    if (range && val >= start) {
      for (i = start; i <= val; i++)
        dest[i] |= 1;
    } else if (range) {
      for (i = start; i >= val && i <= start; i--)
        dest[i] |= 1;
    } else if (*err != '-') {
      dest[val] |= 1;
    }
    range = 0;
    switch (*err) {
    case ',':
      break;
    case '-':
      range = 1;
      start = val;
      break;
    case '\0':
      return NULL;
    }
    str = err + 1;
  }
}
```