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

```asm
<pathsearch>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rsi,%r12
  mov    $0x2f,%esi
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strrchr@plt>
  test   %rax,%rax
  je     L90
  movzbl (%rax),%r13d
  movb   $0x0,(%rax)
  mov    %r14,%rdi
  mov    %rax,%rbx
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  lea    0x2(%rbp,%rax,1),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L106
L7:
  mov    %r13b,(%rbx)
L71:
  add    $0x18,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L106:
  mov    %r12,%rcx
  mov    %r14,%rdx
  lea    D3(%rip),%rsi
  mov    %rax,%rdi
  call   <lemon_sprintf@plt>
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L90:
  lea    D29(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L51
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edi
L117:
  call   <malloc@plt>
  mov    %rbp,%rdi
  mov    %rax,0x8(%rsp)
  mov    %rax,%r14
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rax,%rbx
  call   <strlen@plt>
  lea    0x2(%rbx,%rax,1),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %r14,%r14
  je     L10
  test   %rax,%rax
  jne    L73
L82:
  xor    %eax,%eax
  xor    %r15d,%r15d
  call   <memory_error@plt>
  jmp    L71
  nopl   0x0(%rax)
L73:
  mov    %rbp,%rsi
  mov    0x8(%rsp),%rbp
  mov    %rbp,%rdi
  call   <lemon_strcpy@plt>
  jmp    L126
  nopw   0x0(%rax,%rax,1)
L135:
  movb   $0x0,0x0(%rbp)
L97:
  mov    %r13d,%esi
  mov    %r15,%rdi
  call   <access@plt>
  test   %rax,%rax
  je     L42
L126:
  cmpb   $0x0,0x0(%rbp)
  je     L42
  mov    $0x3a,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L141
L31:
  movzbl (%rbx),%r14d
  movb   $0x0,(%rbx)
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D3(%rip),%rsi
  mov    %r15,%rdi
  call   <lemon_sprintf@plt>
  mov    %r14b,(%rbx)
  test   %r14b,%r14b
  je     L135
  lea    0x1(%rbx),%rbp
  jmp    L97
  nopl   0x0(%rax)
L141:
  mov    %rbp,%rdi
  call   <strlen@plt>
  movslq %eax,%rbx
  add    %rbp,%rbx
  jmp    L31
  nopl   0x0(%rax,%rax,1)
L42:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  jmp    L71
  nop
L10:
  xor    %eax,%eax
  call   <memory_error@plt>
  test   %r15,%r15
  jne    L71
  jmp    L82
  nopl   (%rax)
L51:
  mov    $0x10,%edi
  lea    D1(%rip),%rbp
  jmp    L117
```

tool_calls: name: parse_data
arguments: data_tag: D3
type_infered: string
name: parse_data
arguments: data_tag: D29
type_infered: string
name: parse_data
arguments: data_tag: D1
type_infered: string

tool: D3: %s/%s

tool: D29: PATH

tool: D1: .:/bin:/usr/bin

assistant: ```c
char *pathsearch(char *argv0, char *name, int modemask) {
  const char *pathlist;
  char *pathbufptr;
  char *pathbuf;
  char *path, *cp;
  char c;
  cp = strrchr(argv0, '/');
  if (cp) {
    c = *cp;
    *cp = 0;
    path = (char *)malloc(((int)strlen(argv0)) + ((int)strlen(name)) + 2);
    if (path)
      lemon_sprintf(path, "%s/%s", argv0, name);
    *cp = c;
  } else {
    pathlist = getenv("PATH");
    if (pathlist == 0)
      pathlist = ".:/bin:/usr/bin";
    pathbuf = (char *)malloc(((int)strlen(pathlist)) + 1);
    path = (char *)malloc(((int)strlen(pathlist)) + ((int)strlen(name)) + 2);
    if ((pathbuf) == 0) {
      extern void memory_error();
      memory_error();
    };
    if ((path) == 0) {
      extern void memory_error();
      memory_error();
    };
    if ((pathbuf != 0) && (path != 0)) {
      pathbufptr = pathbuf;
      lemon_strcpy(pathbuf, pathlist);
      while (*pathbuf) {
        cp = strchr(pathbuf, ':');
        if (cp == 0)
          cp = &pathbuf[((int)strlen(pathbuf))];
        c = *cp;
        *cp = 0;
        lemon_sprintf(path, "%s/%s", pathbuf, name);
        *cp = c;
        if (c == 0)
          pathbuf[0] = 0;
        else
          pathbuf = &cp[1];
        if (access(path, modemask) == 0)
          break;
      }
      free(pathbufptr);
    }
  }
  return path;
}
```