user: What is the c source code of the assembly code below?

```asm
<fs_loadall>:
  endbr64
  push   %r15
  lea    D90(%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     L168
  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    L88
  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    D46(%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    D27(%rip),%rsi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L15
  mov    $0x5,%edx
  lea    D53(%rip),%rsi
  mov    %r15,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L118
  movzbl 0x35(%rsp),%esi
  lea    -0x31(%rsi),%eax
  cmp    $0x8,%al
  ja     L118
  cmpb   $0x2e,0x36(%rsp)
  jne    L118
  movzbl 0x37(%rsp),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L118
  shl    $0x4,%esi
  add    %eax,%esi
  cmp    $0x16,%sil
  jg     L98
  mov    %rbp,%rdi
  call   <fs_load_pre17@plt>
  test   %rax,%rax
  js     L123
  mov    $0x10,%esi
  mov    %rbp,%rdi
  call   <chunk_load@plt>
  test   %rax,%rax
  js     L49
L4:
  mov    %rbp,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L190
  mov    %rbp,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
L158:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L130
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L15:
  lea    D45(%rip),%rdi
  call   <puts@plt>
  jmp    L4
  xchg   %ax,%ax
L98:
  movsbl %sil,%esi
  mov    %rbp,%rdi
  call   <fs_load@plt>
  test   %rax,%rax
  jns    L4
  nopl   0x0(%rax)
L53:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L158
  nopw   0x0(%rax,%rax,1)
L118:
  lea    D71(%rip),%rdi
  call   <puts@plt>
  jmp    L53
  xchg   %ax,%ax
L88:
  lea    D108(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L190:
  lea    D69(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L168:
  lea    D80(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L123:
  lea    D0(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L49:
  lea    D79(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  or     $0xffffffff,%eax
  jmp    L158
L130:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D90
datatype: string
name: retrieve_data
arguments: data_label: D46
datatype: string
name: retrieve_data
arguments: data_label: D27
datatype: string
name: retrieve_data
arguments: data_label: D53
datatype: string
name: retrieve_data
arguments: data_label: D45
datatype: string
name: retrieve_data
arguments: data_label: D71
datatype: string
name: retrieve_data
arguments: data_label: D108
datatype: string
name: retrieve_data
arguments: data_label: D69
datatype: string
name: retrieve_data
arguments: data_label: D80
datatype: string
name: retrieve_data
arguments: data_label: D0
datatype: string
name: retrieve_data
arguments: data_label: D79
datatype: string

tool: D90: r

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


tool: D27: MFSM NEW

tool: D53: MFSM 

tool: D45: empty file

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

tool: D108: can't read metadata header

tool: D69: error reading metadata

tool: D80: can't open metadata file

tool: D0: error reading metadata (structure)

tool: D79: 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;
}
```