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

```asm
<fs_loadall>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    D93(%rip),%rsi
  call   <fopen@plt>
  test   %rax,%rax
  je     L41
  mov    %rax,%rbx
  lea    0x30(%rsp),%rdi
  mov    %rax,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x8,%eax
  jne    L96
  movsbl 0x37(%rsp),%ebp
  movsbl 0x36(%rsp),%r15d
  movsbl 0x35(%rsp),%r14d
  movsbl 0x34(%rsp),%r13d
  movsbl 0x33(%rsp),%r12d
  movsbl 0x32(%rsp),%eax
  mov    %eax,0x8(%rsp)
  movsbl 0x31(%rsp),%ecx
  mov    %ecx,0xc(%rsp)
  movsbl 0x30(%rsp),%edx
  mov    %edx,0x10(%rsp)
  mov    %ebp,%edi
  call   <dispchar@plt>
  mov    %eax,0x14(%rsp)
  movsbl 0x36(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x18(%rsp)
  movsbl 0x35(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x1c(%rsp)
  movsbl 0x34(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x20(%rsp)
  movsbl 0x33(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x24(%rsp)
  movsbl 0x32(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x28(%rsp)
  movsbl 0x31(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,0x2c(%rsp)
  movsbl 0x30(%rsp),%edi
  call   <dispchar@plt>
  mov    %eax,%esi
  sub    $0x8,%rsp
  push   %rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    0x38(%rsp),%edi
  push   %rdi
  mov    0x44(%rsp),%edi
  push   %rdi
  mov    0x50(%rsp),%edi
  push   %rdi
  mov    0x5c(%rsp),%edi
  push   %rdi
  mov    0x68(%rsp),%edi
  push   %rdi
  mov    0x74(%rsp),%edi
  push   %rdi
  mov    0x80(%rsp),%r9d
  mov    0x84(%rsp),%r8d
  mov    0x88(%rsp),%ecx
  mov    0x8c(%rsp),%edx
  lea    D12(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x60,%rsp
  lea    0x30(%rsp),%rdi
  mov    $0x8,%edx
  lea    D55(%rip),%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L19
  lea    D25(%rip),%rdi
  call   <puts@plt>
L137:
  mov    %rbx,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L40
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L75:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L177
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L41:
  lea    D16(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L96:
  lea    D66(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L19:
  lea    0x30(%rsp),%rdi
  mov    $0x5,%edx
  lea    D79(%rip),%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L37
  movzbl 0x35(%rsp),%esi
  lea    -0x31(%rsi),%eax
  cmp    $0x8,%al
  ja     L37
  cmpb   $0x2e,0x36(%rsp)
  jne    L37
  movzbl 0x37(%rsp),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L37
  shl    $0x4,%esi
  add    %eax,%esi
  cmp    $0x16,%sil
  jg     L67
  mov    %rbx,%rdi
  call   <fs_load_pre17@plt>
  test   %rax,%rax
  js     L150
  mov    $0x10,%esi
  mov    %rbx,%rdi
  call   <chunk_load@plt>
  test   %rax,%rax
  jns    L137
  lea    D0(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L150:
  lea    D60(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L67:
  movsbl %sil,%esi
  mov    %rbx,%rdi
  call   <fs_load@plt>
  test   %rax,%rax
  jns    L137
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L37:
  lea    D100(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L40:
  lea    D97(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L75
L177:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D93
type_infered: string
name: retrieve_data
arguments: label: D12
type_infered: string
name: retrieve_data
arguments: label: D55
type_infered: string
name: retrieve_data
arguments: label: D25
type_infered: string
name: retrieve_data
arguments: label: D16
type_infered: string
name: retrieve_data
arguments: label: D66
type_infered: string
name: retrieve_data
arguments: label: D79
type_infered: string
name: retrieve_data
arguments: label: D0
type_infered: string
name: retrieve_data
arguments: label: D60
type_infered: string
name: retrieve_data
arguments: label: D100
type_infered: string
name: retrieve_data
arguments: label: D97
type_infered: string

tool: D93: r

tool: D12: # header: %c%c%c%c%c%c%c%c (%02X%02X%02X%02X%02X%02X%02X%02X)


tool: D55: MFSM NEW

tool: D25: empty file

tool: D16: can't open metadata file

tool: D66: can't read metadata header

tool: D79: MFSM 

tool: D0: error reading metadata (chunks)

tool: D60: error reading metadata (structure)

tool: D100: wrong metadata header (old version ?)

tool: D97: error reading metadata

assistant: ```c
int fs_loadall(const char *fname) {
  FILE *fd;
  uint8_t hdr[8];
  uint8_t fver;
  fd = fopen(fname, "r");
  if (fd == NULL) {
    printf("can't open metadata file\n");
    return -1;
  }
  if (fread(hdr, 1, 8, fd) != 8) {
    printf("can't read metadata header\n");
    fclose(fd);
    return -1;
  }
  printf("# header: %c%c%c%c%c%c%c%c (%02X%02X%02X%02X%02X%02X%02X%02X)\n", dispchar(hdr[0]), dispchar(hdr[1]), dispchar(hdr[2]), dispchar(hdr[3]), dispchar(hdr[4]), dispchar(hdr[5]), dispchar(hdr[6]), dispchar(hdr[7]), hdr[0], hdr[1], hdr[2], hdr[3], hdr[4], hdr[5], hdr[6], hdr[7]);
  if (memcmp(hdr, "MFSM NEW", 8) == 0) {
    printf("empty file\n");
  } else if (memcmp(hdr,
                    "MFS"
                    "M ",
                    5) == 0 &&
             hdr[5] >= '1' && hdr[5] <= '9' && hdr[6] == '.' && hdr[7] >= '0' && hdr[7] <= '9') {
    fver = ((hdr[5] - '0') << 4) + (hdr[7] - '0');
    if (fver < 0x17) {
      if (fs_load_pre17(fd) < 0) {
        printf("error reading metadata (structure)\n");
        fclose(fd);
        return -1;
      }
      if (chunk_load(fd, 0x10) < 0) {
        printf("error reading metadata (chunks)\n");
        fclose(fd);
        return -1;
      }
    } else {
      if (fs_load(fd, fver) < 0) {
        fclose(fd);
        return -1;
      }
    }
  } else {
    printf("wrong metadata header (old version ?)\n");
    fclose(fd);
    return -1;
  }
  if (ferror(fd) != 0) {
    printf("error reading metadata\n");
    fclose(fd);
    return -1;
  }
  fclose(fd);
  return 0;
}
```