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

```asm
<load_terminfo>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1008(%rsp)
  xor    %eax,%eax
  lea    D78(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L14
  lea    D70(%rip),%rdi
  call   <getenv@plt>
  test   %rax,%rax
  je     L53
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <terminfo_try_path@plt>
  mov    %rax,%rbp
L14:
  mov    0x1008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L101
  mov    %rbp,%rax
  add    $0x1010,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L53:
  lea    D45(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rcx
  test   %rax,%rax
  je     L110
  mov    %rsp,%rbx
  lea    D97(%rip),%rdx
  mov    $0x1000,%esi
  mov    %rbx,%rdi
  call   <snprintf@plt>
  movb   $0x0,0xfff(%rsp)
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <terminfo_try_path@plt>
  test   %rax,%rax
  je     L110
  mov    %rax,%rbp
  jmp    L14
L110:
  lea    D103(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rcx
  test   %rax,%rax
  je     L60
  mov    %rsp,%rbx
  lea    D52(%rip),%rdx
  mov    $0x1000,%esi
  mov    %rbx,%rdi
  call   <snprintf@plt>
  movb   $0x0,0xfff(%rsp)
  lea    D25(%rip),%rsi
  mov    %rbx,%rdi
  call   <strtok@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L60
  lea    D31(%rip),%r13
  lea    D64(%rip),%r12
  lea    D25(%rip),%r14
L113:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  cmove  %r12,%rbx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <terminfo_try_path@plt>
  test   %rax,%rax
  jne    L107
  mov    %r14,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L113
L60:
  mov    %rbp,%rsi
  lea    D64(%rip),%rdi
  call   <terminfo_try_path@plt>
  mov    %rax,%rbp
  jmp    L14
L107:
  mov    %rax,%rbp
  jmp    L14
L101:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D78
type_guessed: string
name: retrieve_data
arguments: label: D70
type_guessed: string
name: retrieve_data
arguments: label: D45
type_guessed: string
name: retrieve_data
arguments: label: D97
type_guessed: string
name: retrieve_data
arguments: label: D103
type_guessed: string
name: retrieve_data
arguments: label: D52
type_guessed: string
name: retrieve_data
arguments: label: D25
type_guessed: string
name: retrieve_data
arguments: label: D31
type_guessed: string
name: retrieve_data
arguments: label: D64
type_guessed: string

tool: D78: TERM

tool: D70: TERMINFO

tool: D45: HOME

tool: D97: %s/.terminfo

tool: D103: TERMINFO_DIRS

tool: D52: %s

tool: D25: :

tool: 

tool: D64: /usr/share/terminfo

assistant: ```c
char *load_terminfo(void) {
  char tmp[4096];
  const char *term = getenv("TERM");
  if (!term) {
    return 0;
  }
  const char *terminfo = getenv("TERMINFO");
  if (terminfo) {
    return terminfo_try_path(terminfo, term);
  }
  const char *home = getenv("HOME");
  if (home) {
    snprintf(tmp, sizeof(tmp), "%s/.terminfo", home);
    tmp[sizeof(tmp) - 1] = '\0';
    char *data = terminfo_try_path(tmp, term);
    if (data)
      return data;
  }
  const char *dirs = getenv("TERMINFO_DIRS");
  if (dirs) {
    snprintf(tmp, sizeof(tmp), "%s", dirs);
    tmp[sizeof(tmp) - 1] = '\0';
    char *dir = strtok(tmp, ":");
    while (dir) {
      const char *cdir = dir;
      if (strcmp(cdir, "") == 0) {
        cdir = "/usr/share/terminfo";
      }
      char *data = terminfo_try_path(cdir, term);
      if (data)
        return data;
      dir = strtok(0, ":");
    }
  }
  return terminfo_try_path("/usr/share/terminfo", term);
}
```