user: What would the C source look like for the assembly code provided here:

```asm
<load_terminfo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D98(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x1040(%rbp)
  cmpq   $0x0,-0x1040(%rbp)
  jne    L114
  mov    $0x0,%eax
  jmp    L47
L114:
  lea    D77(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x1038(%rbp)
  cmpq   $0x0,-0x1038(%rbp)
  je     L13
  mov    -0x1040(%rbp),%rdx
  mov    -0x1038(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <terminfo_try_path@plt>
  jmp    L47
L13:
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x1030(%rbp)
  cmpq   $0x0,-0x1030(%rbp)
  je     L32
  mov    -0x1030(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rdx,%rcx
  lea    D83(%rip),%rdx
  mov    $0x1000,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  movb   $0x0,-0x11(%rbp)
  mov    -0x1040(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <terminfo_try_path@plt>
  mov    %rax,-0x1028(%rbp)
  cmpq   $0x0,-0x1028(%rbp)
  je     L32
  mov    -0x1028(%rbp),%rax
  jmp    L47
L32:
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x1020(%rbp)
  cmpq   $0x0,-0x1020(%rbp)
  je     L81
  mov    -0x1020(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rdx,%rcx
  lea    D69(%rip),%rdx
  mov    $0x1000,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  movb   $0x0,-0x11(%rbp)
  lea    -0x1010(%rbp),%rax
  lea    D27(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strtok@plt>
  mov    %rax,-0x1050(%rbp)
  jmp    L102
L121:
  mov    -0x1050(%rbp),%rax
  mov    %rax,-0x1048(%rbp)
  mov    -0x1048(%rbp),%rax
  lea    D99(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L96
  lea    D2(%rip),%rax
  mov    %rax,-0x1048(%rbp)
L96:
  mov    -0x1040(%rbp),%rdx
  mov    -0x1048(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <terminfo_try_path@plt>
  mov    %rax,-0x1018(%rbp)
  cmpq   $0x0,-0x1018(%rbp)
  je     L23
  mov    -0x1018(%rbp),%rax
  jmp    L47
L23:
  lea    D27(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x1050(%rbp)
L102:
  cmpq   $0x0,-0x1050(%rbp)
  jne    L121
L81:
  mov    -0x1040(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <terminfo_try_path@plt>
L47:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D98
type_guessed: string
name: retrieve_data
arguments: tag: D77
type_guessed: string
name: retrieve_data
arguments: tag: D6
type_guessed: string
name: retrieve_data
arguments: tag: D83
type_guessed: string
name: retrieve_data
arguments: tag: D42
type_guessed: string
name: retrieve_data
arguments: tag: D69
type_guessed: string
name: retrieve_data
arguments: tag: D27
type_guessed: string
name: retrieve_data
arguments: tag: D99
type_guessed: string
name: retrieve_data
arguments: tag: D2
type_guessed: string

tool: D98: TERM

tool: D77: TERMINFO

tool: D6: HOME

tool: D83: %s/.terminfo

tool: D42: TERMINFO_DIRS

tool: D69: %s

tool: D27: :

tool: 

tool: D2: /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);
}
```