user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<send_directory_listing>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x60,%rsp
  mov    %rdi,%r12
  mov    %rsi,0x18(%rsp)
  mov    %rdx,%rax
  shr    $0x20,%rax
  mov    %rdx,0x20(%rsp)
  mov    %rcx,%rbx
  mov    %rcx,0x10(%rsp)
  mov    %r8,%r13
  mov    %fs:0x28,%rdx
  mov    %rdx,0x50(%rsp)
  xor    %edx,%edx
  push   %rax
  mov    $0xffffffff,%r9d
  lea    D203(%rip),%r8
  mov    $0x0,%ecx
  lea    D130(%rip),%rdx
  mov    $0xc8,%esi
  call   <send_header@plt>
  mov    %r12,%rcx
  mov    $0x6,%edx
  mov    $0x1,%esi
  lea    D186(%rip),%rdi
  call   <fwrite@plt>
  mov    $0x0,%ecx
  mov    %rbx,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <set_simple_head@plt>
  mov    %r12,%rcx
  mov    $0x6,%edx
  mov    $0x1,%esi
  lea    D49(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rdx
  lea    D128(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  lea    D213(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x60,%edx
  mov    $0x1,%esi
  lea    D52(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  lea    D152(%rip),%rdi
  call   <fwrite@plt>
  mov    %r13,%rdi
  call   <opendir@plt>
  mov    %rax,%r14
  add    $0x10,%rsp
  lea    D68(%rip),%r15
  jmp    L1
L55:
  mov    0x18(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  lea    D42(%rip),%rcx
  cmovne %r15,%rcx
  mov    0x0(%rbp),%rdx
  lea    D39(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x18(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  lea    D42(%rip),%rcx
  cmovne %r15,%rcx
  mov    0x0(%rbp),%rdx
  lea    D83(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x18(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  je     L83
  lea    0x20(%rsp),%rdx
  lea    D112(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L13:
  mov    %r12,%rcx
  mov    $0x5,%edx
  mov    $0x1,%esi
  lea    D195(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rdi
  call   <free@plt>
L1:
  mov    %r14,%rdi
  call   <readdir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L18
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x80(%rax),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %rax,%rbx
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  movb   $0x0,(%rbx,%rax,1)
  mov    0x0(%rbp),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  lea    0x10(%rsp),%rsi
  mov    %rbx,%rdi
  call   <stat@plt>
  lea    0x1c(%rsp),%rdi
  call   <gmtime@plt>
  mov    %rax,%rcx
  lea    0x20(%rsp),%rdi
  lea    D120(%rip),%rdx
  mov    $0x20,%esi
  call   <strftime@plt>
  mov    %r12,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D150(%rip),%rdi
  call   <fwrite@plt>
  lea    D75(%rip),%rsi
  mov    0x0(%rbp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L1
  mov    %r15,%rsi
  mov    0x8(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L55
  lea    D23(%rip),%rsi
  mov    0x0(%rbp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L55
  jmp    L1
L83:
  lea    0x20(%rsp),%rdx
  mov    0x10(%rsp),%rcx
  lea    D88(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L13
L18:
  mov    %r14,%rdi
  call   <closedir@plt>
  lea    D187(%rip),%rdx
  lea    D61(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0xe,%edx
  mov    $0x1,%esi
  lea    D98(%rip),%rdi
  call   <fwrite@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D203
type: string
name: read_data
arguments: data_tag: D130
type: string
name: read_data
arguments: data_tag: D186
type: string
name: read_data
arguments: data_tag: D49
type: string
name: read_data
arguments: data_tag: D128
type: string
name: read_data
arguments: data_tag: D213
type: string
name: read_data
arguments: data_tag: D52
type: string
name: read_data
arguments: data_tag: D152
type: string
name: read_data
arguments: data_tag: D68
type: string
name: read_data
arguments: data_tag: D42
type: string
name: read_data
arguments: data_tag: D39
type: string
name: read_data
arguments: data_tag: D83
type: string
name: read_data
arguments: data_tag: D112
type: string
name: read_data
arguments: data_tag: D195
type: string
name: read_data
arguments: data_tag: D120
type: string
name: read_data
arguments: data_tag: D150
type: string
name: read_data
arguments: data_tag: D75
type: string
name: read_data
arguments: data_tag: D23
type: string
name: read_data
arguments: data_tag: D88
type: string
name: read_data
arguments: data_tag: D187
type: string
name: read_data
arguments: data_tag: D61
type: string
name: read_data
arguments: data_tag: D98
type: string

tool: D203: text/html

tool: D130: OK

tool: D186: <html>

tool: D49: <body>

tool: D128: <h1>Index of %s</h1>


tool: D213: <pre><table border="0" width="100%%">

tool: D52: <tr><th align="left">Name</th><th align="left">Last modified</th><th align="left">Size</th></tr>

tool: D152: <hr />


tool: D68: /

tool: 

tool: D39: <td><a href="%s%s">

tool: D83: %s%s</a></td>

tool: D112: <td>%s</td>

tool: D195: </tr>

tool: D120: %Y-%b-%d %H:%M:%S

tool: D150: <tr>

tool: D75: .

tool: D23: ..

tool: D88: <td>%s</td> <td>%10llu</td>

tool: D187: http_server 0.1

tool: D61: </table></pre>
<hr /><address>%s</address>


tool: D98: </body></html>

assistant: ```c
void send_directory_listing(FILE *f, struct stat statbuf, char *relative_path, char *path) {
  DIR *dir;
  struct dirent *de;
  send_header(f, 200, "OK", NULL, "text/html", -1, statbuf.st_mtime);
  fprintf(f, "<html>");
  set_simple_head(f, relative_path, relative_path, NULL);
  fprintf(f, "<body>");
  fprintf(f, "<h1>Index of %s</h1>\r\n", relative_path);
  fprintf(f, "<pre><table border=\"0\" width=\"100%%\">");
  fprintf(f, "<tr><th align=\"left\">Name</th><th align=\"left\">Last modified</th><th align=\"left\">Size</th></tr>");
  fprintf(f, "<hr />\r\n");
  dir = opendir(path);
  while ((de = readdir(dir)) != NULL) {
    char timebuf[32];
    struct tm *tm;
    char *pathbuf = calloc(strlen(path) + 128, sizeof(char));
    memcpy(pathbuf, path, strlen(path));
    pathbuf[strlen(pathbuf)] = '\0';
    strcat(pathbuf, de->d_name);
    stat(pathbuf, &statbuf);
    tm = gmtime(&statbuf.st_mtime);
    strftime(timebuf, sizeof(timebuf), "%Y-%b-%d %H:%M:%S", tm);
    fprintf(f, "<tr>");
    if (strcmp(de->d_name, ".") == 0)
      continue;
    if (strcmp(relative_path, "/") == 0 && strcmp(de->d_name, "..") == 0)
      continue;
    fprintf(f, "<td><a href=\"%s%s\">", de->d_name, S_ISDIR(statbuf.st_mode) ? "/" : "");
    fprintf(f, "%s%s</a></td>", de->d_name, S_ISDIR(statbuf.st_mode) ? "/" : "");
    if (S_ISDIR(statbuf.st_mode))
      fprintf(f, "<td>%s</td>", timebuf);
    else
      fprintf(f, "<td>%s</td> <td>%10llu</td>", timebuf, (unsigned long long)statbuf.st_size);
    fprintf(f, "</tr>");
    free(pathbuf);
  }
  closedir(dir);
  fprintf(f, "</table></pre>\r\n<hr /><address>%s</address>\r\n", "http_server 0.1");
  fprintf(f, "</body></html>");
}
```