user: What is the c source code of the assembly code below?

```asm
<pathexpand>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbx
  cmpb   $0x0,(%rsi)
  lea    D4(%rip),%rax
  cmove  %rax,%rbx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L398
  mov    %rdi,%r12
  cmpb   $0x2f,(%rbx)
  je     L305
  cmp    $0x2f,%al
  jne    L215
L12:
  add    $0x1,%r12
  cmpb   $0x2f,(%r12)
  je     L12
L215:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x2(%r13,%rax,1),%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    0x0(%rbp,%r13,1),%rsi
  cmpb   $0x0,(%rbx)
  jne    L57
  mov    %rsi,%rax
  jmp    L243
L327:
  cmpb   $0x2e,(%rsi)
  jne    L350
  mov    %rbx,%rdi
  mov    %rcx,%rsi
  jmp    L256
L170:
  cmpb   $0x2e,(%rsi)
  jne    L350
  cmpb   $0x2e,0x1(%rsi)
  jne    L350
  cmp    %rbp,%rsi
  jbe    L241
  lea    -0x1(%rsi),%rax
  cmp    %rax,%rbp
  jb     L181
  mov    %rbx,%rdi
  mov    %r8,%rsi
  jmp    L256
L181:
  sub    $0x2,%rsi
  cmp    %rbp,%rsi
  jbe    L114
L35:
  cmpb   $0x2f,(%rsi)
  je     L383
  sub    $0x1,%rsi
  cmp    %rbp,%rsi
  jne    L35
  mov    %rbx,%rdi
  mov    %r8,%rsi
  jmp    L256
L114:
  mov    %rbx,%rdi
  mov    %r8,%rsi
  jmp    L256
L383:
  cmp    %rbp,%rsi
  jbe    L384
  add    $0x1,%rsi
  mov    %rbx,%rdi
  jmp    L256
L335:
  mov    %rbx,%rdi
  mov    %rax,%rsi
L256:
  test   %dl,%dl
  je     L132
L50:
  lea    0x1(%rdi),%rbx
  cmpb   $0x0,0x1(%rdi)
  je     L28
L172:
  cmp    %rbp,%rsi
  jbe    L263
  cmpb   $0x2f,-0x1(%rsi)
  je     L263
  movb   $0x2f,(%rsi)
  lea    0x1(%rsi),%rsi
L263:
  movzbl (%rbx),%edx
  cmp    $0x2f,%dl
  je     L158
  test   %dl,%dl
  je     L158
  mov    %rsi,%rax
L207:
  add    $0x1,%rbx
  mov    %rax,%rcx
  add    $0x1,%rax
  mov    %dl,-0x1(%rax)
  movzbl (%rbx),%edx
  cmp    $0x2f,%dl
  je     L209
  test   %dl,%dl
  jne    L207
L209:
  movb   $0x0,(%rax)
  cmp    %rax,%rsi
  je     L335
  mov    %rax,%rdi
  sub    %rsi,%rdi
  cmp    $0x1,%rdi
  je     L327
  cmp    $0x2,%rdi
  je     L170
L350:
  test   %dl,%dl
  je     L243
  lea    0x2(%rcx),%rsi
  mov    %dl,(%rax)
  mov    %rbx,%rdi
  jmp    L50
L241:
  mov    %rbx,%rdi
  mov    %r8,%rsi
  jmp    L256
L384:
  mov    %rbx,%rdi
  mov    %r8,%rsi
  jmp    L256
L28:
  mov    %rsi,%rax
L243:
  lea    0x1(%rbp),%rdx
  cmp    %rdx,%rax
  jbe    L283
  cmpb   $0x2f,-0x1(%rax)
  sete   %dl
  movzbl %dl,%edx
  sub    %rdx,%rax
L283:
  movb   $0x0,(%rax)
  mov    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L132:
  mov    %rsi,%rax
  jmp    L243
L158:
  movb   $0x0,(%rsi)
  mov    %rbx,%rdi
  jmp    L256
L305:
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x2(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  movb   $0x0,(%rax)
  mov    %rax,%rsi
  jmp    L57
L398:
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x2(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  movb   $0x0,(%rax)
  mov    %rax,%rsi
L57:
  mov    %rbp,%r8
  jmp    L172
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D4
type_guessed: string

tool: D4: .

assistant: ```c
char *pathexpand(const char *cwd, const char *path) {
  static const char SEP[] = "/";
  if (!*path)
    path = ".";
  if (!*cwd || *SEP == *path)
    cwd = "";
  while (*cwd && *SEP == *cwd)
    ++cwd;
  size_t len = strlen(cwd);
  char *out = malloc(len + 1 + strlen(path) + 1);
  char *p = strcpy(out, cwd) + len;
  for (; *path; ++path) {
    char *pl;
    if (p > out && p[-1] != *SEP)
      *p++ = *SEP;
    pl = p;
    while (*path && *SEP != *path)
      *p++ = *path++;
    *p = '\0';
    if (p == pl)
      ;
    else if (p - pl == 1 && '.' == *pl)
      --p;
    else if (p - pl == 2 && '.' == pl[0] && '.' == pl[1]) {
      if (pl > out && --pl > out)
        for (--pl; pl > out && *SEP != *pl; --pl)
          ;
      p = pl > out ? ++pl : out;
    } else if (*path)
      *p++ = *path;
    if (!*path)
      break;
  }
  if (p > out + 1 && *SEP == p[-1])
    --p;
  *p = '\0';
  return out;
}
```