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

```asm
<path_concat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L43
  cmpq   $0x0,-0x40(%rbp)
  jne    L89
L43:
  mov    D25(%rip),%rax
  mov    (%rax),%eax
  jmp    L219
L89:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  je     L13
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L13
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L289
L131:
  addq   $0x1,-0x20(%rbp)
L289:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L131
  subq   $0x1,-0x20(%rbp)
  jmp    L173
L99:
  subq   $0x1,-0x20(%rbp)
L173:
  mov    -0x20(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jbe    L156
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L99
L156:
  mov    -0x20(%rbp),%rax
  sub    -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,%rdx
  jbe    L84
  mov    D25(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
  jmp    L185
L84:
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L76
L102:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L76:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  ja     L13
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L102
L13:
  cmpq   $0x0,-0x50(%rbp)
  je     L270
  mov    -0x50(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L270
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L105
L146:
  addq   $0x1,-0x20(%rbp)
L105:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L104
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L146
L104:
  mov    -0x10(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jbe    L55
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L55
  mov    -0x10(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L55
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x2f,(%rax)
L55:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L77
L257:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x10(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L77:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L121
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L257
L121:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L270
  mov    D25(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
  jmp    L185
L270:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L219
L185:
  mov    -0x38(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x24(%rbp),%eax
L219:
  pop    %rbp
  ret
```

assistant: ```c
int path_concat(char *path, size_t path_size, const char *head, const char *tail) {
  int ret;
  const char *p, *src;
  char *dst, *dst_end;
  if (!path || path_size < 1)
    return ENOBUFS;
  dst = path;
  dst_end = path + path_size - 1;
  if (head && *head) {
    for (p = head; *p; p++)
      ;
    for (p--; p > head && *p == '/'; p--)
      ;
    if ((p - head) > path_size - 1) {
      ret = ENOBUFS;
      goto fail;
    }
    for (src = head; src <= p && dst < dst_end;) {
      *dst++ = *src++;
    }
  }
  if (tail && *tail) {
    for (p = tail; *p && *p == '/'; p++)
      ;
    if (dst > path)
      if (dst < dst_end && *(dst - 1) != '/') {
        *dst++ = '/';
      }
    for (src = p; *src && dst < dst_end;) {
      *dst++ = *src++;
    }
    if (*src) {
      ret = ENOBUFS;
      goto fail;
    }
  }
  *dst = 0;
  return 0;
fail:
  *path = '\0';
  return ret;
}
```