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

```asm
<G_AllocCreateNamesList>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x4a0,%rsp
  mov    %rdi,-0x488(%rbp)
  mov    %rsi,-0x490(%rbp)
  mov    %edx,%eax
  mov    %al,-0x494(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x490(%rbp)
  je     L88
  cmpq   $0x0,-0x488(%rbp)
  jne    L204
L88:
  mov    $0x0,%eax
  jmp    L198
L204:
  mov    -0x490(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L200
  mov    -0x490(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x1,%rax
  ja     L30
L200:
  mov    $0x0,%eax
  jmp    L198
L30:
  mov    -0x490(%rbp),%rsi
  mov    -0x488(%rbp),%rax
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,-0x470(%rbp)
  cmpl   $0x0,-0x470(%rbp)
  jne    L83
  mov    $0x0,%eax
  jmp    L198
L83:
  movzbl -0x494(%rbp),%eax
  mov    %al,-0x452(%rbp)
  movb   $0x0,-0x451(%rbp)
  movl   $0x0,-0x480(%rbp)
  movl   $0x0,-0x478(%rbp)
  movl   $0x0,-0x46c(%rbp)
  movl   $0x0,-0x474(%rbp)
L246:
  mov    -0x470(%rbp),%edi
  mov    -0x480(%rbp),%ecx
  lea    -0x410(%rbp),%rdx
  mov    -0x490(%rbp),%rsi
  mov    -0x488(%rbp),%rax
  mov    %edi,%r9d
  mov    %ecx,%r8d
  mov    $0x400,%ecx
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,-0x47c(%rbp)
  cmpl   $0x0,-0x47c(%rbp)
  jne    L163
  addl   $0x1,-0x480(%rbp)
  jmp    L118
L163:
  mov    -0x47c(%rbp),%eax
  add    %eax,-0x480(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x468(%rbp)
  jmp    L191
L168:
  mov    -0x468(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x46c(%rbp)
  mov    -0x488(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    -0x46c(%rbp),%eax
  cltq
  add    %rdx,%rax
  add    $0x1,%rax
  cmp    $0x3f,%rax
  jbe    L136
  mov    -0x468(%rbp),%rax
  mov    %rax,%rsi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Com_Printf@plt>
  jmp    L78
L136:
  mov    -0x468(%rbp),%rcx
  lea    -0x450(%rbp),%rax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Q_strncpyz@plt>
  lea    -0x450(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <COM_StripExtension@plt>
  lea    -0x450(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x474(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x474(%rbp)
  addl   $0x1,-0x478(%rbp)
L78:
  subl   $0x1,-0x47c(%rbp)
  mov    -0x46c(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x468(%rbp)
L191:
  cmpl   $0x0,-0x47c(%rbp)
  jg     L168
L118:
  mov    -0x480(%rbp),%eax
  cmp    -0x470(%rbp),%eax
  jl     L246
  cmpl   $0x0,-0x478(%rbp)
  jne    L238
  mov    $0x0,%eax
  jmp    L198
L238:
  addl   $0x1,-0x474(%rbp)
  mov    -0x474(%rbp),%eax
  mov    $0x204,%edx
  lea    D10(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <trap_MemAlloc@plt>
  cltq
  mov    %rax,-0x460(%rbp)
  movl   $0x0,-0x480(%rbp)
  movl   $0x0,-0x46c(%rbp)
L172:
  mov    -0x470(%rbp),%edi
  mov    -0x480(%rbp),%ecx
  lea    -0x410(%rbp),%rdx
  mov    -0x490(%rbp),%rsi
  mov    -0x488(%rbp),%rax
  mov    %edi,%r9d
  mov    %ecx,%r8d
  mov    $0x400,%ecx
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,-0x47c(%rbp)
  cmpl   $0x0,-0x47c(%rbp)
  jne    L142
  addl   $0x1,-0x480(%rbp)
  jmp    L36
L142:
  mov    -0x47c(%rbp),%eax
  add    %eax,-0x480(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x468(%rbp)
  jmp    L223
L1:
  mov    -0x468(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x46c(%rbp)
  mov    -0x488(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    -0x46c(%rbp),%eax
  cltq
  add    %rdx,%rax
  add    $0x1,%rax
  cmp    $0x3f,%rax
  ja     L182
  mov    -0x468(%rbp),%rcx
  lea    -0x450(%rbp),%rax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Q_strncpyz@plt>
  lea    -0x450(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <COM_StripExtension@plt>
  mov    -0x474(%rbp),%edx
  lea    -0x450(%rbp),%rcx
  mov    -0x460(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Q_strncatz@plt>
  mov    -0x474(%rbp),%edx
  lea    -0x452(%rbp),%rcx
  mov    -0x460(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Q_strncatz@plt>
  jmp    L2
L182:
  nop
L2:
  subl   $0x1,-0x47c(%rbp)
  mov    -0x46c(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x468(%rbp)
L223:
  cmpl   $0x0,-0x47c(%rbp)
  jg     L1
L36:
  mov    -0x480(%rbp),%eax
  cmp    -0x470(%rbp),%eax
  jl     L172
  mov    -0x460(%rbp),%rax
L198:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D1
datatype: string
name: retrieve_data
arguments: tag: D10
datatype: string

tool: D1: Warning: G_AllocCreateNamesList :file name too long: %s


tool: D10: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ptitSeb/warsow-pandora/refs/heads/master/game/g_utils.c

assistant: ```c
char *G_AllocCreateNamesList(const char *path, const char *extension, const char separator) {
  char separators[2];
  char name[64];
  char buffer[1024], *s, *list;
  int numfiles, i, j, found, length, fulllength;
  if (!extension || !path)
    return ((void *)0);
  if (extension[0] != '.' || strlen(extension) < 2)
    return ((void *)0);
  if ((numfiles = trap_FS_GetFileList(path, extension, ((void *)0), 0, 0, 0)) == 0)
    return ((void *)0);
  separators[0] = separator;
  separators[1] = 0;
  i = 0;
  found = 0;
  length = 0;
  fulllength = 0;
  do {
    if ((j = trap_FS_GetFileList(path, extension, buffer, sizeof(buffer), i, numfiles)) == 0) {
      i++;
      continue;
    }
    i += j;
    for (s = buffer; j > 0; j--, s += length + 1) {
      length = strlen(s);
      if (strlen(path) + 1 + length >= 64) {
        Com_Printf("Warning: G_AllocCreateNamesList :file name too long: %s\n", s);
        continue;
      }
      Q_strncpyz(name, s, sizeof(name));
      COM_StripExtension(name);
      fulllength += strlen(name) + 1;
      found++;
    }
  } while (i < numfiles);
  if (!found)
    return ((void *)0);
  fulllength += 1;
  list = trap_MemAlloc(fulllength, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ptitSeb/warsow-pandora/refs/heads/master/game/g_utils.c", 516);
  i = 0;
  length = 0;
  do {
    if ((j = trap_FS_GetFileList(path, extension, buffer, sizeof(buffer), i, numfiles)) == 0) {
      i++;
      continue;
    }
    i += j;
    for (s = buffer; j > 0; j--, s += length + 1) {
      length = strlen(s);
      if (strlen(path) + 1 + length >= 64)
        continue;
      Q_strncpyz(name, s, sizeof(name));
      COM_StripExtension(name);
      Q_strncatz(list, name, fulllength);
      Q_strncatz(list, separators, fulllength);
    }
  } while (i < numfiles);
  return list;
}
```