user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mesg_args>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x58,%rsp
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  xor    %r12d,%r12d
  movzbl 0x2090(%rsp),%r13d
  mov    %rsi,0x30(%rsp)
  lea    0x40(%rsp),%r15
  mov    $0x2000,%esi
  mov    %rdx,0x20(%rsp)
  mov    %rdi,%rdx
  mov    %cl,0x18(%rsp)
  mov    %r8b,0x10(%rsp)
  mov    %r9b,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x2048(%rsp)
  xor    %eax,%eax
  mov    %rdi,(%rsp)
  mov    %r15,%rdi
  mov    %r15,0x28(%rsp)
  call   <strcpyn@plt>
  mov    0x2098(%rsp),%eax
  mov    %r15,%rdx
  mov    (%rsp),%r10
  movzbl 0x18(%rsp),%ecx
  movzbl 0x10(%rsp),%r8d
  xor    %r15d,%r15d
  movzbl 0x8(%rsp),%r9d
  lea    -0x1(%rax),%r11d
  jmp    L146
  nopl   0x0(%rax)
L151:
  test   %r12d,%r12d
  jne    L54
  cmp    %cl,%al
  je     L39
  cmp    %r9b,%al
  je     L188
  test   %r14d,%r14d
  jg     L54
  xor    %r14d,%r14d
  cmp    %r8b,%al
  je     L192
  nopw   0x0(%rax,%rax,1)
L54:
  add    $0x1,%ebx
  cmp    $0x1ffd,%ebx
  jg     L93
L146:
  movslq %ebx,%rbp
  movzbl 0x40(%rsp,%rbp,1),%eax
  test   %al,%al
  je     L133
  cmp    $0x5c,%al
  je     L58
  cmp    %r13b,%al
  jne    L151
  add    $0x1,%ebx
  xor    $0x1,%r12d
  cmp    $0x1ffd,%ebx
  jle    L146
  nopl   0x0(%rax,%rax,1)
L93:
  mov    0x30(%rsp),%rsi
  mov    %r10,%rdi
  movb   $0x0,0x203f(%rsp)
  call   <strcpyn@plt>
L88:
  mov    0x2048(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L207
  add    $0x2058,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L58:
  add    $0x1,%ebx
  jmp    L54
  nopl   0x0(%rax,%rax,1)
L188:
  sub    $0x1,%r14d
  jae    L54
  mov    0x20(%rsp),%rsi
  movslq %r15d,%rax
  mov    %r10,0x8(%rsp)
  add    $0x1,%r15d
  mov    %rdx,(%rsp)
  lea    (%rsi,%rax,8),%rbx
  movb   $0x0,0x40(%rsp,%rbp,1)
  mov    (%rbx),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%r14
  mov    (%rsp),%rdx
  mov    %r14,%rax
  sub    %rdx,%rax
  lea    0x1(%rax,%rbp,1),%r12
  mov    %r12,%rdi
  call   <malloc@plt>
  mov    (%rsp),%rdx
  mov    %r12,%rsi
  mov    %rax,(%rbx)
  mov    %rax,%rdi
  call   <strcpyn@plt>
  mov    0x8(%rsp),%r10
  lea    0x1(%r14,%rbp,1),%rdx
  jmp    L93
  nopl   (%rax)
L192:
  cmp    %r15d,%r11d
  jle    L54
  mov    0x20(%rsp),%rsi
  movslq %r15d,%rax
  mov    %r11d,0x3c(%rsp)
  add    $0x1,%r15d
  mov    %r9b,0x3b(%rsp)
  lea    (%rsi,%rax,8),%rax
  mov    %r8b,0x3a(%rsp)
  mov    (%rax),%rdi
  mov    %cl,0x39(%rsp)
  mov    %r10,0x18(%rsp)
  mov    %rdx,0x8(%rsp)
  movb   $0x0,0x40(%rsp,%rbp,1)
  mov    %rax,(%rsp)
  call   <free@plt>
  mov    0x8(%rsp),%rdx
  mov    0x28(%rsp),%rax
  sub    %rdx,%rax
  mov    %rdx,0x10(%rsp)
  lea    0x1(%rax,%rbp,1),%rsi
  mov    %rsi,%rdi
  mov    %rsi,0x8(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%rsi
  mov    0x10(%rsp),%rdx
  mov    %rax,%rdi
  mov    %rax,(%rsi)
  mov    0x8(%rsp),%rsi
  call   <strcpyn@plt>
  mov    0x28(%rsp),%rax
  mov    0x3c(%rsp),%r11d
  movzbl 0x3b(%rsp),%r9d
  movzbl 0x3a(%rsp),%r8d
  movzbl 0x39(%rsp),%ecx
  mov    0x18(%rsp),%r10
  lea    0x1(%rax,%rbp,1),%rdx
  jmp    L54
  xchg   %ax,%ax
L39:
  add    $0x1,%r14d
  jmp    L54
  nopl   0x0(%rax)
L133:
  test   %r15d,%r15d
  je     L174
  mov    0x20(%rsp),%rbx
  lea    -0x1(%r15),%eax
  lea    0x8(%rbx,%rax,8),%rbp
  nopl   0x0(%rax,%rax,1)
L89:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <free@plt>
  cmp    %rbp,%rbx
  jne    L89
L174:
  mov    $0xffffffff,%r15d
  jmp    L88
L207:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int mesg_args(char *wbuf, size_t maxlen, char **argv, char ulv, char sep, char dlv, char quot, int maxargs) {
  int argc = 0;
  char buf[((2048) * 4)];
  char *ptr;
  int litflag = 0;
  strcpyn(buf, sizeof(buf), wbuf);
  ptr = buf;
  for (int lev = 0, r = 0; (r < (((2048) * 4) - 2)); r++) {
    if (buf[r] == '\0') {
      for (int i = 0; i < argc; ++i) {
        free(argv[i]);
      }
      return (-1);
    } else if (buf[r] == '\\') {
      r++;
      continue;
    } else if (buf[r] == quot) {
      litflag = (!litflag);
    } else if (!litflag && buf[r] == ulv) {
      lev++;
      continue;
    } else if (!litflag && buf[r] == dlv) {
      lev--;
      if (lev < 0) {
        buf[r] = '\0';
        free(argv[argc]);
        argv[argc] = NULL;
        argv[argc] = malloc((size_t)((buf + r) - ptr) + 1);
        strcpyn(argv[argc++], (size_t)((buf + r) - ptr) + 1, ptr);
        ptr = buf + r + 1;
        break;
      }
      continue;
    } else if (!litflag && lev < 1 && buf[r] == sep) {
      if (argc < maxargs - 1) {
        buf[r] = '\0';
        free(argv[argc]);
        argv[argc] = NULL;
        argv[argc] = malloc((size_t)((buf + r) - ptr) + 1);
        strcpyn(argv[argc++], (size_t)((buf + r) - ptr) + 1, ptr);
        ptr = buf + r + 1;
      }
    }
  }
  buf[((2048) * 4) - 1] = '\0';
  strcpyn(wbuf, maxlen, ptr);
  return argc;
}
```