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

```asm
<ShowRefs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x430,%rsp
  mov    %rdi,-0x428(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x6c,%eax
  cmp    $0x2f,%al
  je     L64
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D74(%rip),%rax
  mov    %rax,%rdi
  call   <FixFilename@plt>
  jmp    L2
L64:
  lea    -0x410(%rbp),%rax
  lea    D74(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
L2:
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  lea    -0x410(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x420(%rbp)
  mov    -0x420(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L86
  lea    -0x410(%rbp),%rax
  lea    D57(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
L86:
  mov    -0x428(%rbp),%rdx
  lea    -0x310(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    -0x310(%rbp),%rax
  mov    $0x2e,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  je     L53
  mov    -0x420(%rbp),%rax
  movb   $0x0,(%rax)
L53:
  lea    -0x310(%rbp),%rcx
  lea    -0x410(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  lea    D62(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0x210(%rbp),%rax
  lea    D23(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  je     L18
  mov    -0x428(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    -0x210(%rbp),%rax
  mov    $0x2e,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  je     L27
  mov    -0x420(%rbp),%rax
  movb   $0x0,(%rax)
L27:
  lea    -0x210(%rbp),%rax
  mov    %rax,%rsi
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L11
L103:
  mov    -0x418(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    $0x1ff,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L11
  lea    -0x210(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  lea    -0x210(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x420(%rbp)
  mov    -0x420(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L42
  mov    -0x420(%rbp),%rax
  movb   $0x0,(%rax)
L42:
  lea    -0x210(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    %rax,%rsi
  lea    D65(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L11:
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  je     L103
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L70
L18:
  nop
L70:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L59
  call   <__stack_chk_fail@plt>
L59:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D74
type_guessed: string
name: unpack_data
arguments: data_tag: D57
type_guessed: string
name: unpack_data
arguments: data_tag: D62
type_guessed: string
name: unpack_data
arguments: data_tag: D23
type_guessed: string
name: unpack_data
arguments: data_tag: D71
type_guessed: string
name: unpack_data
arguments: data_tag: D65
type_guessed: string
name: unpack_data
arguments: data_tag: D33
type_guessed: string

tool: D74: logs/

tool: D57: /

tool: D62: %s%s.ref

tool: D23: r

tool: D71: <h2>Reference URL's for %s.html</h2>
<ul>


tool: D65: <li><a href="%s">%s</a><br>


tool: D33: </ul><hr>

assistant: ```c
void ShowRefs(char *filename) {
  char logdir[256];
  char fn[256];
  char buf[512];
  FILE *fp;
  char *s;
  if ("logs/"[0] != '/')
    FixFilename("logs/", logdir);
  else
    strcpy(logdir, "logs/");
  s = logdir + strlen(logdir) - 1;
  if (*s != '/')
    strcat(logdir, "/");
  strcpy(fn, filename);
  s = strrchr(fn, '.');
  if (s)
    *s = '\0';
  sprintf(buf, "%s%s.ref", logdir, fn);
  fp = fopen(buf, "r");
  if (!fp)
    return;
  strcpy(buf, filename);
  s = strrchr(buf, '.');
  if (s)
    *s = '\0';
  printf("<h2>Reference URL's for %s.html</h2>\n<ul>\n", buf);
  while (!feof(fp)) {
    if (fgets(buf, 511, fp)) {
      s = buf + strlen(buf) - 1;
      if (*s == '\n')
        *s = '\0';
      printf("<li><a href=\"%s\">%s</a><br>\n", buf, buf);
    }
  }
  fclose(fp);
  puts("</ul><hr>");
}
```