user: Translate the below assembly code into C programming language:

```asm
<pathsearch>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  mov    $0x2f,%esi
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <strrchr@plt>
  test   %rax,%rax
  je     L11
  movzbl (%rax),%r14d
  movb   $0x0,(%rax)
  mov    %r15,%rdi
  mov    %rax,%rbx
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  lea    0x2(%rbp,%rax,1),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L30
  mov    %rax,%rdi
  mov    %r13,%rcx
  mov    %r15,%rdx
  xor    %eax,%eax
  lea    D32(%rip),%rsi
  call   <sprintf@plt>
L30:
  mov    %r14b,(%rbx)
L23:
  mov    %r12,%rsi
  lea    D56(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L11:
  lea    D52(%rip),%rdi
  xor    %eax,%eax
  call   <getenv@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L16
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rbx
L71:
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x2(%rbx,%rax,1),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L84
  jmp    L23
  nopl   0x0(%rax)
L29:
  movzbl (%rbx),%r15d
  movb   $0x0,(%rbx)
  mov    %r14,%rdx
  mov    %r12,%rdi
  lea    D32(%rip),%rsi
  xor    %eax,%eax
  mov    %r13,%rcx
  add    $0x1,%rbx
  lea    D38(%rip),%r14
  call   <sprintf@plt>
  mov    %r15b,-0x1(%rbx)
  test   %r15b,%r15b
  mov    %ebp,%esi
  cmovne %rbx,%r14
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <access@plt>
  test   %eax,%eax
  je     L23
L84:
  cmpb   $0x0,(%r14)
  je     L23
  mov    $0x3a,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L29
  mov    %r14,%rdi
  call   <strlen@plt>
  lea    (%r14,%rax,1),%rbx
  jmp    L29
  nopl   (%rax)
L16:
  mov    $0xf,%ebx
  lea    D15(%rip),%r14
  jmp    L71
```

tool_calls: name: read_data
arguments: tag: D32
type_guessed: string
name: read_data
arguments: tag: D56
type_guessed: string
name: read_data
arguments: tag: D52
type_guessed: string
name: read_data
arguments: tag: D38
type_guessed: string
name: read_data
arguments: tag: D15
type_guessed: string

tool: D32: %s/%s

tool: D56: pathsearch %s


tool: D52: PATH

tool: 

tool: D15: .:/bin:/usr/bin

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