user: 请将以下的汇编代码转换成C语言代码：

```asm
<fs_loadall>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    -0x58(%rbp),%rax
  lea    D94(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x48(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  jne    L198
  lea    D98(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L198:
  mov    -0x48(%rbp),%rdx
  lea    -0x40(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  cmp    $0x8,%eax
  je     L65
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L65:
  mov    -0x60(%rbp),%rax
  mov    $0x4,%edx
  lea    D26(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L78
  mov    -0x60(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L156
L78:
  movzbl -0x39(%rbp),%eax
  movsbl %al,%r12d
  movzbl -0x3a(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,-0x64(%rbp)
  movzbl -0x3b(%rbp),%eax
  movsbl %al,%ebx
  mov    %ebx,-0x68(%rbp)
  movzbl -0x3c(%rbp),%eax
  movsbl %al,%ecx
  mov    %ecx,-0x6c(%rbp)
  movzbl -0x3d(%rbp),%eax
  movsbl %al,%edx
  mov    %edx,-0x70(%rbp)
  movzbl -0x3e(%rbp),%eax
  movsbl %al,%edi
  mov    %edi,-0x74(%rbp)
  movzbl -0x3f(%rbp),%eax
  movsbl %al,%r10d
  mov    %r10d,-0x78(%rbp)
  movzbl -0x40(%rbp),%eax
  movsbl %al,%r11d
  mov    %r11d,-0x7c(%rbp)
  movzbl -0x39(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,%r15d
  movzbl -0x3a(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,%r14d
  movzbl -0x3b(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,%r13d
  movzbl -0x3c(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,-0x80(%rbp)
  movzbl -0x3d(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,-0x84(%rbp)
  movzbl -0x3e(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,-0x88(%rbp)
  movzbl -0x3f(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  mov    %eax,%ebx
  movzbl -0x40(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dispchar@plt>
  sub    $0x8,%rsp
  push   %r12
  mov    -0x64(%rbp),%esi
  push   %rsi
  mov    -0x68(%rbp),%esi
  push   %rsi
  mov    -0x6c(%rbp),%esi
  push   %rsi
  mov    -0x70(%rbp),%edx
  push   %rdx
  mov    -0x74(%rbp),%edi
  push   %rdi
  mov    -0x78(%rbp),%r10d
  push   %r10
  mov    -0x7c(%rbp),%r11d
  push   %r11
  push   %r15
  push   %r14
  push   %r13
  mov    -0x80(%rbp),%r9d
  mov    -0x84(%rbp),%r8d
  mov    -0x88(%rbp),%ecx
  mov    %ebx,%edx
  mov    %eax,%esi
  lea    D118(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x60,%rsp
L156:
  lea    -0x40(%rbp),%rax
  mov    $0x8,%edx
  lea    D34(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L211
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L86
L211:
  lea    -0x40(%rbp),%rax
  mov    $0x5,%edx
  lea    D93(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L194
  movzbl -0x3b(%rbp),%eax
  cmp    $0x30,%al
  jle    L194
  movzbl -0x3b(%rbp),%eax
  cmp    $0x39,%al
  jg     L194
  movzbl -0x3a(%rbp),%eax
  cmp    $0x2e,%al
  jne    L194
  movzbl -0x39(%rbp),%eax
  cmp    $0x2f,%al
  jle    L194
  movzbl -0x39(%rbp),%eax
  cmp    $0x39,%al
  jg     L194
  movzbl -0x3b(%rbp),%eax
  sub    $0x30,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  movzbl -0x39(%rbp),%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %al,-0x49(%rbp)
  cmpb   $0x16,-0x49(%rbp)
  jg     L39
  mov    -0x60(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L244
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L244:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fs_load_pre17@plt>
  test   %rax,%rax
  jns    L152
  lea    D63(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L152:
  mov    -0x48(%rbp),%rax
  mov    $0x10,%esi
  mov    %rax,%rdi
  call   <chunk_load@plt>
  test   %rax,%rax
  jns    L41
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L39:
  movsbl -0x49(%rbp),%ecx
  mov    -0x60(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fs_load@plt>
  test   %rax,%rax
  jns    L41
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L194:
  lea    D100(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L41:
  nop
L86:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L61
  lea    D117(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L241
L61:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L241:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L175
  call   <__stack_chk_fail@plt>
L175:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D94
type_infered: string
name: disassemble_data
arguments: label: D98
type_infered: string
name: disassemble_data
arguments: label: D57
type_infered: string
name: disassemble_data
arguments: label: D26
type_infered: string
name: disassemble_data
arguments: label: D118
type_infered: string
name: disassemble_data
arguments: label: D34
type_infered: string
name: disassemble_data
arguments: label: D37
type_infered: string
name: disassemble_data
arguments: label: D93
type_infered: string
name: disassemble_data
arguments: label: D47
type_infered: string
name: disassemble_data
arguments: label: D63
type_infered: string
name: disassemble_data
arguments: label: D2
type_infered: string
name: disassemble_data
arguments: label: D100
type_infered: string
name: disassemble_data
arguments: label: D117
type_infered: string

tool: D94: r

tool: D98: can't open metadata file

tool: D57: can't read metadata header

tool: D26: HEAD

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


tool: D34: MFSM NEW

tool: D37: empty file

tool: D93: MFSM 

tool: D47: old format detected - can't dump sections separatelly

tool: D63: error reading metadata (structure)

tool: D2: error reading metadata (chunks)

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

tool: D117: error reading metadata

assistant: ```c
int fs_loadall(const char *fname, const char section[4]) {
  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;
  }
  if (memcmp(section, "HEAD", 4) == 0 || section[0] == 0) {
    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 (section[0] != 0) {
        printf("old format detected - can't dump sections separatelly");
        fclose(fd);
        return -1;
      }
      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, section) < 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;
}
```