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

```asm
<find_test>:
  endbr64
  push   %r15
  push   %r14
  lea    D18(%rip),%r14
  push   %r13
  lea    D47(%rip),%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  lea    D55(%rip),%rax
  mov    %rdx,0x28(%rsp)
  lea    0x40(%rsp),%rbx
  mov    %rsi,0x30(%rsp)
  mov    %rax,0x48(%rsp)
  lea    D16(%rip),%rax
  mov    %rax,0x50(%rsp)
  lea    0x58(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x20(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0x38(%rsp),%rax
  mov    %rax,0x8(%rsp)
L42:
  lea    D23(%rip),%rdi
  mov    0x10(%rsp),%r12
  test   %rdi,%rdi
  je     L72
L66:
  xor    %r8d,%r8d
  mov    %r13,%rcx
  mov    %rbp,%rdx
  mov    %r14,%rsi
  call   <concat@plt>
  mov    %rax,%rdi
  mov    %rax,%r15
  call   <is_valid_test@plt>
  test   %rax,%rax
  jne    L24
  mov    %r15,%rdi
  call   <free@plt>
L72:
  add    $0x8,%r12
  cmp    0x8(%rsp),%r12
  je     L58
  mov    (%r12),%rdi
  test   %rdi,%rdi
  jne    L66
  jmp    L72
  cs nopw 0x0(%rax,%rax,1)
L58:
  add    $0x8,%rbx
  cmp    0x18(%rsp),%rbx
  je     L2
  mov    (%rbx),%r13
  jmp    L42
L2:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  add    $0x68,%rsp
  mov    %rbp,%rdi
  mov    $0x4b3,%edx
  pop    %rbx
  lea    D7(%rip),%rsi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10d0 <x_strdup@plt>
  nopw   0x0(%rax,%rax,1)
L24:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  add    $0x68,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D18
datatype: string
name: read_data
arguments: data_label: D47
datatype: string
name: read_data
arguments: data_label: D55
datatype: string
name: read_data
arguments: data_label: D16
datatype: string
name: read_data
arguments: data_label: D23
datatype: string
name: read_data
arguments: data_label: D7
datatype: string

tool: D18: /

tool: D47: -t

tool: D55: .t

tool: 

tool: D23: .

tool: D7: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mkaysi/charybdis/refs/heads/master/tests/runtests.c

assistant: ```c
char *find_test(const char *name, const char *source, const char *build) {
  char *path = NULL;
  const char *bases[3], *suffix, *base;
  unsigned int i, j;
  const char *suffixes[3] = {"-t", ".t", ""};
  bases[0] = ".";
  bases[1] = build;
  bases[2] = source;
  for (i = 0; i < (sizeof(suffixes) / sizeof((suffixes)[0])); i++) {
    suffix = suffixes[i];
    for (j = 0; j < (sizeof(bases) / sizeof((bases)[0])); j++) {
      base = bases[j];
      if (base == NULL)
        continue;
      path = concat(base, "/", name, suffix, (const char *)0);
      if (is_valid_test(path))
        return path;
      free(path);
      path = NULL;
    }
  }
  if (path == NULL)
    path = x_strdup((name), "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mkaysi/charybdis/refs/heads/master/tests/runtests.c", 1203);
  return path;
}
```