user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<path_concat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L194
  cmpq   $0x0,-0x30(%rbp)
  jne    L35
L194:
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  jmp    L213
L35:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L158
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L158
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L200
L219:
  addq   $0x1,-0x20(%rbp)
L200:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L219
  subq   $0x1,-0x20(%rbp)
  jmp    L34
L120:
  subq   $0x1,-0x20(%rbp)
L34:
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jb     L157
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L120
L157:
  mov    -0x20(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,%rdx
  jbe    L208
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  jmp    L213
L208:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L78
L20:
  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)
L78:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  ja     L158
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L20
L158:
  cmpq   $0x0,-0x40(%rbp)
  je     L269
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L269
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L132
L241:
  addq   $0x1,-0x20(%rbp)
L132:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L221
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L241
L221:
  mov    -0x10(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jbe    L4
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L4
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x2f,(%rax)
L4:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L156
L211:
  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)
L156:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L21
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jbe    L211
L21:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L269
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  jmp    L213
L269:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jbe    L282
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  jmp    L213
L282:
  mov    $0x0,%eax
L213:
  pop    %rbp
  ret
```

assistant: ```c
int path_concat(char *path, size_t path_size, const char *head, const char *tail) {
  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)
      return ENOBUFS;
    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++ = '/';
    for (src = p; *src && dst <= dst_end;)
      *dst++ = *src++;
    if (*src)
      return ENOBUFS;
  }
  *dst = 0;
  if (dst > dst_end) {
    return ENOBUFS;
  }
  return 0;
}
```