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

```asm
<cap_getstr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x848,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rcx,(%rsp)
  mov    %r8d,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x838(%rsp)
  mov    D54(%rip),%eax
  add    $0x1,%eax
  mov    %eax,D53(%rip)
  cmp    $0x20,%eax
  jg     L28
  mov    %rsi,%rbx
  lea    D53(%rip),%rsi
  mov    %rdx,%r13
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L59
  lea    0x30(%rsp),%r15
  lea    D21(%rip),%r12
L95:
  mov    $0x800,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <cap_getent@plt>
  test   %rax,%rax
  jle    L172
  mov    $0x3a,%esi
  mov    %r15,%rdi
  lea    0x20(%rsp),%rbp
  call   <strchr@plt>
  mov    %r15,%rdi
  mov    %rbp,%rdx
  mov    %r12,%rsi
  movb   $0x0,(%rax)
  mov    %rax,0x18(%rsp)
  call   <strtok_r@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  jne    L162
  jmp    L95
  nopl   0x0(%rax)
L76:
  xor    %edi,%edi
  mov    %rbp,%rdx
  mov    %r12,%rsi
  call   <strtok_r@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L95
L162:
  mov    %rbx,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L76
  mov    0x18(%rsp),%rdi
  lea    0x28(%rsp),%rbp
  lea    D22(%rip),%rbx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  add    $0x1,%rdi
  call   <strtok_r@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L172
  lea    D5(%rip),%r12
  nopl   0x0(%rax)
L13:
  mov    $0x2,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L34
  cmpb   $0x3d,0x2(%r15)
  je     L94
L34:
  mov    $0x3,%edx
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L136
  mov    0xc(%rsp),%r8d
  mov    (%rsp),%rcx
  lea    0x3(%r15),%rsi
  mov    %r13,%rdx
  mov    0x10(%rsp),%rdi
  call   <cap_getstr>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L57
L136:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  xor    %edi,%edi
  call   <strtok_r@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L13
L172:
  xor    %r15d,%r15d
L57:
  mov    %r14,%rdi
  subl   $0x1,D53(%rip)
  call   <fclose@plt>
L51:
  mov    0x838(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L108
  add    $0x848,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L59:
  subl   $0x1,D53(%rip)
L28:
  xor    %r15d,%r15d
  jmp    L51
  nopl   0x0(%rax)
L94:
  mov    (%rsp),%rbx
  add    $0x3,%r15
  mov    %r15,%rdi
  test   %rbx,%rbx
  je     L53
  call   <strlen@plt>
  cmp    0xc(%rsp),%eax
  jge    L28
  mov    %r15,%rsi
  mov    %rbx,%rdi
  mov    %rbx,%r15
  call   <strcpy@plt>
  jmp    L57
L53:
  call   <s_dup@plt>
  mov    %rax,%r15
  jmp    L57
L108:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D53
type: string
name: retrieve_data
arguments: tag: D21
type: string
name: retrieve_data
arguments: tag: D22
type: string
name: retrieve_data
arguments: tag: D5
type: string

tool: D53: r

tool: D21: |

tool: D22: :

tool: D5: tc=

assistant: ```c
char *cap_getstr(const char *path, const char *entname, const char *strname, char *buf, int bufsize) {
  FILE *fp;
  char *cp, *tp;
  char *lcp, *ltp;
  static int rlev = 0;
  char *retval = NULL;
  char entbuf[2048];
  if (++rlev > 32)
    return NULL;
  fp = fopen(path, "r");
  if (fp == NULL)
    goto Exit;
  while (cap_getent(fp, entbuf, sizeof(entbuf)) > 0) {
    tp = strchr(entbuf, ':');
    *tp++ = '\0';
    cp = strtok_r(entbuf, "|", &lcp);
    while (cp) {
      if (strcmp(cp, entname) == 0) {
        tp = strtok_r(tp, ":", &ltp);
        while (tp) {
          if (strncmp(tp, strname, 2) == 0 && tp[2] == '=') {
            if (buf) {
              if (strlen(tp + 3) >= bufsize)
                return NULL;
              strcpy(buf, tp + 3);
              retval = buf;
            } else
              retval = s_dup(tp + 3);
            goto Exit;
          } else if (strncmp(tp, "tc=", 3) == 0) {
            retval = cap_getstr(path, tp + 3, strname, buf, bufsize);
            if (retval)
              goto Exit;
          }
          tp = strtok_r(NULL, ":", &ltp);
        }
        goto Exit;
      }
      cp = strtok_r(NULL, "|", &lcp);
    }
  }
Exit:
  --rlev;
  if (fp)
    fclose(fp);
  return retval;
}
```