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

```asm
<dice_parse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x1,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x30(%rbp),%rax
  movl   $0x0,(%rax)
  jmp    L85
L168:
  cmpl   $0x5,-0xc(%rbp)
  ja     L346
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D35(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D35(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L405
  movl   $0x1,-0x4(%rbp)
  movl   $0x4,-0xc(%rbp)
  jmp    L316
L405:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L69
  movl   $0xffffffff,-0x4(%rbp)
  movl   $0x4,-0xc(%rbp)
  jmp    L316
L69:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L371
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  je     L316
  movl   $0x1,-0xc(%rbp)
  jmp    L316
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x64,%al
  jne    L70
  mov    -0x8(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x0,-0x8(%rbp)
  movl   $0x1,-0x4(%rbp)
  movl   $0x2,-0xc(%rbp)
  jmp    L213
L70:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L15
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L213
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L397
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  je     L339
  movl   $0x3,-0xc(%rbp)
  jmp    L339
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L217
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L213
L217:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L3
  mov    -0x28(%rbp),%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  movl   $0x0,-0x8(%rbp)
  movl   $0x4,-0xc(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L213
L3:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L299
  mov    -0x28(%rbp),%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  movl   $0x0,-0x8(%rbp)
  movl   $0x4,-0xc(%rbp)
  movl   $0xffffffff,-0x4(%rbp)
  jmp    L213
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L102
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  je     L67
  movl   $0x5,-0xc(%rbp)
  jmp    L67
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L337
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L213
L346:
  mov    $0x0,%edi
  call   <assert@plt>
  jmp    L399
L316:
  nop
  jmp    L213
L339:
  nop
  jmp    L213
L67:
  nop
L213:
  addq   $0x1,-0x18(%rbp)
L85:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L168
  cmpl   $0x5,-0xc(%rbp)
  ja     L119
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D8(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D8(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x8(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L250
  mov    -0x8(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L250
  mov    -0x8(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L250
  mov    -0x8(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L250
L119:
  mov    $0x0,%edi
  call   <assert@plt>
  jmp    L399
  nop
L250:
  mov    $0x0,%eax
  jmp    L329
L371:
  nop
  jmp    L399
L15:
  nop
  jmp    L399
L397:
  nop
  jmp    L399
L299:
  nop
  jmp    L399
L102:
  nop
  jmp    L399
L337:
  nop
  jmp    L399
  nop
L399:
  mov    $0xffffffff,%eax
L329:
  leave
  ret
```

assistant: ```c
int dice_parse(const char *ptr, int *num, int *faces, int *bias) {
  int state = 0, val = 0, sign = 1;
  *num = 0;
  *faces = 0;
  *bias = 0;
  while (*ptr) {
    switch (state) {
    case 0:
      if (*ptr == '+') {
        sign = 1;
        state = 4;
      } else if (*ptr == '-') {
        sign = -1;
        state = 4;
      } else if (isdigit(*ptr)) {
        val = *ptr - '0';
        if (val)
          state = 1;
      } else {
        goto error;
      }
      break;
    case 1:
      if (*ptr == 'd') {
        *num = val * sign;
        val = 0;
        sign = 1;
        state = 2;
      } else if (isdigit(*ptr)) {
        val = (val * 10) + *ptr - '0';
      } else {
        goto error;
      }
      break;
    case 2:
      if (isdigit(*ptr)) {
        val = *ptr - '0';
        if (val)
          state = 3;
      } else {
        goto error;
      }
      break;
    case 3:
      if (isdigit(*ptr)) {
        val = (val * 10) + *ptr - '0';
      } else if (*ptr == '+') {
        *faces = val;
        val = 0;
        state = 4;
        sign = 1;
      } else if (*ptr == '-') {
        *faces = val;
        val = 0;
        state = 4;
        sign = -1;
      } else {
        goto error;
      }
      break;
    case 4:
      if (isdigit(*ptr)) {
        val = atoi(ptr);
        if (val)
          state = 5;
      } else {
        goto error;
      }
      break;
    case 5:
      if (isdigit(*ptr)) {
        val = (val * 10) + *ptr - '0';
      } else {
        goto error;
      }
      break;
    default:
      assert(false);
      goto error;
    }
    ptr++;
  }
  switch (state) {
  case 0:
    break;
  case 1:
    *bias = val * sign;
    break;
  case 2:
    goto error;
    break;
  case 3:
    *faces = val * sign;
    break;
  case 4:
    *bias = val * sign;
    break;
  case 5:
    *bias = val * sign;
    break;
  default:
    assert(false);
    goto error;
  }
  return 0;
error:
  return -1;
}
```