user: What is the c source code of the assembly code below:

```asm
<check_str_2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L264
  mov    %rdi,%r13
  mov    %rsi,%r14
  mov    %rdx,%r12
  mov    %rcx,%r9
  mov    %r8d,%r15d
  test   %rdx,%rdx
  je     L88
  movb   $0x0,(%rdx)
L88:
  test   %r15d,%r15d
  je     L158
  mov    $0x10000,%edi
  mov    %r9,-0x50(%rbp)
  call   <alloca@plt>
  mov    $0x10000,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %rax,-0x48(%rbp)
  call   <memset@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x4(,%rax,4),%edi
  call   <alloca@plt>
  mov    %r13,%rsi
  mov    %rax,%r15
  mov    %rax,%rdi
  call   <utf8_to_ucs4_str@plt>
  mov    (%r15),%ebx
  test   %ebx,%ebx
  je     L264
  mov    -0x50(%rbp),%r9
  mov    -0x48(%rbp),%r8
  mov    $0xffffffff,%r13d
  xor    %eax,%eax
  jmp    L287
  nopl   (%rax)
L112:
  cmpb   $0x0,0xff(%r14)
  jne    L141
  movslq %ebx,%rdx
  cmp    $0xffff,%ebx
  jle    L61
  nopl   (%rax)
L45:
  mov    $0x3f,%edx
  mov    $0x3f,%ebx
L61:
  cmp    %ebx,%r13d
  movb   $0x1,(%r8,%rdx,1)
  mov    $0xffffffff,%eax
  cmovl  %ebx,%r13d
L141:
  mov    0x4(%r15),%ebx
  add    $0x4,%r15
  test   %ebx,%ebx
  je     L269
L287:
  test   %ebx,%ebx
  js     L45
  cmp    $0x7f,%ebx
  jg     L112
  movslq %ebx,%rdx
  cmpb   $0x0,(%r14,%rdx,1)
  jne    L141
  cmp    $0x1f,%ebx
  jg     L61
  jmp    L45
  nopl   (%rax)
L158:
  mov    $0x100,%edi
  call   <alloca@plt>
  mov    $0x100,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <memset@plt>
  movzbl 0x0(%r13),%eax
  test   %al,%al
  je     L264
  nopl   0x0(%rax)
L49:
  cmpb   $0x0,(%r14,%rax,1)
  jne    L257
  movb   $0x1,(%rbx,%rax,1)
  mov    $0xffffffff,%r15d
L257:
  movzbl 0x1(%r13),%eax
  add    $0x1,%r13
  test   %al,%al
  jne    L49
  test   %r15d,%r15d
  jns    L87
  test   %r12,%r12
  je     L87
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L237:
  cmpb   $0x0,(%rbx,%rax,1)
  je     L44
  mov    %al,(%r12)
  add    $0x1,%r12
L44:
  add    $0x1,%rax
  cmp    $0x100,%rax
  jne    L237
  movb   $0x0,(%r12)
  mov    $0xffffffff,%eax
L50:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L192
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  xchg   %ax,%ax
L269:
  test   %eax,%eax
  jns    L50
  test   %r12,%r12
  je     L50
  mov    %r9,-0x50(%rbp)
  mov    %r8,-0x48(%rbp)
  cmp    $0x1f,%r13d
  jle    L122
  lea    0x1(%r13),%r14d
  lea    0x0(,%r14,4),%edi
  call   <alloca@plt>
  mov    -0x48(%rbp),%r8
  mov    -0x50(%rbp),%r9
  mov    %rax,%r10
L65:
  movslq %r14d,%rcx
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L32:
  cmpb   $0x0,(%r8,%rdx,1)
  je     L36
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%r10,%rax,4)
L36:
  add    $0x1,%rdx
  cmp    %rdx,%rcx
  jne    L32
  movslq %ebx,%rbx
  lea    (%r10,%rbx,4),%rax
L225:
  movl   $0x0,(%rax)
  mov    %r10,%rdx
  mov    %r9,%rsi
  mov    %r12,%rdi
  call   <ucs4_to_utf8_str@plt>
  mov    $0xffffffff,%eax
  jmp    L50
  nop
L264:
  xor    %eax,%eax
  jmp    L50
L122:
  lea    D4(%rip),%rcx
  mov    $0x34f,%esi
  lea    0x1(%r13),%r14d
  lea    D25(%rip),%rdx
  lea    D8(%rip),%rdi
  call   <swerr@plt>
  lea    0x0(,%r14,4),%edi
  call   <alloca@plt>
  cmp    $0xffffffff,%r13d
  mov    -0x48(%rbp),%r8
  mov    -0x50(%rbp),%r9
  mov    %rax,%r10
  jne    L65
  jmp    L225
L87:
  mov    %r15d,%eax
  jmp    L50
L192:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D4
type_guessed: string
name: parse_data
arguments: tag: D25
type_guessed: string
name: parse_data
arguments: tag: D8
type_guessed: string

tool: D4: maxinv >= ' '

tool: D25: assertion failed: %s

tool: D8: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/stden/ejudge/refs/heads/master/misctext.c

assistant: ```c
int check_str_2(const unsigned char *str, const unsigned char *map, unsigned char *invchars, size_t invsize, int utf8_flag) {
  unsigned char *invset;
  unsigned char *p = invchars;
  int retval = 0, i, slen, *wstr, maxinv = -1, invc, *ibuf, j;
  if (!str)
    return 0;
  if (p)
    *p = 0;
  if (!utf8_flag) {
    invset = (unsigned char *)alloca(256);
    memset(invset, 0, 256);
    for (; *str; str++)
      if (!map[*str]) {
        invset[*str] = 1;
        retval = -1;
      }
    if (retval >= 0 || !p)
      return retval;
    for (i = 0; i < 256; i++)
      if (invset[i])
        *p++ = i;
    *p = 0;
  } else {
    invset = (unsigned char *)alloca(65536);
    memset(invset, 0, 65536);
    slen = strlen(str);
    wstr = (int *)alloca((slen + 1) * sizeof(wstr[0]));
    utf8_to_ucs4_str(wstr, str);
    for (; *wstr; wstr++) {
      invc = -1;
      if (*wstr < 0) {
        invc = '?';
      } else if (*wstr >= 128) {
        if (!map[255]) {
          if (*wstr >= 65536)
            invc = '?';
          else
            invc = *wstr;
        }
      } else if (!map[*wstr]) {
        if (*wstr < 32)
          invc = '?';
        else
          invc = *wstr;
      }
      if (invc > 0) {
        invset[invc] = 1;
        retval = -1;
        if (invc > maxinv)
          maxinv = invc;
      }
    }
    if (retval >= 0 || !p)
      return retval;
    do {
      if (!(maxinv >= ' '))
        swerr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/stden/ejudge/refs/heads/master/misctext.c", 847, "assertion failed: %s", "maxinv >= ' '");
    } while (0);
    ibuf = (int *)alloca((maxinv + 1) * sizeof(ibuf[0]));
    for (i = 0, j = 0; i <= maxinv; i++)
      if (invset[i])
        ibuf[j++] = i;
    ibuf[j++] = 0;
    ucs4_to_utf8_str(invchars, invsize, ibuf);
  }
  return retval;
}
```