user: 请将以下的汇编代码转换成C语言代码:

```asm
<tracecmd_event_systems>:
  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     L102
  lea    D11(%rip),%rsi
  call   <append_file@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L102
  lea    0x24(%rsp),%rbx
  mov    %rax,%rdi
  mov    %rbx,%rsi
  call   <stat@plt>
  test   %eax,%eax
  js     L149
  mov    0x24(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  je     L149
  mov    %rbp,%rdi
  call   <opendir@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L149
  movl   $0x0,0x14(%rsp)
  xor    %r14d,%r14d
  lea    D36(%rip),%r15
  nopw   0x0(%rax,%rax,1)
L90:
  mov    %r13,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  je     L123
L115:
  mov    (%rax),%r12
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L90
  lea    D10(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L90
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <append_file@plt>
  mov    %rbx,%rsi
  mov    %rax,%rdi
  mov    %rax,0x8(%rsp)
  call   <stat@plt>
  test   %eax,%eax
  js     L143
  mov    0x24(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  je     L143
  mov    0x8(%rsp),%rdi
  lea    D32(%rip),%rsi
  call   <append_file@plt>
  mov    %rbx,%rsi
  mov    %rax,%rdi
  mov    %rax,0x18(%rsp)
  call   <stat@plt>
  mov    0x18(%rsp),%r8
  test   %eax,%eax
  js     L140
  mov    0x14(%rsp),%edx
  mov    %r14,%rdi
  mov    %r12,%rsi
  lea    0x1(%rdx),%eax
  mov    %eax,0x14(%rsp)
  call   <tracecmd_add_list@plt>
  mov    0x18(%rsp),%r8
  mov    %rax,%r14
L140:
  mov    %r8,%rdi
  call   <free@plt>
L143:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L115
L123:
  mov    %r13,%rdi
  call   <closedir@plt>
  jmp    L83
  nopl   0x0(%rax)
L149:
  xor    %r14d,%r14d
L83:
  mov    %rbp,%rdi
  call   <free@plt>
L57:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x38,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L102:
  xor    %r14d,%r14d
  jmp    L57
L37:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D11
type: string
name: parse_data
arguments: tag: D36
type: string
name: parse_data
arguments: tag: D10
type: string
name: parse_data
arguments: tag: D32
type: string

tool: D11: events

tool: D36: .

tool: D10: ..

tool: D32: enable

assistant: ```c
char **tracecmd_event_systems(const char *tracing_dir) {
  struct dirent *dent;
  char **systems = NULL;
  char *events_dir;
  struct stat st;
  DIR *dir;
  int len = 0;
  int ret;
  if (!tracing_dir)
    return NULL;
  events_dir = append_file(tracing_dir, "events");
  if (!events_dir)
    return NULL;
  ret = stat(events_dir, &st);
  if (ret < 0 || !S_ISDIR(st.st_mode))
    goto out_free;
  dir = opendir(events_dir);
  if (!dir)
    goto out_free;
  while ((dent = readdir(dir))) {
    const char *name = dent->d_name;
    char *enable;
    char *sys;
    if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
      continue;
    sys = append_file(events_dir, name);
    ret = stat(sys, &st);
    if (ret < 0 || !S_ISDIR(st.st_mode)) {
      free(sys);
      continue;
    }
    enable = append_file(sys, "enable");
    ret = stat(enable, &st);
    if (ret >= 0)
      systems = tracecmd_add_list(systems, name, len++);
    free(enable);
    free(sys);
  }
  closedir(dir);
out_free:
  free(events_dir);
  return systems;
}
```