user: 请将以下的汇编代码转换成C语言代码:

```asm
<strcrlfcpy>:
  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    -0x40(%rbp),%rax
  add    %rax,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L86
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jae    L50
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L51
L112:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L120
  addq   $0x1,-0x18(%rbp)
L120:
  subq   $0x1,-0x10(%rbp)
L51:
  cmpq   $0x0,-0x10(%rbp)
  jne    L112
L50:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jae    L86
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <fs_give@plt>
L86:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L36
  mov    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  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)
L36:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L54
L5:
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x19(%rbp)
  cmpb   $0xd,-0x19(%rbp)
  ja     L114
  cmpb   $0xa,-0x19(%rbp)
  jne    L108
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0xd,(%rax)
  jmp    L114
L108:
  cmpb   $0xd,-0x19(%rbp)
  jne    L114
  cmpq   $0x1,-0x40(%rbp)
  jbe    L114
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L114
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl -0x19(%rbp),%edx
  mov    %dl,(%rax)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x19(%rbp)
  subq   $0x1,-0x40(%rbp)
L114:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl -0x19(%rbp),%edx
  mov    %dl,(%rax)
  subq   $0x1,-0x40(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  jne    L5
L54:
  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 strcrlfcpy(unsigned char **dst, unsigned long *dstl, unsigned char *src, unsigned long srcl) {
  long i = srcl * 2, j;
  unsigned char c, *d = src;
  if (*dst) {
    if (i > *dstl)
      for (i = j = srcl; j; --j)
        if (*d++ == '\012')
          i++;
    if (i > *dstl)
      fs_give((void **)dst);
  }
  if (!*dst)
    *dst = (unsigned char *)fs_get((*dstl = i) + 1);
  d = *dst;
  if (srcl)
    do {
      if ((c = *src++) < '\016') {
        if (c == '\012')
          *d++ = '\015';
        else if ((c == '\015') && (srcl > 1) && (*src == '\012')) {
          *d++ = c;
          c = *src++;
          --srcl;
        }
      }
      *d++ = c;
    } while (--srcl);
  *d = '\0';
  return d - *dst;
}
```