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

```asm
<G_LayoutList>:
  endbr64
  push   %r15
  mov    $0x4e,%ecx
  pxor   %xmm0,%xmm0
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x3b8,%rsp
  mov    %rdi,0x18(%rsp)
  lea    0x20(%rsp),%rbp
  lea    0x130(%rsp),%rdi
  mov    %rsi,0x8(%rsp)
  mov    $0x100,%esi
  lea    0x120(%rsp),%r15
  mov    %edx,0x14(%rsp)
  lea    D22(%rip),%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x3a8(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x120(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  movaps %xmm0,0x40(%rsp)
  movaps %xmm0,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  rep stos %rax,%es:(%rdi)
  mov    %rbp,%rdi
  movaps %xmm0,0x70(%rsp)
  movaps %xmm0,0x80(%rsp)
  movaps %xmm0,0x90(%rsp)
  movaps %xmm0,0xa0(%rsp)
  movaps %xmm0,0xb0(%rsp)
  movaps %xmm0,0xc0(%rsp)
  movaps %xmm0,0xd0(%rsp)
  movaps %xmm0,0xe0(%rsp)
  movaps %xmm0,0xf0(%rsp)
  movaps %xmm0,0x100(%rsp)
  movaps %xmm0,0x110(%rsp)
  call   <Q_strcat@plt>
  mov    %rbx,%rsi
  lea    D30(%rip),%rdi
  xor    %eax,%eax
  call   <va@plt>
  mov    $0x280,%ecx
  mov    %r15,%rdx
  lea    D39(%rip),%rsi
  mov    %eax,%edi
  xor    %eax,%eax
  call   <trap_FS_GetFileList@plt>
  mov    %eax,0x10(%rsp)
  test   %eax,%eax
  jle    L35
  xor    %r12d,%r12d
  xor    %ebx,%ebx
  xchg   %ax,%ax
L20:
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <strlen@plt>
  cmp    $0x4,%r13d
  jle    L5
  add    %r13d,%eax
  lea    0x1(%r12),%r14d
  cmp    $0xff,%eax
  jg     L48
  mov    $0x100,%esi
  mov    %r15,%rdx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <Q_strcat@plt>
  mov    %rbp,%rdi
  mov    %r14d,%r12d
  call   <strlen@plt>
  lea    -0x4(%rax),%esi
  sub    $0x3,%eax
  movslq %esi,%rsi
  cltq
  movb   $0x20,0x20(%rsp,%rsi,1)
  movb   $0x0,0x20(%rsp,%rax,1)
L5:
  movslq %r13d,%rcx
  add    $0x1,%ebx
  lea    0x1(%r15,%rcx,1),%r15
  cmp    %ebx,0x10(%rsp)
  jne    L20
  lea    0x1(%r12),%r14d
L48:
  mov    0x10(%rsp),%eax
  cmp    %r12d,%eax
  je     L58
  mov    0x18(%rsp),%rcx
  mov    %eax,%edx
  xor    %eax,%eax
  mov    %r12d,%esi
  lea    D2(%rip),%rdi
  call   <G_Printf@plt>
L58:
  mov    0x14(%rsp),%edx
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    %rbp,%rsi
  call   <Q_strncpyz@plt>
  mov    0x3a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x3b8,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L35:
  mov    $0x1,%r14d
  xor    %r12d,%r12d
  jmp    L48
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D22
type: string
name: parse_data
arguments: data_label: D30
type: string
name: parse_data
arguments: data_label: D39
type: string
name: parse_data
arguments: data_label: D2
type: string

tool: D22: *BUILTIN* 

tool: D30: layouts/%s

tool: D39: .dat

tool: D2: ^3WARNING: layout list was truncated to %d layouts, but %d layout files exist in layouts/%s/.


assistant: ```c
int G_LayoutList(const char *map, char *list, int len) {
  char fileList[(256 / 2) * 5] = {""};
  char layouts[256] = {""};
  int numFiles, i, fileLen = 0, listLen;
  int count = 0;
  char *filePtr;
  Q_strcat(layouts, sizeof(layouts), "*BUILTIN* ");
  numFiles = trap_FS_GetFileList(va("layouts/%s", map), ".dat", fileList, sizeof(fileList));
  filePtr = fileList;
  for (i = 0; i < numFiles; i++, filePtr += fileLen + 1) {
    fileLen = strlen(filePtr);
    listLen = strlen(layouts);
    if (fileLen < 5)
      continue;
    if ((listLen + fileLen) >= sizeof(layouts))
      break;
    Q_strcat(layouts, sizeof(layouts), filePtr);
    listLen = strlen(layouts);
    layouts[listLen - 4] = ' ';
    layouts[listLen - 3] = '\0';
    count++;
  }
  if (count != numFiles) {
    G_Printf("^3"
             "WARNING: layout list was truncated to %d "
             "layouts, but %d layout files exist in layouts/%s/.\n",
             count, numFiles, map);
  }
  Q_strncpyz(list, layouts, len);
  return count + 1;
}
```