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

```asm
<parse_mask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xffffffff,-0x20(%rbp)
  mov    -0x30(%rbp),%rax
  sub    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L124
  addq   $0x1,-0x30(%rbp)
  movl   $0x0,-0x20(%rbp)
  lea    -0x10(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x3f,-0x18(%rbp)
  jg     L139
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L94
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x30(%rbp)
  lea    -0x10(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x3f,-0x14(%rbp)
  jg     L159
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jge    L162
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L157
L42:
  mov    -0x1c(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  or     %edx,%eax
  mov    %eax,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L157:
  mov    -0x1c(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jle    L42
  jmp    L92
L162:
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L140
L50:
  mov    -0x1c(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  or     %edx,%eax
  mov    %eax,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L140:
  mov    -0x1c(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jle    L50
  jmp    L92
L94:
  mov    -0x18(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  or     %edx,%eax
  mov    %eax,-0x20(%rbp)
L92:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5d,%al
  je     L100
  jmp    L82
L139:
  nop
  jmp    L82
L159:
  nop
L82:
  cmpq   $0x0,-0x28(%rbp)
  je     L93
  mov    -0x28(%rbp),%rax
  movq   $0x0,(%rax)
L93:
  mov    $0x0,%eax
  jmp    L177
L124:
  nop
  jmp    L106
L100:
  nop
L106:
  cmpq   $0x0,-0x28(%rbp)
  je     L8
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
L8:
  mov    -0x20(%rbp),%eax
L177:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L35
  call   <__stack_chk_fail@plt>
L35:
  leave
  ret
```

assistant: ```c
uint64_t parse_mask(const char **rem, const char *str) {
  uint64_t mask = (uint64_t)-1;
  uint64_t i, start, end;
  char *err = (char *)str - 1;
  if (*str != '[')
    goto out;
  str++;
  mask = 0;
  start = strtol(str, &err, 10);
  if (start > 63)
    goto err;
  if (*err == '-') {
    str = err + 1;
    end = strtol(str, &err, 10);
    if (end > 63)
      goto err;
    if (start < end)
      for (i = start; i <= end; i++)
        mask |= (1ul << i);
    else
      for (i = end; i <= start; i++)
        mask |= (1ul << i);
  } else {
    mask |= (1ul << start);
  }
  if (*err == ']')
    goto out;
err:
  if (rem)
    *rem = NULL;
  return 0;
out:
  if (rem)
    *rem = err + 1;
  return mask;
}
```