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

```asm
<parse_dollars>:
  endbr64
  push   %r15
  mov    %rdx,%r10
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    (%r8),%rdx
  mov    0x50(%rsp),%r12
  mov    0x58(%rsp),%r13
  movzbl 0x1(%rcx,%rdx,1),%eax
  mov    0x60(%rsp),%r14
  mov    0x68(%rsp),%r15d
  cmp    $0x28,%al
  je     L81
  lea    0x1(%rdx),%rdi
  jg     L25
  cmp    $0x27,%al
  jbe    L22
L38:
  mov    %rdi,(%r8)
  mov    %r10,%rdx
  mov    %rbp,%rdi
  mov    %r15d,0x68(%rsp)
  mov    %r14,0x60(%rsp)
  mov    %r13,0x58(%rsp)
  mov    %r12,0x50(%rsp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <parse_param@plt>
  cs nopw 0x0(%rax,%rax,1)
L25:
  cmp    $0x5b,%al
  jne    L38
  add    $0x2,%rdx
  mov    %rdx,(%r8)
  movl   $0x1,0x50(%rsp)
L66:
  add    $0x18,%rsp
  mov    %rbp,%rdi
  mov    %r10,%rdx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <parse_arith@plt>
  nopl   0x0(%rax)
L22:
  movabs $0xffffff7bfffffffe,%rdx
  bt     %rax,%rdx
  jb     L38
  mov    0x0(%rbp),%rdi
  mov    $0x24,%ecx
  mov    %r10,%rdx
  call   <w_addchar@plt>
  xor    %r8d,%r8d
  mov    %rax,0x0(%rbp)
  test   %rax,%rax
  je     L159
L31:
  add    $0x18,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L81:
  lea    0x2(%rdx),%rax
  cmpb   $0x28,0x2(%rcx,%rdx,1)
  mov    %rax,0x8(%rsp)
  je     L15
L93:
  mov    D26(%rip),%rax
  mov    %r9d,%ebx
  and    (%rax),%ebx
  jne    L194
  mov    0x8(%rsp),%rax
  mov    %rbp,%rdi
  mov    %r10,%rdx
  mov    %rax,(%r8)
  xor    %eax,%eax
  test   %r15d,%r15d
  cmovne %rax,%r12
  mov    %r14,0x60(%rsp)
  mov    %r13,0x58(%rsp)
  mov    %r12,0x50(%rsp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <parse_comm@plt>
  nopl   0x0(%rax,%rax,1)
L15:
  lea    0x3(%rdx),%edi
  movslq %edi,%rdi
  movzbl (%rcx,%rdi,1),%eax
  test   %al,%al
  je     L93
  cmp    $0x29,%al
  je     L86
  add    $0x1,%rdi
  xor    %r11d,%r11d
  jmp    L142
  nopl   0x0(%rax,%rax,1)
L160:
  cmp    $0x29,%al
  sete   %al
  movzbl %al,%eax
  sub    %eax,%r11d
L90:
  movzbl (%rcx,%rdi,1),%eax
  test   %al,%al
  je     L93
  lea    0x1(%rdi),%rbx
  cmp    $0x29,%al
  jne    L151
  test   %r11d,%r11d
  je     L86
L151:
  mov    %rbx,%rdi
L142:
  cmp    $0x28,%al
  jne    L160
  add    $0x1,%r11d
  jmp    L90
  nopl   0x0(%rax)
L194:
  mov    D2(%rip),%rax
  mov    (%rax),%r8d
  jmp    L31
  nop
L159:
  mov    D14(%rip),%rax
  mov    (%rax),%r8d
  jmp    L31
  nop
L86:
  cmpb   $0x29,0x1(%rcx,%rdi,1)
  jne    L93
  add    $0x3,%rdx
  mov    %rdx,(%r8)
  movl   $0x0,0x50(%rsp)
  jmp    L66
```

assistant: ```c
int parse_dollars(char **word, size_t *word_length, size_t *max_length, const char *words, size_t *offset, int flags, wordexp_t *pwordexp, const char *ifs, const char *ifs_white, int quoted) {
  switch (words[1 + *offset]) {
  case '"':
  case '\'':
  case 0:
    *word = w_addchar(*word, word_length, max_length, '$');
    return *word ? 0 : WRDE_NOSPACE;
  case '(':
    if (words[2 + *offset] == '(') {
      int i = 3 + *offset;
      int depth = 0;
      while (words[i] && !(depth == 0 && words[i] == ')')) {
        if (words[i] == '(')
          ++depth;
        else if (words[i] == ')')
          --depth;
        ++i;
      }
      if (words[i] == ')' && words[i + 1] == ')') {
        (*offset) += 3;
        return parse_arith(word, word_length, max_length, words, offset, flags, 0);
      }
    }
    if (flags & WRDE_NOCMD)
      return WRDE_CMDSUB;
    (*offset) += 2;
    return parse_comm(word, word_length, max_length, words, offset, flags, quoted ? NULL : pwordexp, ifs, ifs_white);
  case '[':
    (*offset) += 2;
    return parse_arith(word, word_length, max_length, words, offset, flags, 1);
  case '{':
  default:
    ++(*offset);
    return parse_param(word, word_length, max_length, words, offset, flags, pwordexp, ifs, ifs_white, quoted);
  }
}
```