user: Demonstrate the C code that generates the assembly output below:

```asm
<grabber_local_get>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x4a8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x498(%rsp)
  lea    D6(%rip),%rax
  mov    %rax,0x38(%rsp)
  lea    D61(%rip),%rax
  mov    %rax,0x40(%rsp)
  lea    D103(%rip),%rax
  mov    %rax,0x48(%rsp)
  lea    D58(%rip),%rax
  mov    %rax,0x58(%rsp)
  lea    D109(%rip),%rax
  mov    %rax,0x60(%rsp)
  lea    D54(%rip),%rax
  mov    %rax,0x68(%rsp)
  lea    D125(%rip),%rax
  mov    %rax,0x70(%rsp)
  lea    D46(%rip),%rax
  mov    %rax,0x78(%rsp)
  lea    D32(%rip),%rax
  mov    %rax,0x80(%rsp)
  lea    D131(%rip),%rax
  mov    %rax,0x88(%rsp)
  test   %rdi,%rdi
  je     L148
  mov    $0x2f,%esi
  mov    %rdi,%rbx
  call   <strrchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L148
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  sub    %eax,%esi
  call   <strndup@plt>
  mov    $0x2e,%esi
  mov    %rbx,%rdi
  mov    %rax,%r12
  call   <strrchr@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L107
  mov    %rbx,%rdi
  mov    %r12,%r14
  xor    %r15d,%r15d
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  mov    %r13,%rdi
  sub    %eax,%ebp
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%r13d
  call   <strlen@plt>
  sub    %r13d,%ebp
  lea    D1(%rip),%r13
  cltq
  lea    -0x1(%rbp),%esi
  lea    0x1(%rbx,%rax,1),%rdi
  lea    0x90(%rsp),%rbx
  call   <strndup@plt>
  lea    0x58(%rsp),%rdx
  mov    %rbx,%r12
  lea    D10(%rip),%r9
  mov    %rdx,0x10(%rsp)
  mov    %rdx,%rbp
  lea    0xa0(%rsp),%rdx
  mov    %rax,%rbx
  mov    %rax,0x28(%rsp)
  mov    %rdx,(%rsp)
  jmp    L106
  nopl   0x0(%rax,%rax,1)
L111:
  mov    0x0(%rbp),%r9
  add    $0x8,%rbp
L106:
  mov    (%rsp),%rdi
  pxor   %xmm0,%xmm0
  mov    %r15,%rax
  mov    $0x7e,%ecx
  movaps %xmm0,0x90(%rsp)
  mov    %rbx,%r8
  mov    %r13,%rdx
  mov    $0x400,%esi
  rep stos %rax,%es:(%rdi)
  mov    %r12,%rdi
  mov    %r14,%rcx
  call   <snprintf@plt>
  mov    %r12,%rdi
  call   <vh_file_exists@plt>
  test   %rax,%rax
  jne    L67
  cmp    %rbp,%r12
  jne    L111
  lea    0x30(%rsp),%rax
  mov    %rbp,0x20(%rsp)
  mov    %r12,%rbx
  lea    D10(%rip),%r15
  mov    %rax,0x18(%rsp)
  lea    0x50(%rsp),%rax
  mov    %r14,%r12
  mov    %rax,0x8(%rsp)
L150:
  mov    %r15,%rax
  mov    0x18(%rsp),%r14
  mov    %r12,%r15
  xor    %ebp,%ebp
  lea    D38(%rip),%r8
  mov    %rax,%r12
L138:
  mov    (%rsp),%rdi
  pxor   %xmm0,%xmm0
  mov    %rbp,%rax
  mov    $0x7e,%ecx
  movaps %xmm0,0x90(%rsp)
  mov    %r12,%r9
  mov    %r13,%rdx
  mov    $0x400,%esi
  rep stos %rax,%es:(%rdi)
  mov    %rbx,%rdi
  mov    %r15,%rcx
  call   <snprintf@plt>
  mov    %rbx,%rdi
  call   <vh_file_exists@plt>
  test   %rax,%rax
  jne    L75
  add    $0x8,%r14
  cmp    %r14,0x8(%rsp)
  je     L46
  mov    (%r14),%r8
  jmp    L138
  nopw   0x0(%rax,%rax,1)
L46:
  mov    0x10(%rsp),%rax
  mov    0x20(%rsp),%rdx
  mov    %r15,%r12
  cmp    %rdx,%rax
  je     L102
  mov    (%rax),%r15
  add    $0x8,%rax
  mov    %rax,0x10(%rsp)
  jmp    L150
  nopw   0x0(%rax,%rax,1)
L148:
  xor    %r13d,%r13d
L84:
  mov    0x498(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  add    $0x4a8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L75:
  mov    %rbx,%rdi
  mov    %r15,%r12
  call   <strdup@plt>
  mov    %rax,%r13
L10:
  test   %r12,%r12
  je     L113
  mov    %r12,%rdi
  call   <free@plt>
L113:
  mov    0x28(%rsp),%rax
  test   %rax,%rax
  je     L84
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L84
  nop
L67:
  mov    %r12,%rbx
  mov    %r14,%r12
  mov    %rbx,%rdi
  call   <strdup@plt>
  mov    %rax,%r13
  jmp    L10
  nopl   0x0(%rax,%rax,1)
L102:
  xor    %r13d,%r13d
  jmp    L10
  nopl   (%rax)
L107:
  test   %r12,%r12
  je     L148
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L84
L121:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D6
datatype: string
name: retrieve_data
arguments: data_tag: D61
datatype: string
name: retrieve_data
arguments: data_tag: D103
datatype: string
name: retrieve_data
arguments: data_tag: D58
datatype: string
name: retrieve_data
arguments: data_tag: D109
datatype: string
name: retrieve_data
arguments: data_tag: D54
datatype: string
name: retrieve_data
arguments: data_tag: D125
datatype: string
name: retrieve_data
arguments: data_tag: D46
datatype: string
name: retrieve_data
arguments: data_tag: D32
datatype: string
name: retrieve_data
arguments: data_tag: D131
datatype: string
name: retrieve_data
arguments: data_tag: D1
datatype: string
name: retrieve_data
arguments: data_tag: D10
datatype: string
name: retrieve_data
arguments: data_tag: D38
datatype: string

tool: D6: COVER

tool: D61: front

tool: D103: FRONT

tool: D58: JPG

tool: D109: jpeg

tool: D54: JPEG

tool: D125: png

tool: D46: PNG

tool: D32: tbn

tool: D131: TBN

tool: D1: %s/%s.%s

tool: D10: jpg

tool: D38: cover

assistant: ```c
char *grabber_local_get(const char *filename) {
  char *s, *dir = NULL, *file = NULL, *cv = NULL;
  unsigned int i, j;
  const char *known_filenames[] = {"cover", "COVER", "front", "FRONT"};
  const char *known_extensions[] = {"jpg", "JPG", "jpeg", "JPEG", "png", "PNG", "tbn", "TBN"};
  if (!filename)
    goto get_end;
  s = strrchr(filename, '/');
  if (!s)
    goto get_end;
  dir = strndup(filename, strlen(filename) - strlen(s));
  s = strrchr(filename, '.');
  if (!s)
    goto get_end;
  file = strndup(filename + strlen(dir) + 1, strlen(filename) - strlen(dir) - strlen(s) - 1);
  for (i = 0; i < (sizeof(known_extensions) / sizeof(known_extensions[0])); i++) {
    char cover[1024] = {0};
    snprintf(cover, sizeof(cover), "%s/%s.%s", dir, file, known_extensions[i]);
    if (vh_file_exists(cover)) {
      cv = strdup(cover);
      goto get_end;
    }
  }
  for (i = 0; i < (sizeof(known_extensions) / sizeof(known_extensions[0])); i++)
    for (j = 0; j < (sizeof(known_filenames) / sizeof(known_filenames[0])); j++) {
      char cover[1024] = {0};
      snprintf(cover, sizeof(cover), "%s/%s.%s", dir, known_filenames[j], known_extensions[i]);
      if (vh_file_exists(cover)) {
        cv = strdup(cover);
        goto get_end;
      }
    }
get_end:
  if (dir)
    free(dir);
  if (file)
    free(file);
  return cv;
}
```