user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<fs_loadall>:
  endbr64
  push   %r15
  lea    D86(%rip),%rsi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  test   %rax,%rax
  je     L26
  lea    0x30(%rsp),%r15
  mov    %rax,%rcx
  mov    $0x8,%edx
  mov    %rax,%rbp
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fread@plt>
  cmp    $0x8,%eax
  jne    L175
  movsbl 0x37(%rsp),%edx
  movsbl 0x30(%rsp),%esi
  movsbl 0x34(%rsp),%r11d
  movsbl 0x33(%rsp),%r10d
  movsbl 0x31(%rsp),%ecx
  movsbl 0x35(%rsp),%ebx
  mov    %edx,%edi
  mov    %esi,0xc(%rsp)
  movsbl 0x32(%rsp),%r8d
  movsbl 0x36(%rsp),%eax
  mov    %r11d,0x2c(%rsp)
  mov    %r10d,0x28(%rsp)
  mov    %r8d,0x24(%rsp)
  mov    %ecx,0x20(%rsp)
  mov    %edx,0x1c(%rsp)
  mov    %ebx,0x8(%rsp)
  mov    %eax,0x4(%rsp)
  call   <dispchar@plt>
  movsbl 0x36(%rsp),%edi
  mov    %eax,0x10(%rsp)
  call   <dispchar@plt>
  movsbl 0x35(%rsp),%edi
  mov    %eax,0x14(%rsp)
  call   <dispchar@plt>
  movsbl 0x34(%rsp),%edi
  mov    %eax,0x18(%rsp)
  call   <dispchar@plt>
  movsbl 0x33(%rsp),%edi
  mov    %eax,%r14d
  call   <dispchar@plt>
  movsbl 0x32(%rsp),%edi
  mov    %eax,%ebx
  call   <dispchar@plt>
  movsbl 0x31(%rsp),%edi
  mov    %eax,%r13d
  call   <dispchar@plt>
  movsbl 0x30(%rsp),%edi
  mov    %eax,%r12d
  call   <dispchar@plt>
  sub    $0x8,%rsp
  lea    D57(%rip),%rdi
  mov    %r14d,%r9d
  mov    0x24(%rsp),%edx
  mov    %eax,%esi
  push   %rdx
  mov    0x14(%rsp),%ecx
  push   %rcx
  mov    0x20(%rsp),%ecx
  push   %rcx
  mov    0x4c(%rsp),%r11d
  push   %r11
  mov    0x50(%rsp),%r10d
  push   %r10
  mov    0x54(%rsp),%r8d
  push   %r8
  mov    0x58(%rsp),%ecx
  mov    %ebx,%r8d
  push   %rcx
  mov    0x4c(%rsp),%edx
  push   %rdx
  mov    0x58(%rsp),%ecx
  push   %rcx
  mov    0x64(%rsp),%edx
  mov    %r13d,%ecx
  push   %rdx
  mov    0x70(%rsp),%eax
  mov    %r12d,%edx
  push   %rax
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x60,%rsp
  mov    $0x8,%edx
  mov    %r15,%rdi
  lea    D6(%rip),%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L135
  mov    $0x5,%edx
  lea    D77(%rip),%rsi
  mov    %r15,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L114
  movzbl 0x35(%rsp),%esi
  lea    -0x31(%rsi),%eax
  cmp    $0x8,%al
  ja     L114
  cmpb   $0x2e,0x36(%rsp)
  jne    L114
  movzbl 0x37(%rsp),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L114
  shl    $0x4,%esi
  add    %eax,%esi
  cmp    $0x16,%sil
  jg     L33
  mov    %rbp,%rdi
  call   <fs_load_pre17@plt>
  test   %rax,%rax
  js     L98
  mov    $0x10,%esi
  mov    %rbp,%rdi
  call   <chunk_load@plt>
  test   %rax,%rax
  js     L71
L112:
  mov    %rbp,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L153
  mov    %rbp,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
L187:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L95
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L135:
  lea    D13(%rip),%rdi
  call   <puts@plt>
  jmp    L112
  xchg   %ax,%ax
L33:
  movsbl %sil,%esi
  mov    %rbp,%rdi
  call   <fs_load@plt>
  test   %rax,%rax
  jns    L112
  nopl   0x0(%rax)
L89:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L187
  nopw   0x0(%rax,%rax,1)
L114:
  lea    D56(%rip),%rdi
  call   <puts@plt>
  jmp    L89
  xchg   %ax,%ax
L175:
  lea    D90(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L187
L153:
  lea    D24(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L187
L26:
  lea    D73(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L187
L98:
  lea    D87(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L187
L71:
  lea    D9(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  or     $0xffffffff,%eax
  jmp    L187
L95:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D86
data_type: string
name: unpack_data
arguments: label: D57
data_type: string
name: unpack_data
arguments: label: D6
data_type: string
name: unpack_data
arguments: label: D77
data_type: string
name: unpack_data
arguments: label: D13
data_type: string
name: unpack_data
arguments: label: D56
data_type: string
name: unpack_data
arguments: label: D90
data_type: string
name: unpack_data
arguments: label: D24
data_type: string
name: unpack_data
arguments: label: D73
data_type: string
name: unpack_data
arguments: label: D87
data_type: string
name: unpack_data
arguments: label: D9
data_type: string

tool: D86: r

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


tool: D6: MFSM NEW

tool: D77: MFSM 

tool: D13: empty file

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

tool: D90: can't read metadata header

tool: D24: error reading metadata

tool: D73: can't open metadata file

tool: D87: error reading metadata (structure)

tool: D9: error reading metadata (chunks)

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;
}
```