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

```asm
<pathexpand>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movzbl (%rsi),%r13d
  movzbl (%rdi),%r12d
  test   %r13b,%r13b
  je     L327
  mov    %rsi,%rdi
  mov    %rsi,%rbx
  call   <strlen@plt>
  mov    %rax,%r14
  test   %r12b,%r12b
  jne    L4
L333:
  lea    0x2(%rax),%rdi
L243:
  call   <malloc@plt>
  movb   $0x0,(%rax)
  mov    %rax,%r8
  mov    %rax,%rcx
  movzbl (%rbx),%eax
  nopl   0x0(%rax)
L237:
  cmp    %rcx,%r8
  jae    L177
  cmpb   $0x2f,-0x1(%rcx)
  je     L177
  movb   $0x2f,(%rcx)
  add    $0x1,%rcx
L177:
  test   %al,%al
  je     L402
  mov    %rcx,%rdx
  jmp    L122
  nop
L185:
  add    $0x1,%rbx
  mov    %al,(%rdx)
  add    $0x1,%rdx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L400
L122:
  cmp    $0x2f,%al
  jne    L185
  movb   $0x0,(%rdx)
  mov    %rbx,%rsi
  cmp    %rdx,%rcx
  je     L240
L30:
  mov    %rdx,%rdi
  sub    %rcx,%rdi
  cmp    $0x1,%rdi
  je     L302
  cmp    $0x2,%rdi
  je     L337
L165:
  test   %al,%al
  jne    L68
L336:
  lea    0x1(%r8),%rax
  cmp    %rax,%rdx
  jbe    L138
  xor    %eax,%eax
  cmpb   $0x2f,-0x1(%rdx)
  sete   %al
  sub    %rax,%rdx
L138:
  movb   $0x0,(%rdx)
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L327:
  mov    $0x1,%r14d
  lea    D6(%rip),%rbx
  test   %r12b,%r12b
  je     L376
L219:
  cmp    $0x2f,%r12b
  jne    L204
  nopw   0x0(%rax,%rax,1)
L108:
  add    $0x1,%rbp
  cmpb   $0x2f,0x0(%rbp)
  je     L108
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x2(%r14,%rax,1),%rdi
  mov    %rax,%r12
  call   <malloc@plt>
  lea    0x1(%r12),%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rax,%r8
  lea    (%rax,%r12,1),%rcx
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L237
L346:
  mov    %rcx,%rdx
  jmp    L336
L4:
  cmp    $0x2f,%r13b
  je     L333
  jmp    L219
L376:
  mov    $0x3,%edi
  lea    D6(%rip),%rbx
  jmp    L243
  cs nopw 0x0(%rax,%rax,1)
L302:
  cmpb   $0x2e,(%rcx)
  jne    L165
  lea    -0x1(%rdx),%rcx
L290:
  test   %al,%al
  je     L346
L240:
  movzbl 0x1(%rsi),%eax
  add    $0x1,%rbx
  test   %al,%al
  jne    L237
L73:
  mov    %rcx,%rdx
  jmp    L336
  nopl   0x0(%rax)
L400:
  movb   $0x0,(%rdx)
  cmp    %rdx,%rcx
  je     L336
  mov    %rbx,%rsi
  jmp    L30
  nopl   0x0(%rax)
L68:
  movzbl 0x1(%rsi),%eax
  movb   $0x2f,(%rdx)
  lea    0x1(%rdx),%rcx
  add    $0x1,%rbx
  test   %al,%al
  jne    L237
  jmp    L73
  nopl   0x0(%rax)
L337:
  cmpb   $0x2e,(%rcx)
  jne    L165
  cmpb   $0x2e,0x1(%rcx)
  jne    L165
  cmp    %r8,%rcx
  jbe    L247
  lea    -0x1(%rcx),%rdx
  cmp    %rdx,%r8
  jb     L172
L247:
  mov    %r8,%rcx
  jmp    L290
L402:
  movb   $0x0,(%rcx)
  mov    %rcx,%rdx
  jmp    L336
L172:
  sub    $0x2,%rcx
  cmp    %r8,%rcx
  ja     L408
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L216:
  sub    $0x1,%rcx
  cmp    %r8,%rcx
  je     L247
L408:
  cmpb   $0x2f,(%rcx)
  jne    L216
  cmp    %r8,%rcx
  jbe    L247
  add    $0x1,%rcx
  jmp    L290
L204:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x2(%r14,%rax,1),%rdi
  mov    %rax,%r12
  call   <malloc@plt>
  lea    0x1(%r12),%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rax,%r8
  lea    (%rax,%r12,1),%rcx
  movzbl (%rbx),%eax
  jmp    L237
```

tool_calls: name: unpack_data
arguments: data_tag: D6
datatype: string

tool: D6: .

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;
}
```