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

```asm
<get_cgroup>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x120,%rsp
  mov    %rsi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  test   %edi,%edi
  je     L128
  mov    %edi,%ecx
  lea    0x10(%rsp),%rdi
  lea    D1(%rip),%rdx
  mov    $0x100,%esi
  call   <snprintf@plt>
L145:
  mov    $0x0,%ebx
  cmp    $0xff,%eax
  ja     L51
  lea    0x10(%rsp),%rdi
  lea    D22(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L44
  lea    0x8(%rsp),%r13
L40:
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  mov    %r13,%rsi
  call   <getline@plt>
  cmp    $0xffffffff,%eax
  je     L1
  mov    (%rsp),%rdi
  cmpb   $0x0,(%rdi)
  je     L40
  mov    $0x3a,%esi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L36
  lea    0x1(%rax),%r14
  mov    $0x3a,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L36
  movb   $0x0,(%rax)
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <controller_in_clist@plt>
  test   %eax,%eax
  je     L40
  lea    0x1(%rbx),%r12
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  je     L97
  add    %rbx,%rax
  cmpb   $0xa,(%rax)
  je     L35
L97:
  lea    D30(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  mov    $0x0,%ebx
  test   %rax,%rax
  jne    L43
L36:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
L51:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L132
  mov    %rbx,%rax
  add    $0x120,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L128:
  lea    0x10(%rsp),%rdi
  lea    D33(%rip),%rdx
  mov    $0x100,%esi
  mov    $0x0,%eax
  call   <snprintf@plt>
  jmp    L145
L35:
  movb   $0x0,(%rax)
  jmp    L97
L43:
  mov    %r12,%rdi
  call   <strdup@plt>
  mov    %rax,%rbx
  jmp    L36
L1:
  mov    $0x0,%ebx
  jmp    L36
L44:
  mov    %rax,%rbx
  jmp    L51
L132:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D1
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D22
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D30
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D33
type_guessed: string

tool: D1: /proc/%d/cgroup

tool: D22: r

tool: D30: /

tool: D33: /proc/self/cgroup

assistant: ```c
char *get_cgroup(pid_t pid, const char *contrl) {
  char fn[256];
  FILE *f;
  char *line = NULL;
  size_t len = 0;
  size_t l = 0;
  int ret;
  char *cgrp = NULL;
  char *c1, *c2;
  if (pid) {
    ret = snprintf(fn, 256, "/proc/%d/cgroup", pid);
  } else {
    ret = snprintf(fn, 256, "/proc/self/cgroup");
  }
  if (ret < 0 || ret >= 256)
    return NULL;
  if (!(f = fopen(fn, "r")))
    return NULL;
  while (getline(&line, &len, f) != -1) {
    if (!line[0])
      continue;
    c1 = strchr(line, ':');
    if (!c1)
      goto out;
    c1++;
    c2 = strchr(c1, ':');
    if (!c2)
      goto out;
    *c2 = '\0';
    if (!controller_in_clist(c1, contrl))
      continue;
    c2++;
    l = strlen(c2);
    if (l && c2[l - 1] == '\n')
      c2[l - 1] = '\0';
    if (strcmp(c2, "/") == 0)
      goto out;
    cgrp = strdup(c2);
    break;
  }
out:
  fclose(f);
  free(line);
  return cgrp;
}
```