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

```asm
<find_test>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdi,-0x88(%rbp)
  mov    %rsi,-0x90(%rbp)
  mov    %rdx,-0x98(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  lea    D28(%rip),%rax
  mov    %rax,-0x30(%rbp)
  lea    D64(%rip),%rax
  mov    %rax,-0x28(%rbp)
  lea    D25(%rip),%rax
  mov    %rax,-0x20(%rbp)
  lea    D1(%rip),%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x98(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  mov    -0x90(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x74(%rbp)
  jmp    L62
L26:
  mov    -0x74(%rbp),%eax
  mov    -0x30(%rbp,%rax,8),%rax
  mov    %rax,-0x60(%rbp)
  movl   $0x0,-0x70(%rbp)
  jmp    L21
L92:
  mov    -0x70(%rbp),%eax
  mov    -0x50(%rbp,%rax,8),%rax
  mov    %rax,-0x58(%rbp)
  cmpq   $0x0,-0x58(%rbp)
  je     L5
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,%ebx
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x2,%eax
  mov    %eax,-0x6c(%rbp)
  mov    -0x6c(%rbp),%eax
  mov    $0x40d,%edx
  lea    D9(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <x_malloc@plt>
  mov    %rax,-0x68(%rbp)
  mov    -0x60(%rbp),%rdi
  mov    -0x88(%rbp),%rcx
  mov    -0x58(%rbp),%rdx
  mov    -0x6c(%rbp),%esi
  mov    -0x68(%rbp),%rax
  mov    %rdi,%r9
  mov    %rcx,%r8
  mov    %rdx,%rcx
  lea    D23(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <is_valid_test@plt>
  test   %rax,%rax
  je     L8
  mov    -0x68(%rbp),%rax
  jmp    L58
L8:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x68(%rbp)
  jmp    L65
L5:
  nop
L65:
  addl   $0x1,-0x70(%rbp)
L21:
  cmpl   $0x2,-0x70(%rbp)
  jbe    L92
  addl   $0x1,-0x74(%rbp)
L62:
  cmpl   $0x2,-0x74(%rbp)
  jbe    L26
  cmpq   $0x0,-0x68(%rbp)
  jne    L28
  mov    -0x88(%rbp),%rax
  mov    $0x416,%edx
  lea    D9(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <x_strdup@plt>
  mov    %rax,-0x68(%rbp)
L28:
  mov    -0x68(%rbp),%rax
L58:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L77
  call   <__stack_chk_fail@plt>
L77:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D28
data_type: string
name: retrieve_data
arguments: data_tag: D64
data_type: string
name: retrieve_data
arguments: data_tag: D25
data_type: string
name: retrieve_data
arguments: data_tag: D1
data_type: string
name: retrieve_data
arguments: data_tag: D9
data_type: string
name: retrieve_data
arguments: data_tag: D23
data_type: string

tool: D28: -t

tool: D64: .t

tool: 

tool: D1: .

tool: D9: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dnstap/knot/refs/heads/branches/dnstap/libtap/runtests.c

tool: D23: %s/%s%s

assistant: ```c
char *find_test(const char *name, const char *source, const char *build) {
  char *path;
  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++) {
      unsigned int path_len;
      base = bases[j];
      if (base == NULL)
        continue;
      path_len = strlen(base) + strlen(name) + strlen(suffix) + 2;
      path = x_malloc((path_len), "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dnstap/knot/refs/heads/branches/dnstap/libtap/runtests.c", 1037);
      snprintf(path, path_len, "%s/%s%s", base, name, suffix);
      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/dnstap/knot/refs/heads/branches/dnstap/libtap/runtests.c", 1046);
  return path;
}
```