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

```asm
<quote_cmdline>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x10(%rsp)
  xor    %edi,%edi
  cmp    $0xffffffff,%r9d
  mov    0x60(%rsp),%ebx
  setne  %dil
  mov    %edx,0x1c(%rsp)
  mov    %ecx,0x18(%rsp)
  mov    %r8,0x8(%rsp)
  call   <assert@plt>
  cmp    %ebp,%r15d
  je     L133
  mov    %ebp,0x4(%rsp)
L140:
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rsi
  xor    %r15d,%r15d
  xor    %r13d,%r13d
  lea    (%rsi,%rax,8),%rbp
  jmp    L119
  nopl   (%rax)
L35:
  lea    0x1(%r14),%rcx
  test   $0x1,%r15b
  jne    L91
  test   %ebx,%ebx
  je     L91
  movb   $0x27,(%r14)
  mov    0x0(%rbp),%rax
  add    $0x2,%r14
  mov    $0x1,%r15d
  movzbl (%rax,%rdx,1),%eax
  mov    %al,-0x1(%r14)
L7:
  add    $0x1,%r13d
L119:
  mov    0x0(%rbp),%rdi
  call   <strlen@plt>
  cmp    %r13d,%eax
  jbe    L12
  mov    0x0(%rbp),%rax
  mov    %r13d,%edx
  movzbl (%rax,%rdx,1),%eax
  cmp    $0x27,%al
  jne    L35
  test   %r15d,%r15d
  je     L56
  movb   $0x27,(%r14)
  add    $0x1,%r14
L56:
  test   %r13d,%r13d
  je     L154
  mov    0x0(%rbp),%rdx
  lea    -0x1(%r13),%eax
  cmpb   $0x27,(%rdx,%rax,1)
  je     L93
L154:
  movl   $0x222722,(%r14)
L23:
  mov    %r14,%rdi
  xor    %r15d,%r15d
  call   <strlen@plt>
  mov    %eax,%eax
  add    %rax,%r14
  jmp    L7
  xchg   %ax,%ax
L91:
  mov    %al,(%r14)
  test   %ebx,%ebx
  mov    $0x1,%eax
  mov    %rcx,%r14
  cmovne %eax,%r15d
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L12:
  test   %r15d,%r15d
  je     L6
  movb   $0x27,(%r14)
  add    $0x1,%r14
L6:
  mov    0x0(%rbp),%rdi
  call   <strlen@plt>
  test   %eax,%eax
  je     L4
L118:
  mov    $0x20,%eax
  mov    %r14,%rdi
  mov    %ax,(%r14)
  call   <strlen@plt>
  mov    0x0(%rbp),%rdx
  mov    %r12,%rdi
  lea    D2(%rip),%rsi
  mov    %eax,%eax
  add    %rax,%r14
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  addl   $0x1,0x4(%rsp)
  mov    %eax,%eax
  add    %rax,%r12
  mov    0x4(%rsp),%eax
  cmp    %eax,0x18(%rsp)
  jne    L140
L133:
  mov    0x10(%rsp),%rdi
  call   <strlen@plt>
  xor    %edi,%edi
  cmp    %eax,0x1c(%rsp)
  sete   %dil
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <assert@plt>
  nopl   0x0(%rax,%rax,1)
L93:
  mov    $0x2227,%ecx
  sub    $0x1,%r14
  movb   $0x0,0x2(%r14)
  mov    %cx,(%r14)
  jmp    L23
  nopw   0x0(%rax,%rax,1)
L4:
  mov    $0x2727,%edx
  movb   $0x0,0x2(%r14)
  mov    %r14,%rdi
  mov    %dx,(%r14)
  call   <strlen@plt>
  mov    %eax,%eax
  add    %rax,%r14
  jmp    L118
```

tool_calls: name: retrieve_data
arguments: label: D2
type_guessed: string

tool: D2: %s 

assistant: ```c
void quote_cmdline(char *command_line, char *window_title, int len, int argc, char **argv, int index, bool want_extra_quotes) {
  assert(index != -1);
  unsigned i, j;
  unsigned argcnt = argc - index;
  bool in_quotes = false;
  char *ptr1 = command_line;
  char *ptr2 = window_title;
  for (i = 0; i < argcnt; i++) {
    in_quotes = false;
    for (j = 0; j < strlen(argv[i + index]); j++) {
      if (argv[i + index][j] == '\'') {
        if (in_quotes) {
          ptr1[0] = '\'';
          ptr1++;
        }
        if (j > 0 && argv[i + index][j - 1] == '\'') {
          ptr1--;
          sprintf(ptr1, "\'\"");
        } else {
          sprintf(ptr1, "\"\'\"");
        }
        ptr1 += strlen(ptr1);
        in_quotes = false;
      } else {
        if (!in_quotes && want_extra_quotes) {
          ptr1[0] = '\'';
          ptr1++;
        }
        ptr1[0] = argv[i + index][j];
        ptr1++;
        if (want_extra_quotes)
          in_quotes = true;
      }
    }
    if (in_quotes) {
      ptr1[0] = '\'';
      ptr1++;
    }
    if (strlen(argv[i + index]) == 0) {
      sprintf(ptr1, "\'\'");
      ptr1 += strlen(ptr1);
    }
    sprintf(ptr1, " ");
    ptr1 += strlen(ptr1);
    sprintf(ptr2, "%s ", argv[i + index]);
    ptr2 += strlen(ptr2);
  }
  assert((unsigned)len == strlen(command_line));
}
```