user: Please show me the C implementation that matches the assembly code listed below:

```asm
<trav_dir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbx
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <opendir@plt>
  test   %rax,%rax
  je     L51
  mov    %rax,%r12
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  lea    D0(%rip),%r14
L103:
  mov    %r12,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L110
  mov    (%rbx),%r15
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rax,-0x48(%rbp)
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L103
  mov    %rsp,-0x50(%rbp)
  mov    -0x48(%rbp),%rax
  lea    0x0(%r13,%rax,1),%r15
  lea    0x14(%r15),%rax
  mov    $0x10,%ecx
  mov    $0x0,%edx
  div    %rcx
  shl    $0x4,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L90:
  cmp    %rdx,%rsp
  je     L13
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L90
L13:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L64
  orq    $0x0,-0x8(%rsp,%rdx,1)
L64:
  mov    %rsp,-0x68(%rbp)
  mov    %r13,%rdx
  mov    -0x58(%rbp),%rsi
  mov    %rsp,%rdi
  call   <memcpy@plt>
  movb   $0x2f,(%rsp,%r13,1)
  lea    0x1(%rsp,%r13,1),%rdi
  mov    -0x48(%rbp),%rdx
  mov    (%rbx),%rsi
  call   <memcpy@plt>
  movb   $0x0,0x1(%rsp,%r15,1)
  lea    D3(%rip),%rsi
  mov    %rsp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L29
  mov    D3(%rip),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  je     L86
  mov    (%rbx),%rax
  cmpb   $0x2e,(%rax)
  jne    L81
  movzbl 0x1(%rax),%edx
  test   %dl,%dl
  je     L144
  cmp    $0x2e,%dl
  je     L26
L81:
  mov    -0x5c(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x68(%rbp),%rdi
  call   <trav_dir>
L144:
  mov    -0x50(%rbp),%rsp
  jmp    L103
L26:
  cmpb   $0x0,0x2(%rax)
  je     L144
  jmp    L81
L86:
  mov    $0x2e,%esi
  mov    -0x68(%rbp),%rdi
  call   <strrchr@plt>
  test   %rax,%rax
  jne    L144
L29:
  mov    -0x50(%rbp),%rsp
  jmp    L103
L110:
  mov    %r12,%rdi
  call   <closedir@plt>
L51:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D0
data_type: string

tool: D0: zlib

assistant: ```c
void trav_dir(const char *dir_name, int level) {
  DIR *pdir = opendir(dir_name);
  struct dirent *entry;
  size_t d_len = strlen(dir_name);
  if (!pdir)
    return;
  while ((entry = readdir(pdir))) {
    static struct stat st_buf;
    size_t e_len = strlen(entry->d_name);
    if (!strcmp("zlib", entry->d_name))
      continue;
    else {
      char n_path[d_len + e_len + 5];
      memcpy(n_path, dir_name, d_len);
      n_path[d_len] = '/';
      memcpy(n_path + d_len + 1, entry->d_name, e_len);
      n_path[d_len + 1 + e_len] = '\0';
      if (stat(n_path, &st_buf))
        continue;
      if (S_ISDIR(st_buf.st_mode)) {
        if ('.' != entry->d_name[0] || ('\0' != entry->d_name[1] && ('.' != entry->d_name[1] || '\0' != entry->d_name[2])))
          trav_dir(n_path, level + 1);
      } else {
        char *c_ptr = strrchr(n_path, '.');
        if (!c_ptr)
          continue;
      }
    }
  }
  closedir(pdir);
}
```