user: Please show me the C implementation that matches the assembly code listed below:

```asm
<process_path_component>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %r8d,%r12d
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  mov    D40(%rip),%rax
  mov    %rsp,%rcx
  mov    (%rax),%r15d
  lea    0x1(%r15),%edx
  movslq %edx,%rdx
  add    $0xf,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rcx
  and    $0xfffffffffffffff0,%rax
  cmp    %rcx,%rsp
  je     L96
L271:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L271
L96:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L234
  mov    %rsp,-0x48(%rbp)
  test   %rsi,%rsi
  jne    L69
L225:
  test   %ebx,%ebx
  je     L104
L64:
  mov    %r13,%rax
L148:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L44
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L69:
  cmp    $0x1,%rsi
  je     L175
  cmp    $0x2,%rsi
  jne    L50
  cmpb   $0x2e,(%rdi)
  je     L65
L50:
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    %r13,%rdi
  call   <append_path_component@plt>
  test   %eax,%eax
  je     L103
  lea    -0x3c(%rbp),%r14
  mov    %r13,%rdi
  mov    %r14,%rsi
  call   <lstat@plt>
  test   %rax,%rax
  jns    L230
L102:
  test   %ebx,%ebx
  je     L103
  mov    D69(%rip),%rax
  mov    D27(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L64
L103:
  xor    %eax,%eax
  jmp    L148
  nopl   0x0(%rax)
L234:
  orq    $0x0,-0x8(%rsp,%rax,1)
  mov    %rsp,-0x48(%rbp)
  test   %rsi,%rsi
  jne    L69
  jmp    L225
  nopl   0x0(%rax)
L230:
  mov    -0x3c(%rbp),%edi
  call   <S_ISLNK@plt>
  test   %rax,%rax
  jne    L36
L245:
  test   %ebx,%ebx
  jne    L64
  mov    -0x3c(%rbp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  jne    L64
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    D27(%rip),%rax
  mov    %rdx,(%rax)
  xor    %eax,%eax
  jmp    L148
  nopl   0x0(%rax)
L65:
  cmpb   $0x2e,0x1(%rdi)
  jne    L50
  mov    %r13,%rdi
  call   <remove_last_path_component@plt>
  jmp    L148
  nopw   0x0(%rax,%rax,1)
L175:
  cmpb   $0x2e,(%rdi)
  jne    L50
  jmp    L64
  xchg   %ax,%ax
L104:
  mov    D69(%rip),%rax
  mov    (%rax),%rdx
  mov    D27(%rip),%rax
  mov    %rdx,(%rax)
  xor    %eax,%eax
  jmp    L148
  nopl   0x0(%rax,%rax,1)
L36:
  mov    %r15d,%edx
  mov    -0x48(%rbp),%r15
  mov    %r13,%rdi
  mov    %r15,%rsi
  call   <readlink@plt>
  mov    %r13,%rdi
  movb   $0x0,(%r15,%rax,1)
  call   <remove_last_path_component@plt>
  lea    -0x1(%r12),%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <realpath_recurse@plt>
  test   %eax,%eax
  je     L103
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <lstat@plt>
  test   %rax,%rax
  jns    L245
  jmp    L102
L44:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *process_path_component(const char *component, size_t component_length, char *resolved_name, int last_part, int max_depth) {
  char readlink_buffer[PATH_MAX + 1];
  ssize_t readlink_buffer_length;
  struct stat stat_buffer;
  if (!component_length) {
    if (last_part)
      return resolved_name;
    else {
      errno = ENOENT;
      return NULL;
    }
  }
  if (component_length == 1 && component[0] == '.')
    return resolved_name;
  if (component_length == 2 && component[0] == '.' && component[1] == '.')
    return remove_last_path_component(resolved_name);
  if (!append_path_component(resolved_name, component, component_length))
    return NULL;
  if (lstat(resolved_name, &stat_buffer) < 0) {
    if (last_part && errno == ENOENT)
      return resolved_name;
    else
      return NULL;
  }
  if (S_ISLNK(stat_buffer.st_mode)) {
    readlink_buffer_length = readlink(resolved_name, readlink_buffer, sizeof(readlink_buffer) - 1);
    if (readlink_buffer_length < 0)
      return NULL;
    readlink_buffer[readlink_buffer_length] = 0;
    remove_last_path_component(resolved_name);
    if (!realpath_recurse(readlink_buffer, resolved_name, max_depth - 1))
      return NULL;
    if (lstat(resolved_name, &stat_buffer) < 0) {
      if (last_part && errno == ENOENT)
        return resolved_name;
      else
        return NULL;
    }
  }
  if (!last_part && !S_ISDIR(stat_buffer.st_mode)) {
    errno = ENOTDIR;
    return NULL;
  }
  return resolved_name;
}
```