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

```asm
<load_terminfo>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x10,%rsp
  lea    D43(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x1008(%rsp)
  xor    %eax,%eax
  call   <getenv@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L114
  lea    D24(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L116
  mov    0x1008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L109
  add    $0x1010,%rsp
  mov    %r12,%rsi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    10b0 <terminfo_try_path@plt>
  nopl   0x0(%rax)
L116:
  lea    D47(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rcx
  test   %rax,%rax
  je     L65
  mov    %rsp,%rbp
  mov    $0x1000,%esi
  lea    D91(%rip),%rdx
  mov    %rbp,%rdi
  call   <snprintf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movb   $0x0,0xfff(%rsp)
  call   <terminfo_try_path@plt>
  test   %rax,%rax
  je     L65
L68:
  mov    %rax,%r12
L114:
  mov    0x1008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L109
  add    $0x1010,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L65:
  lea    D8(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rcx
  test   %rax,%rax
  je     L6
  mov    %rsp,%rbp
  lea    D16(%rip),%rdx
  mov    $0x1000,%esi
  mov    %rbp,%rdi
  lea    D29(%rip),%rbx
  call   <snprintf@plt>
  mov    %rbp,%rdi
  mov    %rbx,%rsi
  movb   $0x0,0xfff(%rsp)
  call   <strtok@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L6
  lea    D15(%rip),%r14
  lea    D41(%rip),%r13
  jmp    L121
  nopl   0x0(%rax)
L71:
  mov    %rbx,%rsi
  xor    %edi,%edi
  call   <strtok@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L6
L121:
  mov    %rbp,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  mov    %r12,%rsi
  test   %rax,%rax
  cmove  %r13,%rbp
  mov    %rbp,%rdi
  call   <terminfo_try_path@plt>
  test   %rax,%rax
  je     L71
  jmp    L68
  nopl   0x0(%rax)
L6:
  mov    %r12,%rsi
  lea    D41(%rip),%rdi
  call   <terminfo_try_path@plt>
  mov    %rax,%r12
  jmp    L114
L109:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D43
type: string
name: extract_symbolic_data
arguments: data_label: D24
type: string
name: extract_symbolic_data
arguments: data_label: D47
type: string
name: extract_symbolic_data
arguments: data_label: D91
type: string
name: extract_symbolic_data
arguments: data_label: D8
type: string
name: extract_symbolic_data
arguments: data_label: D16
type: string
name: extract_symbolic_data
arguments: data_label: D29
type: string
name: extract_symbolic_data
arguments: data_label: D15
type: string
name: extract_symbolic_data
arguments: data_label: D41
type: string

tool: D43: TERM

tool: D24: TERMINFO

tool: D47: HOME

tool: D91: %s/.terminfo

tool: D8: TERMINFO_DIRS

tool: D16: %s

tool: D29: :

tool: 

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