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

```asm
<Tcl_ScanCountedElement>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  lea    D6(%rip),%rax
  cmove  %rax,%r14
  cmp    $0xffffffff,%esi
  jne    L225
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,%esi
L225:
  movslq %esi,%rsi
  lea    (%r14,%rsi,1),%rcx
  cmp    %rcx,%r14
  je     L140
  movzbl (%r14),%eax
  mov    %r14,%rbx
  movabs $0x800000008000011,%r13
  cmp    $0x22,%al
  sete   %bpl
  cmp    $0x7b,%al
  sete   %dl
  xor    %r12d,%r12d
  or     %edx,%ebp
  movzbl %bpl,%ebp
  add    %ebp,%ebp
  jmp    L90
  xchg   %ax,%ax
L26:
  lea    0x1(%rbx),%rdx
  cmp    %rdx,%rcx
  je     L123
L40:
  movzbl 0x1(%rbx),%eax
  mov    %rdx,%rbx
L90:
  cmp    $0x7b,%al
  je     L8
  jg     L207
  cmp    $0x5c,%al
  je     L35
  jg     L26
  cmp    $0xd,%al
  jle    L159
  sub    $0x20,%eax
  cmp    $0x3b,%al
  ja     L26
  bt     %rax,%r13
  jae    L26
  or     $0x2,%ebp
  nopl   0x0(%rax)
L192:
  lea    0x1(%rbx),%rdx
  cmp    %rdx,%rcx
  jne    L40
  nopl   0x0(%rax)
L123:
  test   %r12d,%r12d
  mov    $0x5,%eax
  cmovne %eax,%ebp
L79:
  mov    %ebp,(%r15)
  sub    %r14,%rdx
  lea    0x2(%rdx,%rdx,1),%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L159:
  cmp    $0x8,%al
  jle    L26
  or     $0x2,%ebp
  jmp    L192
  nopl   (%rax)
L207:
  cmp    $0x7d,%al
  jne    L26
  mov    %ebp,%eax
  or     $0x5,%eax
  sub    $0x1,%r12d
  cmovs  %eax,%ebp
  jmp    L26
  nopl   0x0(%rax)
L35:
  lea    0x1(%rbx),%rdx
  cmp    %rdx,%rcx
  je     L139
  cmpb   $0xa,0x1(%rbx)
  je     L183
  mov    %rbx,%rdi
  lea    0x14(%rsp),%rsi
  xor    %eax,%eax
  mov    %rcx,0x8(%rsp)
  call   <Tcl_Backslash@plt>
  movslq 0x14(%rsp),%rax
  mov    0x8(%rsp),%rcx
  or     $0x2,%ebp
  lea    -0x1(%rbx,%rax,1),%rbx
  jmp    L26
  nopw   0x0(%rax,%rax,1)
L8:
  add    $0x1,%r12d
  jmp    L26
  nopl   0x0(%rax)
L183:
  mov    $0x5,%ebp
  mov    %rdx,%rbx
  or     $0x2,%ebp
  jmp    L192
L139:
  mov    $0x5,%ebp
  jmp    L123
  nopw   0x0(%rax,%rax,1)
L140:
  mov    %r14,%rdx
  mov    $0x2,%ebp
  jmp    L79
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D6
data_type: string

tool: 

assistant: ```c
int Tcl_ScanCountedElement(string, length, flagPtr) const char *string;
int length;
int *flagPtr;
{
  int flags, nestingLevel;
  const char *p, *lastChar;
  nestingLevel = 0;
  flags = 0;
  if (string == 0) {
    string = "";
  }
  if (length == -1) {
    length = strlen(string);
  }
  lastChar = string + length;
  p = string;
  if ((p == lastChar) || (*p == '{') || (*p == '"')) {
    flags |= 2;
  }
  for (; p != lastChar; p++) {
    switch (*p) {
    case '{':
      nestingLevel++;
      break;
    case '}':
      nestingLevel--;
      if (nestingLevel < 0) {
        flags |= 1 | 4;
      }
      break;
    case '[':
    case '$':
    case ';':
    case ' ':
    case '\f':
    case '\n':
    case '\r':
    case '\t':
    case '\v':
      flags |= 2;
      break;
    case '\\':
      if ((p + 1 == lastChar) || (p[1] == '\n')) {
        flags = 1 | 4;
      } else {
        int size;
        (void)Tcl_Backslash(p, &size);
        p += size - 1;
        flags |= 2;
      }
      break;
    }
  }
  if (nestingLevel != 0) {
    flags = 1 | 4;
  }
  *flagPtr = flags;
  return 2 * (p - string) + 2;
}
```