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

```asm
<tracecmd_local_plugins>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L120
  lea    D14(%rip),%rsi
  call   <append_file@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L120
  lea    0x14(%rsp),%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %eax,%eax
  js     L110
  lea    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <read_file@plt>
  test   %eax,%eax
  js     L110
  movl   $0x0,0xc(%rsp)
  mov    0x18(%rsp),%rdi
  xor    %r12d,%r12d
  lea    0x20(%rsp),%r13
  lea    D2(%rip),%rbx
  lea    D35(%rip),%r14
L38:
  mov    %r13,%rdx
  mov    %rbx,%rsi
  call   <strtok_r@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L52
  mov    %rax,%rdi
  call   <strlen@plt>
  xor    %edi,%edi
  test   %eax,%eax
  je     L38
  cltq
  lea    -0x1(%r15,%rax,1),%rax
  cmpb   $0xa,(%rax)
  jne    L3
  movb   $0x0,(%rax)
L3:
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L30
  lea    D8(%rip),%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L30
  mov    0xc(%rsp),%edx
  mov    %r12,%rdi
  mov    %r15,%rsi
  lea    0x1(%rdx),%eax
  mov    %eax,0xc(%rsp)
  call   <tracecmd_add_list@plt>
  mov    %rax,%r12
L30:
  xor    %edi,%edi
  jmp    L38
  nopl   (%rax)
L110:
  xor    %r12d,%r12d
L126:
  mov    %rbp,%rdi
  call   <free@plt>
L68:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L52:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  jmp    L126
  nopl   0x0(%rax)
L120:
  xor    %r12d,%r12d
  jmp    L68
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D14
datatype: string
name: retrieve_data
arguments: data_label: D2
datatype: string
name: retrieve_data
arguments: data_label: D35
datatype: string
name: retrieve_data
arguments: data_label: D8
datatype: string

tool: D14: available_tracers

tool: D2:  

tool: D35: nop

tool: D8: none

assistant: ```c
char **tracecmd_local_plugins(const char *tracing_dir) {
  char *available_tracers;
  struct stat st;
  char **plugins = NULL;
  char *buf;
  char *str, *saveptr;
  char *plugin;
  int slen;
  int len;
  int ret;
  if (!tracing_dir)
    return NULL;
  available_tracers = append_file(tracing_dir, "available_tracers");
  if (!available_tracers)
    return NULL;
  ret = stat(available_tracers, &st);
  if (ret < 0)
    goto out_free;
  len = read_file(available_tracers, &buf);
  if (len < 0)
    goto out_free;
  len = 0;
  for (str = buf;; str = NULL) {
    plugin = strtok_r(str, " ", &saveptr);
    if (!plugin)
      break;
    if (!(slen = strlen(plugin)))
      continue;
    if (plugin[slen - 1] == '\n')
      plugin[slen - 1] = '\0';
    if (strcmp(plugin, "nop") == 0 || strcmp(plugin, "none") == 0)
      continue;
    plugins = tracecmd_add_list(plugins, plugin, len++);
  }
  free(buf);
out_free:
  free(available_tracers);
  return plugins;
}
```