user: What is the c source code of the assembly code below?

```asm
<expath>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x68,%rsp
  mov    $0x7e,%ecx
  pxor   %xmm0,%xmm0
  mov    %rsi,0x28(%rsp)
  mov    %rdi,%rbp
  lea    0x460(%rsp),%rdi
  lea    D66(%rip),%rsi
  mov    %edx,0x3c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1058(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x450(%rsp)
  rep stos %rax,%es:(%rdi)
  mov    %edx,%ecx
  mov    $0x3,%edi
  mov    %rbp,%rdx
  call   <trace@plt>
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  call   <strrchr@plt>
  test   %rax,%rax
  je     L235
L0:
  lea    0x1(%rax),%rcx
  sub    %rbp,%rax
  lea    0x450(%rsp),%rdi
  mov    %rbp,%rsi
  mov    %rax,%rbx
  lea    0x1(%rax),%edx
  mov    %rcx,0x20(%rsp)
  call   <strncpy@plt>
  movb   $0x0,0x451(%rsp,%rbx,1)
L1:
  cmpb   $0x0,0x450(%rsp)
  lea    D25(%rip),%rax
  lea    0x450(%rsp),%rdi
  cmove  %rax,%rdi
  call   <opendir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L49
  movq   $0x0,0x18(%rsp)
  lea    D21(%rip),%r12
L86:
  mov    0x18(%rsp),%rax
  mov    %eax,0x34(%rsp)
  mov    %eax,0x30(%rsp)
  mov    %eax,0x38(%rsp)
  lea    0x850(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0xc50(%rsp),%rax
  mov    %rax,0x8(%rsp)
L7:
  mov    %r15,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L41
  mov    (%rbx),%rdx
  cmpb   $0x2e,(%rdx)
  je     L7
  mov    0x10(%rsp),%rbp
  lea    D17(%rip),%rsi
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    0x20(%rsp),%rdx
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  lea    D17(%rip),%rsi
  call   <sprintf@plt>
  movzbl 0x850(%rsp),%eax
  test   %al,%al
  je     L70
  nopl   0x0(%rax)
L166:
  movsbl %al,%edi
  add    $0x1,%rbp
  call   <tolower@plt>
  mov    %al,-0x1(%rbp)
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L166
L70:
  movzbl 0xc50(%rsp),%eax
  mov    0x8(%rsp),%rbp
  test   %al,%al
  je     L176
  nopl   0x0(%rax,%rax,1)
L143:
  movsbl %al,%edi
  add    $0x1,%rbp
  call   <tolower@plt>
  mov    %al,-0x1(%rbp)
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L143
L176:
  mov    0x8(%rsp),%rdi
  lea    0x48(%rsp),%rbp
  mov    %r12,%rsi
  mov    %rbp,%rdx
  call   <strtok_r@plt>
  mov    0x10(%rsp),%r14
  mov    %rax,%r13
  test   %rax,%rax
  je     L187
  nopl   0x0(%rax)
L2:
  mov    %r14,%rdi
  mov    %r13,%rsi
  call   <strstr@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L7
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdx
  mov    %r12,%rsi
  xor    %edi,%edi
  cltq
  add    %rax,%r14
  call   <strtok_r@plt>
  mov    %rax,%r13
  test   %rax,%rax
  jne    L2
L187:
  mov    0x38(%rsp),%ecx
  cmp    %ecx,0x3c(%rsp)
  jle    L7
  mov    0x28(%rsp),%rax
  mov    0x18(%rsp),%r14
  lea    0x450(%rsp),%rdx
  lea    D55(%rip),%rsi
  mov    (%rbx),%rcx
  mov    (%rax,%r14,8),%rdi
  xor    %eax,%eax
  add    $0x1,%r14
  call   <sprintf@plt>
  mov    %r14,0x18(%rsp)
  jmp    L86
  nopl   0x0(%rax)
L41:
  mov    %r15,%rdi
  call   <closedir@plt>
  cmpl   $0x1,0x30(%rsp)
  jle    L222
  mov    0x34(%rsp),%edx
  mov    0x28(%rsp),%rcx
  mov    $0x1,%r13d
  lea    0x50(%rsp),%r12
  lea    -0x2(%rdx),%eax
  lea    0x8(%rcx),%r14
  add    $0x2,%rax
  lea    0x10(%rcx),%r15
  mov    %rax,0x8(%rsp)
  lea    -0x1(%rdx),%eax
  mov    %eax,0x10(%rsp)
  nopw   0x0(%rax,%rax,1)
L39:
  cmp    %r13d,0x30(%rsp)
  jle    L229
  mov    0x10(%rsp),%eax
  mov    %r14,%rbx
  sub    %r13d,%eax
  lea    -0x1(%r13,%rax,1),%rax
  lea    (%r15,%rax,8),%rbp
  nopw   0x0(%rax,%rax,1)
L15:
  mov    -0x8(%r14),%rdi
  mov    (%rbx),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jle    L189
  mov    -0x8(%r14),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  mov    -0x8(%r14),%rdi
  mov    (%rbx),%rsi
  call   <strcpy@plt>
  mov    (%rbx),%rdi
  mov    %r12,%rsi
  call   <strcpy@plt>
L189:
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L15
L229:
  add    $0x1,%r13
  add    $0x8,%r14
  cmp    0x8(%rsp),%r13
  jne    L39
L222:
  mov    0x30(%rsp),%eax
  test   %eax,%eax
  je     L173
  mov    0x34(%rsp),%eax
  mov    0x28(%rsp),%rbx
  lea    D20(%rip),%rbp
  sub    $0x1,%eax
  lea    0x8(%rbx,%rax,8),%r12
  nopl   0x0(%rax)
L105:
  mov    (%rbx),%rdx
  mov    %rbp,%rsi
  mov    $0x3,%edi
  xor    %eax,%eax
  add    $0x8,%rbx
  call   <trace@plt>
  cmp    %rbx,%r12
  jne    L105
L173:
  mov    0x1058(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L140
  mov    0x30(%rsp),%eax
  add    $0x1068,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L235:
  mov    $0x5c,%esi
  mov    %rbp,%rdi
  call   <strrchr@plt>
  mov    %rbp,0x20(%rsp)
  test   %rax,%rax
  jne    L0
  jmp    L1
L49:
  movl   $0x0,0x30(%rsp)
  jmp    L173
L140:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D66
data_type: string
name: disassemble_data
arguments: data_tag: D25
data_type: string
name: disassemble_data
arguments: data_tag: D21
data_type: string
name: disassemble_data
arguments: data_tag: D17
data_type: string
name: disassemble_data
arguments: data_tag: D55
data_type: string
name: disassemble_data
arguments: data_tag: D20
data_type: string

tool: D66: expath  : path=%s nmax=%d


tool: D25: .

tool: D21: *

tool: D17: ^%s$

tool: D55: %s%s

tool: D20: expath  : file=%s


assistant: ```c
extern int expath(const char *path, char *paths[], int nmax) {
  int i, j, n = 0;
  char tmp[1024];
  struct dirent *d;
  DIR *dp;
  const char *file = path;
  char dir[1024] = "", s1[1024], s2[1024], *p, *q, *r;
  trace(3, "expath  : path=%s nmax=%d\n", path, nmax);
  if ((p = strrchr(path, '/')) || (p = strrchr(path, '\\'))) {
    file = p + 1;
    strncpy(dir, path, p - path + 1);
    dir[p - path + 1] = '\0';
  }
  if (!(dp = opendir(*dir ? dir : "."))) {
    return 0;
  }
  while ((d = readdir(dp))) {
    if (*(d->d_name) == '.') {
      continue;
    }
    sprintf(s1, "^%s$", d->d_name);
    sprintf(s2, "^%s$", file);
    for (p = s1; *p; p++) {
      *p = (char)tolower((int)*p);
    }
    for (p = s2; *p; p++) {
      *p = (char)tolower((int)*p);
    }
    for (p = s1, q = strtok_r(s2, "*", &r); q; q = strtok_r(NULL, "*", &r)) {
      if ((p = strstr(p, q))) {
        p += strlen(q);
      } else {
        break;
      }
    }
    if (p && n < nmax) {
      sprintf(paths[n++], "%s%s", dir, d->d_name);
    }
  }
  closedir(dp);
  for (i = 0; i < n - 1; ++i) {
    for (j = i + 1; j < n; ++j) {
      if (strcmp(paths[i], paths[j]) > 0) {
        strcpy(tmp, paths[i]);
        strcpy(paths[i], paths[j]);
        strcpy(paths[j], tmp);
      }
    }
  }
  for (i = 0; i < n; ++i) {
    trace(3, "expath  : file=%s\n", paths[i]);
  }
  return n;
}
```