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

```asm
<G_AllocCreateNamesList>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x498,%rsp
  mov    %rdi,(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x488(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L244
  mov    %rdi,%r15
  mov    %edx,%ebx
  test   %rdi,%rdi
  je     L244
  mov    $0x0,%ebp
  mov    %rsi,%r14
  cmpb   $0x2e,(%rsi)
  jne    L65
  mov    %rsi,%rdi
  call   <strlen@plt>
  cmp    $0x1,%rax
  jbe    L65
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %r14,%rsi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,0x28(%rsp)
  test   %eax,%eax
  je     L107
  mov    %bl,0x3e(%rsp)
  movb   $0x0,0x3f(%rsp)
  mov    $0x0,%r15d
  mov    $0x0,%r14d
  movl   $0x0,0x8(%rsp)
  jmp    L224
L21:
  add    %eax,0x8(%rsp)
  test   %eax,%eax
  jle    L103
  lea    0x80(%rsp),%r12
  jmp    L204
L180:
  mov    %r12,%rsi
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <Com_Printf@plt>
L117:
  lea    0x1(%r12,%rbx,1),%r12
  sub    $0x1,%ebp
  je     L103
L204:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  mov    (%rsp),%rdi
  call   <strlen@plt>
  movslq %ebx,%rbx
  lea    0x1(%rbx,%rax,1),%rax
  cmp    $0x3f,%rax
  ja     L180
  lea    0x40(%rsp),%r13
  mov    $0x40,%edx
  mov    %r12,%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <Q_strncpyz@plt>
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <COM_StripExtension@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x1(%r15,%rax,1),%r15d
  add    $0x1,%r14d
  jmp    L117
L103:
  mov    0x28(%rsp),%ecx
  cmp    %ecx,0x8(%rsp)
  jge    L142
L224:
  lea    0x80(%rsp),%rdx
  mov    0x28(%rsp),%r9d
  mov    0x8(%rsp),%ebx
  mov    %ebx,%r8d
  mov    $0x400,%ecx
  mov    0x10(%rsp),%rsi
  mov    (%rsp),%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L21
  add    $0x1,%ebx
  mov    %ebx,0x8(%rsp)
  jmp    L103
L142:
  mov    $0x0,%ebp
  test   %r14d,%r14d
  je     L65
  lea    0x1(%r15),%eax
  mov    %eax,0x2c(%rsp)
  mov    $0x204,%edx
  lea    D3(%rip),%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <trap_MemAlloc@plt>
  movslq %eax,%rbp
  mov    $0x0,%r15d
  lea    0x80(%rsp),%rax
  mov    %rax,0x20(%rsp)
  lea    0x40(%rsp),%r14
  lea    0x3e(%rsp),%rax
  mov    %rax,0x18(%rsp)
  mov    %rbp,0x8(%rsp)
  mov    (%rsp),%r13
  jmp    L179
L31:
  add    %eax,%r15d
  test   %eax,%eax
  jle    L102
  lea    0x80(%rsp),%r12
  mov    %r15d,(%rsp)
  mov    0x2c(%rsp),%r15d
  jmp    L162
L39:
  lea    0x1(%r12,%rbx,1),%r12
  sub    $0x1,%ebp
  je     L100
L162:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
  mov    %r13,%rdi
  call   <strlen@plt>
  movslq %ebx,%rbx
  lea    0x1(%rbx,%rax,1),%rax
  cmp    $0x3f,%rax
  ja     L39
  mov    $0x40,%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <Q_strncpyz@plt>
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <COM_StripExtension@plt>
  mov    %r15d,%edx
  mov    %r14,%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <Q_strncatz@plt>
  mov    %r15d,%edx
  mov    0x18(%rsp),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <Q_strncatz@plt>
  jmp    L39
L100:
  mov    (%rsp),%r15d
L102:
  cmp    0x28(%rsp),%r15d
  jge    L128
L179:
  mov    0x28(%rsp),%r9d
  mov    %r15d,%r8d
  mov    $0x400,%ecx
  mov    0x20(%rsp),%rdx
  mov    0x10(%rsp),%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L31
  add    $0x1,%r15d
  jmp    L102
L128:
  mov    0x8(%rsp),%rbp
L65:
  mov    0x488(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  mov    %rbp,%rax
  add    $0x498,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L244:
  mov    $0x0,%ebp
  jmp    L65
L107:
  mov    $0x0,%ebp
  jmp    L65
L35:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D5
type_infered: string
name: read_data
arguments: data_label: D3
type_infered: string

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


tool: D3: /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;
}
```