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

```asm
<CAST_cfb64_encrypt>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %rsi,%rbp
  mov    %rcx,%rsi
  push   %rbx
  sub    $0x48,%rsp
  mov    (%r9),%ebx
  mov    %r9,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    0x80(%rsp),%eax
  test   %eax,%eax
  jne    L56
  mov    %rdi,%r15
  lea    0x20(%rsp),%rdi
  test   %rdx,%rdx
  jne    L90
  nopl   0x0(%rax)
L81:
  mov    0x18(%rsp),%rax
  mov    %ebx,(%rax)
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L93
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L24:
  mov    (%r12),%eax
  mov    %rsi,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  bswap  %eax
  mov    %eax,%eax
  mov    %rax,0x20(%rsp)
  mov    0x4(%r12),%eax
  bswap  %eax
  mov    %eax,%eax
  mov    %rax,0x28(%rsp)
  call   <CAST_encrypt@plt>
  mov    0x20(%rsp),%eax
  mov    0x10(%rsp),%rsi
  mov    0x8(%rsp),%rdi
  bswap  %eax
  mov    %eax,(%r12)
  mov    0x28(%rsp),%eax
  bswap  %eax
  mov    %eax,0x4(%r12)
L107:
  movslq %ebx,%rcx
  movzbl (%r15),%eax
  add    $0x1,%rbp
  add    $0x1,%r15
  add    %r12,%rcx
  add    $0x1,%ebx
  movzbl (%rcx),%r8d
  mov    %al,(%rcx)
  and    $0x7,%ebx
  xor    %r8d,%eax
  mov    %al,-0x1(%rbp)
  mov    %r14,%rax
  sub    %r15,%rax
  add    %r13,%rax
  je     L81
L90:
  test   %ebx,%ebx
  jne    L107
  jmp    L24
  nopl   (%rax)
L56:
  test   %rdx,%rdx
  je     L81
  lea    0x20(%rsp),%rax
  mov    %rdi,%r15
  mov    %rax,0x10(%rsp)
  jmp    L38
L18:
  movslq %ebx,%rax
  movzbl (%r15),%ecx
  add    $0x1,%rbp
  add    $0x1,%r15
  add    %r12,%rax
  add    $0x1,%ebx
  xor    (%rax),%cl
  and    $0x7,%ebx
  mov    %cl,-0x1(%rbp)
  mov    %cl,(%rax)
  mov    %r14,%rax
  sub    %r15,%rax
  add    %r13,%rax
  je     L81
L38:
  test   %ebx,%ebx
  jne    L18
  mov    (%r12),%eax
  mov    0x10(%rsp),%rdi
  mov    %rsi,0x8(%rsp)
  bswap  %eax
  mov    %eax,%eax
  mov    %rax,0x20(%rsp)
  mov    0x4(%r12),%eax
  bswap  %eax
  mov    %eax,%eax
  mov    %rax,0x28(%rsp)
  call   <CAST_encrypt@plt>
  mov    0x20(%rsp),%eax
  mov    0x8(%rsp),%rsi
  bswap  %eax
  mov    %eax,(%r12)
  mov    0x28(%rsp),%eax
  bswap  %eax
  mov    %eax,0x4(%r12)
  jmp    L18
L93:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num, int enc) {
  register CAST_LONG v0, v1, t;
  register int n = *num;
  register long l = length;
  CAST_LONG ti[2];
  unsigned char *iv, c, cc;
  iv = ivec;
  if (enc) {
    while (l--) {
      if (n == 0) {
        (v0 = ((unsigned long)(*((iv)++))) << 24L, v0 |= ((unsigned long)(*((iv)++))) << 16L, v0 |= ((unsigned long)(*((iv)++))) << 8L, v0 |= ((unsigned long)(*((iv)++))));
        ti[0] = v0;
        (v1 = ((unsigned long)(*((iv)++))) << 24L, v1 |= ((unsigned long)(*((iv)++))) << 16L, v1 |= ((unsigned long)(*((iv)++))) << 8L, v1 |= ((unsigned long)(*((iv)++))));
        ti[1] = v1;
        CAST_encrypt((CAST_LONG *)ti, schedule);
        iv = ivec;
        t = ti[0];
        (*((iv)++) = (unsigned char)(((t) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((t)) & 0xff));
        t = ti[1];
        (*((iv)++) = (unsigned char)(((t) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((t)) & 0xff));
        iv = ivec;
      }
      c = *(in++) ^ iv[n];
      *(out++) = c;
      iv[n] = c;
      n = (n + 1) & 0x07;
    }
  } else {
    while (l--) {
      if (n == 0) {
        (v0 = ((unsigned long)(*((iv)++))) << 24L, v0 |= ((unsigned long)(*((iv)++))) << 16L, v0 |= ((unsigned long)(*((iv)++))) << 8L, v0 |= ((unsigned long)(*((iv)++))));
        ti[0] = v0;
        (v1 = ((unsigned long)(*((iv)++))) << 24L, v1 |= ((unsigned long)(*((iv)++))) << 16L, v1 |= ((unsigned long)(*((iv)++))) << 8L, v1 |= ((unsigned long)(*((iv)++))));
        ti[1] = v1;
        CAST_encrypt((CAST_LONG *)ti, schedule);
        iv = ivec;
        t = ti[0];
        (*((iv)++) = (unsigned char)(((t) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((t)) & 0xff));
        t = ti[1];
        (*((iv)++) = (unsigned char)(((t) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((t) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((t)) & 0xff));
        iv = ivec;
      }
      cc = *(in++);
      c = iv[n];
      iv[n] = cc;
      *(out++) = c ^ cc;
      n = (n + 1) & 0x07;
    }
  }
  v0 = v1 = ti[0] = ti[1] = t = c = cc = 0;
  *num = n;
}
```