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

```asm
<calc_relative_path>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rsi,%rdi
  mov    %rdx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    D2(%rip),%rax
  movslq (%rax),%rdx
  lea    0xf(%rdx),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L14:
  cmp    %rcx,%rsp
  je     L264
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L14
L264:
  mov    %rsi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L170
  orq    $0x0,-0x8(%rsp,%rax,1)
L170:
  mov    %rsp,%rbx
  add    $0xf,%rdx
  mov    %rdx,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rdx
  mov    %rsp,%rax
  sub    %rdx,%rax
L143:
  cmp    %rax,%rsp
  je     L93
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L143
L93:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L163
  orq    $0x0,-0x8(%rsp,%rax,1)
L163:
  mov    %rsp,%r14
  mov    %rsp,%rsi
  call   <realpath@plt>
  test   %r15,%r15
  je     L144
  test   %eax,%eax
  je     L144
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <realpath@plt>
  test   %eax,%eax
  je     L144
  movzbl (%rbx),%ecx
  movzbl (%r14),%edx
  mov    %r14,%rax
  mov    $0xffffffff,%edi
  mov    $0x0,%esi
  cmp    %dl,%cl
  je     L58
  cmp    $0x2f,%dl
  jne    L189
  test   %cl,%cl
  je     L240
L189:
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L232
L144:
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
L232:
  mov    %r13,%rsp
L147:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L151
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L245:
  movzbl (%rbx),%ecx
  movzbl (%rax),%edx
  cmp    %dl,%cl
  jne    L12
L58:
  add    $0x1,%rbx
  add    $0x1,%rax
  cmp    $0x2f,%dl
  jne    L245
  add    $0x1,%edi
  mov    %rax,%rsi
  jmp    L245
L12:
  cmp    $0x2f,%dl
  jne    L209
  test   %cl,%cl
  je     L167
L209:
  mov    $0x1,%edx
L140:
  test   %edi,%edi
  jle    L189
  cmpb   $0x0,(%rbx)
  je     L137
  add    $0x2,%rbx
  jmp    L23
L240:
  mov    %r14,%rax
  mov    $0xffffffff,%edi
L167:
  lea    0x1(%rax),%rsi
  add    $0x1,%edi
  mov    $0x0,%edx
  jmp    L140
L38:
  add    $0x1,%edx
L277:
  add    $0x1,%rbx
L23:
  movzbl -0x1(%rbx),%eax
  cmp    $0x2f,%al
  je     L38
  test   %al,%al
  jne    L277
L137:
  lea    -0x1(%rdx),%ecx
  test   %edx,%edx
  je     L122
  mov    %edx,%edx
  lea    (%rdx,%rdx,2),%rdx
  add    %r12,%rdx
  mov    %r12,%rax
L68:
  movb   $0x2e,(%rax)
  movb   $0x2e,0x1(%rax)
  add    $0x3,%rax
  movb   $0x2f,-0x1(%rax)
  cmp    %rdx,%rax
  jne    L68
  mov    %ecx,%eax
  lea    0x3(%rax,%rax,2),%rax
  add    %rax,%r12
L122:
  mov    %r12,%rdi
  call   <strcpy@plt>
  mov    %r13,%rsp
  jmp    L147
L151:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void calc_relative_path(const char *from, const char *to, char *out) {
  char path_from[PATH_MAX];
  char path_to[PATH_MAX];
  if (!realpath(to, path_to) || !from || !realpath(from, path_from)) {
    strcpy(out, path_to);
    return;
  }
  char *ptr_from = path_from;
  char *ptr_to = path_to;
  char *ptr_match = NULL;
  int depth_match = -1;
  while (*ptr_from == *ptr_to) {
    ptr_from++;
    if (*ptr_to++ == '/') {
      ptr_match = ptr_to;
      depth_match++;
    }
  }
  int depth = 0;
  if (!(*ptr_from) && *ptr_to == '/') {
    ptr_match = ++ptr_to;
    depth_match++;
  } else {
    depth++;
  }
  if (depth_match <= 0) {
    strcpy(out, path_to);
    return;
  }
  while (*ptr_from++) {
    if (*ptr_from == '/')
      depth++;
  }
  if (*(ptr_from - 1) == '/')
    depth--;
  while (depth--) {
    *out++ = '.';
    *out++ = '.';
    *out++ = '/';
  }
  strcpy(out, ptr_match);
}
```