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

```asm
<load_table>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  lea    D0(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L24
  mov    $0xffffffff,%eax
  jmp    L123
L57:
  lea    -0x12(%rbp),%rax
  lea    D13(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L40
  mov    -0x2c(%rbp),%eax
  or     $0x40,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x24(%rbp),%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  or     %edx,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L97
L40:
  lea    -0x12(%rbp),%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L97
  mov    -0x2c(%rbp),%eax
  or     $0x20,%eax
  mov    %eax,-0x2c(%rbp)
L97:
  mov    -0x28(%rbp),%eax
  cmp    $0x1,%eax
  jne    L122
  mov    -0x2c(%rbp),%eax
  or     $0x80,%al
  mov    %eax,-0x2c(%rbp)
L122:
  mov    -0x30(%rbp),%eax
  shr    %eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  cmp    %eax,%edx
  jb     L85
  mov    $0xffffffff,%eax
  jmp    L123
L85:
  mov    -0x2c(%rbp),%edx
  mov    -0x30(%rbp),%eax
  shr    %eax
  mov    %eax,%eax
  lea    (%rax,%rax,1),%rcx
  mov    -0x40(%rbp),%rax
  add    %rcx,%rax
  mov    %dx,(%rax)
L24:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L86
  lea    -0x12(%rbp),%r8
  lea    -0x28(%rbp),%rdi
  lea    -0x2c(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x24(%rbp),%rsi
  push   %rsi
  mov    %r8,%r9
  mov    %rdi,%r8
  lea    D14(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  add    $0x10,%rsp
  cmp    $0x5,%eax
  je     L57
L86:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  je     L83
  mov    $0xffffffff,%eax
  jmp    L123
L83:
  mov    $0x0,%eax
L123:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L58
  call   <__stack_chk_fail@plt>
L58:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D0
type_guessed: string
name: read_data
arguments: tag: D13
type_guessed: string
name: read_data
arguments: tag: D4
type_guessed: string
name: read_data
arguments: tag: D14
type_guessed: string

tool: D0: r

tool: D13: ldr

tool: D4: str

tool: D14: %x:%d:%d:%[^:]:%d


assistant: ```c
int load_table(const char *filename, unsigned short *table, int size) {
  FILE *fp;
  fp = fopen(filename, "r");
  if (!fp) {
    return -1;
  }
  unsigned int address, cycles, branch, memory_utilization;
  char instruction_name[10];
  while (!feof(fp) && fscanf(fp, "%x:%d:%d:%[^:]:%d\n", &address, &cycles, &branch, instruction_name, &memory_utilization) == 5) {
    if (strstr(instruction_name, "ldr") != NULL) {
      cycles = cycles | 0x40;
      cycles = cycles | (memory_utilization << 8);
    } else if (strstr(instruction_name, "str") != NULL) {
      cycles = cycles | 0x20;
    }
    if (branch == 1) {
      cycles = cycles | 0x80;
    }
    if (address >> 1 >= size) {
      return -1;
    }
    table[address >> 1] = cycles;
  }
  if (fclose(fp) != 0) {
    return -1;
  }
  return 0;
}
```