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

```asm
<unix_crlfcpy>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L120
L103:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L96
  addq   $0x1,-0x18(%rbp)
L96:
  addq   $0x1,-0x10(%rbp)
L120:
  mov    -0x10(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L103
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L6
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x18(%rbp)
  jbe    L6
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <fs_give@plt>
L6:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L83
  mov    -0x30(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <fs_get@plt>
  mov    %rax,%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  cmpq   $0x0,-0x30(%rbp)
  je     L83
  mov    -0x30(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
L83:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L38
L43:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0xa,%eax
  je     L134
  cmp    $0xd,%eax
  jne    L39
  mov    -0x38(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  cmpq   $0x0,-0x40(%rbp)
  je     L38
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L38
  mov    -0x38(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subq   $0x1,-0x40(%rbp)
  jmp    L38
L134:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0xd,(%rax)
L39:
  mov    -0x38(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  nop
L38:
  mov    -0x40(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x40(%rbp)
  test   %rax,%rax
  jne    L43
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%rax
  sub    %rdx,%rax
  leave
  ret
```

assistant: ```c
unsigned long unix_crlfcpy(char **dst, unsigned long *dstl, char *src, unsigned long srcl) {
  unsigned long i, j;
  char *d = src;
  for (i = srcl, j = 0; j < srcl; j++)
    if (*d++ == '\012')
      i++;
  if (*dst && (i > *dstl))
    fs_give((void **)dst);
  if (!*dst) {
    *dst = (char *)fs_get((*dstl = i) + 1);
    if (dstl)
      *dstl = i;
  }
  d = *dst;
  while (srcl--)
    switch (*src) {
    case '\015':
      *d++ = *src++;
      if (srcl && *src == '\012') {
        *d++ = *src++;
        srcl--;
      }
      break;
    case '\012':
      *d++ = '\015';
    default:
      *d++ = *src++;
      break;
    }
  *d = '\0';
  return d - *dst;
}
```