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

```asm
<dice_parse>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rcx,0x8(%rsp)
  movl   $0x0,(%rsi)
  movl   $0x0,(%rdx)
  movl   $0x0,(%rcx)
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L205
  mov    %rsi,%r14
  mov    %rdx,%r15
  movl   $0x1,0x4(%rsp)
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  lea    D3(%rip),%r13
  jmp    L214
  cmp    $0x2b,%dil
  je     L190
  cmp    $0x2d,%dil
  jne    L132
  movl   $0xffffffff,0x4(%rsp)
  mov    $0x4,%ebp
  jmp    L72
L132:
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L70
  movsbl (%rbx),%r12d
  sub    $0x30,%r12d
  setne  %bpl
  movzbl %bpl,%ebp
  jmp    L72
  cmp    $0x64,%dil
  jne    L43
  imul   0x4(%rsp),%r12d
  mov    %r12d,(%r14)
  mov    %ebp,0x4(%rsp)
  mov    $0x0,%r12d
  mov    $0x2,%ebp
  jmp    L72
L43:
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L94
  lea    (%r12,%r12,4),%edx
  movsbl (%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%r12d
  jmp    L72
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L40
  movsbl (%rbx),%r12d
  sub    $0x30,%r12d
  mov    $0x3,%eax
  cmovne %eax,%ebp
L72:
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L260
L214:
  cmp    $0x5,%ebp
  ja     L25
  mov    %ebp,%eax
  movslq 0x0(%r13,%rax,4),%rax
  add    %r13,%rax
  notrack jmp *%rax
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L354
  lea    (%r12,%r12,4),%edx
  movsbl (%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%r12d
  jmp    L72
L354:
  movzbl (%rbx),%edx
  cmp    $0x2b,%dl
  je     L243
  cmp    $0x2d,%dl
  jne    L66
  mov    %r12d,(%r15)
  mov    %eax,%r12d
  movl   $0xffffffff,0x4(%rsp)
  mov    $0x4,%ebp
  jmp    L72
L243:
  mov    %r12d,(%r15)
  mov    %eax,%r12d
  movl   $0x1,0x4(%rsp)
  mov    $0x4,%ebp
  jmp    L72
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L68
  mov    %rbx,%rdi
  call   <atoi@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  mov    $0x5,%eax
  cmovne %eax,%ebp
  jmp    L72
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L61
  lea    (%r12,%r12,4),%edx
  movsbl (%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%r12d
  jmp    L72
L25:
  mov    $0x0,%edi
  call   <assert@plt>
  mov    $0xffffffff,%ebp
L28:
  mov    %ebp,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L190:
  movl   $0x1,0x4(%rsp)
  mov    $0x4,%ebp
  jmp    L72
L260:
  cmp    $0x5,%ebp
  ja     L340
  mov    %ebp,%eax
  lea    D15(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0xffffffff,%ebp
  jmp    L28
  imul   0x4(%rsp),%r12d
  mov    0x8(%rsp),%rax
  mov    %r12d,(%rax)
  mov    $0x0,%ebp
  jmp    L28
  imul   0x4(%rsp),%r12d
  mov    %r12d,(%r15)
  mov    $0x0,%ebp
  jmp    L28
  imul   0x4(%rsp),%r12d
  mov    0x8(%rsp),%rax
  mov    %r12d,(%rax)
  mov    $0x0,%ebp
  jmp    L28
  imul   0x4(%rsp),%r12d
  mov    0x8(%rsp),%rax
  mov    %r12d,(%rax)
  mov    $0x0,%ebp
  jmp    L28
L340:
  mov    $0x0,%edi
  call   <assert@plt>
  mov    $0xffffffff,%ebp
  jmp    L28
L205:
  mov    $0x0,%ebp
  jmp    L28
L70:
  mov    $0xffffffff,%ebp
  jmp    L28
L94:
  mov    $0xffffffff,%ebp
  jmp    L28
L40:
  mov    $0xffffffff,%ebp
  jmp    L28
L66:
  mov    $0xffffffff,%ebp
  jmp    L28
L68:
  mov    $0xffffffff,%ebp
  jmp    L28
L61:
  mov    $0xffffffff,%ebp
  jmp    L28
```

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