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

```asm
<quote_cmdline>:
  endbr64
  push   %r15
  lea    D1(%rip),%r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x28,%rsp
  mov    %rdi,0x10(%rsp)
  mov    0x60(%rsp),%eax
  xor    %edi,%edi
  cmp    $0xffffffff,%r9d
  setne  %dil
  mov    %edx,0x18(%rsp)
  mov    %ecx,0xc(%rsp)
  mov    %r8,(%rsp)
  mov    %eax,0x8(%rsp)
  call   <assert@plt>
  cmp    %ebp,%ebx
  je     L149
  nopl   0x0(%rax)
L123:
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%edx
  mov    %ebp,%eax
  xor    %r14d,%r14d
  lea    (%rcx,%rax,8),%rbx
  test   %edx,%edx
  je     L8
  jmp    L15
  nopw   0x0(%rax,%rax,1)
L188:
  mov    %al,0x0(%r13)
  add    $0x1,%r13
L132:
  add    $0x1,%r14d
L8:
  mov    (%rbx),%rdi
  call   <strlen@plt>
  cmp    %r14d,%eax
  jbe    L144
  mov    (%rbx),%rsi
  mov    %r14d,%eax
  movzbl (%rsi,%rax,1),%eax
  cmp    $0x27,%al
  jne    L188
  test   %r14d,%r14d
  je     L50
  lea    -0x1(%r14),%eax
  cmpb   $0x27,(%rsi,%rax,1)
  je     L83
L50:
  movl   $0x222722,0x0(%r13)
L101:
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %eax,%eax
  add    %rax,%r13
  jmp    L132
L146:
  test   %r14d,%r14d
  je     L144
  movb   $0x27,0x0(%r13)
  add    $0x1,%r13
L144:
  mov    (%rbx),%rdi
  call   <strlen@plt>
  test   %eax,%eax
  je     L41
  mov    $0x20,%ecx
  mov    %r13,%rdi
  add    $0x1,%ebp
  mov    %cx,0x0(%r13)
  call   <strlen@plt>
  mov    (%rbx),%rdx
  mov    %r12,%rdi
  mov    %r15,%rsi
  mov    %eax,%eax
  add    %rax,%r13
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%eax
  add    %rax,%r12
  cmp    0xc(%rsp),%ebp
  jne    L123
L149:
  mov    0x10(%rsp),%rdi
  call   <strlen@plt>
  xor    %edi,%edi
  cmp    %eax,0x18(%rsp)
  sete   %dil
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <assert@plt>
  nop
L83:
  mov    $0x2227,%eax
  sub    $0x1,%r13
  movb   $0x0,0x2(%r13)
  mov    %ax,0x0(%r13)
  jmp    L101
  nopl   0x0(%rax,%rax,1)
L41:
  mov    $0x2727,%esi
  movb   $0x0,0x2(%r13)
  mov    %r13,%rdi
  add    $0x1,%ebp
  mov    %si,0x0(%r13)
  call   <strlen@plt>
  mov    $0x20,%edi
  mov    %eax,%edx
  add    %rdx,%r13
  mov    %di,0x0(%r13)
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    (%rbx),%rdx
  mov    %r12,%rdi
  mov    %r15,%rsi
  mov    %eax,%ecx
  xor    %eax,%eax
  add    %rcx,%r13
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%eax
  add    %rax,%r12
  cmp    %ebp,0xc(%rsp)
  jne    L123
  jmp    L149
L15:
  xor    %esi,%esi
L212:
  mov    (%rbx),%rdi
  mov    %esi,0x1c(%rsp)
  call   <strlen@plt>
  mov    0x1c(%rsp),%esi
  cmp    %esi,%eax
  jbe    L146
  mov    (%rbx),%rax
  mov    %esi,%edi
  movzbl (%rax,%rdi,1),%eax
  cmp    $0x27,%al
  je     L228
  lea    0x1(%r13),%r8
  cmp    $0x1,%r14d
  je     L47
  movb   $0x27,0x0(%r13)
  mov    (%rbx),%rax
  add    $0x2,%r13
  mov    $0x1,%r14d
  movzbl (%rax,%rdi,1),%eax
  mov    %al,-0x1(%r13)
L52:
  add    $0x1,%esi
  jmp    L212
L47:
  mov    %al,0x0(%r13)
  mov    %r8,%r13
  jmp    L52
L228:
  test   %r14d,%r14d
  je     L84
  movb   $0x27,0x0(%r13)
  add    $0x1,%r13
L84:
  test   %esi,%esi
  je     L205
  mov    (%rbx),%rdx
  lea    -0x1(%rsi),%eax
  cmpb   $0x27,(%rdx,%rax,1)
  je     L57
L205:
  movl   $0x222722,0x0(%r13)
L213:
  mov    %r13,%rdi
  mov    %esi,0x1c(%rsp)
  xor    %r14d,%r14d
  call   <strlen@plt>
  mov    0x1c(%rsp),%esi
  mov    %eax,%eax
  add    %rax,%r13
  jmp    L52
L57:
  sub    $0x1,%r13
  movw   $0x2227,0x0(%r13)
  movb   $0x0,0x2(%r13)
  jmp    L213
```

tool_calls: name: parse_data
arguments: data_label: D1
data_type: string

tool: D1: %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));
}
```