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

```asm
<getmap>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  cmp    $0xffffffff,%edi
  je     L18
  test   %esi,%esi
  lea    D86(%rip),%rax
  lea    D96(%rip),%rdx
  mov    %edi,%esi
  cmovne %rax,%rdx
  lea    D81(%rip),%rdi
  xor    %eax,%eax
  call   <string@plt>
  mov    %rax,%r13
L89:
  lea    D117(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L42
L57:
  lea    0x20(%rsp),%r12
  lea    0x10(%rsp),%rbx
  lea    D51(%rip),%r15
  lea    D13(%rip),%r14
  jmp    L72
  nopl   0x0(%rax)
L12:
  mov    0x10(%rsp),%rdi
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  mov    %r15,%rsi
  lea    0x4(%rsp),%r8
  call   <sscanf@plt>
  cmp    $0x3,%eax
  je     L56
  mov    %r13,%rdx
  lea    D80(%rip),%rsi
  xor    %edi,%edi
  call   <die@plt>
L56:
  cmpq   $0x0,0x18(%rsp)
  lea    D125(%rip),%rdx
  mov    0x4(%rsp),%r9d
  lea    0x18(%rsp),%rdi
  cmovne %r14,%rdx
  mov    0xc(%rsp),%r8d
  mov    0x8(%rsp),%ecx
  lea    D68(%rip),%rsi
  call   <append@plt>
L72:
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jns    L12
  cmpq   $0x0,0x18(%rsp)
  je     L55
L87:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L18:
  test   %esi,%esi
  lea    D86(%rip),%rax
  lea    D96(%rip),%rsi
  cmovne %rax,%rsi
  lea    D61(%rip),%rdi
  xor    %eax,%eax
  call   <string@plt>
  mov    %rax,%r13
  jmp    L89
  nopw   0x0(%rax,%rax,1)
L55:
  mov    %r13,%rdx
  lea    D80(%rip),%rsi
  xor    %edi,%edi
  call   <die@plt>
  jmp    L87
  cs nopw 0x0(%rax,%rax,1)
L42:
  mov    %r13,%rdx
  lea    D135(%rip),%rsi
  xor    %edi,%edi
  call   <die@plt>
  jmp    L57
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D86
type: string
name: parse_data
arguments: tag: D96
type: string
name: parse_data
arguments: tag: D81
type: string
name: parse_data
arguments: tag: D117
type: string
name: parse_data
arguments: tag: D51
type: string
name: parse_data
arguments: tag: D13
type: string
name: parse_data
arguments: tag: D80
type: string
name: parse_data
arguments: tag: D125
type: string
name: parse_data
arguments: tag: D68
type: string
name: parse_data
arguments: tag: D61
type: string
name: parse_data
arguments: tag: D135
type: string

tool: D86: uid_map

tool: D96: gid_map

tool: D81: /proc/%d/%s

tool: D117: r

tool: D51:  %u %u %u

tool: D13: ,

tool: D80: Invalid map data in %s

tool: 

tool: D68: %s%u:%u:%u

tool: D61: /proc/self/%s

tool: D135: Cannot read %s

assistant: ```c
char *getmap(pid_t pid, int type) {
  char *line = NULL, *result = NULL, *path;
  size_t size;
  unsigned count, first, lower;
  FILE *file;
  if (pid == -1)
    path = string("/proc/self/%s", ((type) == 0 ? "gid_map" : "uid_map"));
  else
    path = string("/proc/%d/%s", pid, ((type) == 0 ? "gid_map" : "uid_map"));
  if (!(file = fopen(path, "r")))
    die(0, "Cannot read %s", path);
  while (getline(&line, &size, file) >= 0) {
    if (sscanf(line, " %u %u %u", &first, &lower, &count) != 3)
      die(0, "Invalid map data in %s", path);
    append(&result, "%s%u:%u:%u", result ? "," : "", first, lower, count);
  }
  if (!result)
    die(0, "Invalid map data in %s", path);
  fclose(file);
  free(line);
  free(path);
  return result;
}
```