user: 请从给定的汇编指令推导出C源代码：

```asm
<CAST_cbc_encrypt>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    (%r8),%ebp
  mov    0x4(%r8),%ebx
  mov    %rsi,0x28(%rsp)
  mov    %rdx,0x20(%rsp)
  bswap  %ebp
  bswap  %ebx
  mov    %ebp,%ebp
  mov    %r8,0x38(%rsp)
  mov    %ebx,%ebx
  movq   %rbp,%xmm0
  movq   %rbx,%xmm4
  punpcklqdq %xmm4,%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    -0x8(%rdx),%rax
  mov    %rax,0x30(%rsp)
  test   %r9d,%r9d
  je     L161
  test   %rax,%rax
  js     L54
  shr    $0x3,%rax
  mov    %rsi,%rbp
  lea    0x50(%rsp),%r12
  mov    %rax,0x8(%rsp)
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x10(%rsp)
  lea    (%rdi,%rax,1),%r14
  nopl   0x0(%rax)
L159:
  mov    (%r15),%edx
  mov    0x4(%r15),%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  add    $0x8,%rbp
  add    $0x8,%r15
  bswap  %edx
  bswap  %eax
  movd   %edx,%xmm1
  movd   %eax,%xmm2
  punpcklqdq %xmm2,%xmm1
  pxor   %xmm1,%xmm0
  movaps %xmm0,0x50(%rsp)
  call   <CAST_encrypt@plt>
  movdqa 0x50(%rsp),%xmm0
  movhlps %xmm0,%xmm3
  movq   %xmm0,%rdx
  movq   %xmm0,%rsi
  movq   %xmm3,%rbx
  movq   %xmm3,%r8
  movq   %xmm3,%rdi
  shr    $0x10,%rsi
  movzbl %bh,%eax
  movzbl %bl,%r11d
  shr    $0x10,%r8
  movq   %xmm0,%rcx
  mov    %rax,%r9
  mov    %r11,%rax
  movzbl %r8b,%r8d
  shr    $0x18,%rdi
  shl    $0x8,%rax
  movzbl %dil,%edi
  movzbl %sil,%esi
  shr    $0x18,%rcx
  or     %r9,%rax
  movzbl %cl,%ecx
  shl    $0x8,%rax
  or     %r8,%rax
  shl    $0x8,%rax
  or     %rdi,%rax
  movzbl %dl,%edi
  shl    $0x8,%rax
  or     %rdi,%rax
  movzbl %dh,%edi
  shl    $0x8,%rax
  or     %rdi,%rax
  shl    $0x8,%rax
  or     %rsi,%rax
  shl    $0x8,%rax
  or     %rcx,%rax
  mov    %rax,-0x8(%rbp)
  cmp    %r15,%r14
  jne    L159
  mov    0x8(%rsp),%rax
  mov    0x10(%rsp),%rcx
  add    %rcx,0x28(%rsp)
  mov    0x20(%rsp),%rcx
  neg    %rax
  shl    $0x3,%rax
  lea    -0x10(%rcx,%rax,1),%rcx
  add    0x30(%rsp),%rax
  mov    %rax,0x20(%rsp)
L201:
  mov    %rbx,0x8(%rsp)
  cmp    $0xfffffffffffffff8,%rcx
  je     L217
  lea    0x8(%r15,%rcx,1),%rax
  mov    0x20(%rsp),%rcx
  cmp    $0x7,%rcx
  ja     L211
  lea    D10(%rip),%rsi
  movslq (%rsi,%rcx,4),%rcx
  add    %rsi,%rcx
  notrack jmp *%rcx
L161:
  test   %rax,%rax
  js     L66
  shr    $0x3,%rax
  lea    0x50(%rsp),%r12
  mov    %rbx,0x8(%rsp)
  mov    %rax,0x40(%rsp)
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x48(%rsp)
  add    %rdi,%rax
  mov    %rax,0x18(%rsp)
  mov    %r12,%rax
  mov    %rsi,%r12
  mov    %rax,%r14
  nopw   0x0(%rax,%rax,1)
L181:
  mov    (%r15),%eax
  mov    %rbp,0x10(%rsp)
  mov    %r13,%rsi
  mov    %r14,%rdi
  mov    0x8(%rsp),%rbx
  add    $0x8,%r12
  add    $0x8,%r15
  bswap  %eax
  mov    %eax,%ebp
  mov    -0x4(%r15),%eax
  movq   %rbp,%xmm0
  bswap  %eax
  mov    %eax,%eax
  mov    %rax,0x8(%rsp)
  movhps 0x8(%rsp),%xmm0
  movaps %xmm0,0x50(%rsp)
  call   <CAST_decrypt@plt>
  xor    0x58(%rsp),%rbx
  mov    0x10(%rsp),%rdx
  movzbl %bl,%eax
  mov    %rbx,%r8
  mov    %rbx,%r9
  movzbl %bh,%ebx
  shl    $0x8,%rax
  shr    $0x10,%r9
  xor    0x50(%rsp),%rdx
  or     %rbx,%rax
  movzbl %r9b,%r9d
  shr    $0x18,%r8
  mov    %rdx,%rsi
  shl    $0x8,%rax
  movzbl %r8b,%r8d
  movzbl %dh,%edi
  shr    $0x10,%rsi
  or     %r9,%rax
  mov    %rdx,%rcx
  movzbl %sil,%esi
  shl    $0x8,%rax
  shr    $0x18,%rcx
  or     %r8,%rax
  movzbl %dl,%r8d
  movzbl %cl,%ecx
  shl    $0x8,%rax
  or     %r8,%rax
  shl    $0x8,%rax
  or     %rdi,%rax
  shl    $0x8,%rax
  or     %rsi,%rax
  shl    $0x8,%rax
  or     %rcx,%rax
  mov    %rax,-0x8(%r12)
  cmp    %r15,0x18(%rsp)
  jne    L181
  mov    0x40(%rsp),%rax
  mov    0x20(%rsp),%rcx
  mov    0x48(%rsp),%rdi
  add    %rdi,0x28(%rsp)
  neg    %rax
  mov    0x8(%rsp),%rbx
  shl    $0x3,%rax
  lea    -0x10(%rcx,%rax,1),%r14
  add    0x30(%rsp),%rax
  mov    %rax,0x20(%rsp)
L162:
  cmp    $0xfffffffffffffff8,%r14
  je     L8
  mov    (%r15),%r12d
  mov    0x4(%r15),%r15d
  lea    0x50(%rsp),%rdi
  mov    %r13,%rsi
  bswap  %r12d
  bswap  %r15d
  mov    %r12d,%r12d
  mov    %r15d,%r15d
  movq   %r15,%xmm5
  movq   %r12,%xmm0
  punpcklqdq %xmm5,%xmm0
  movaps %xmm0,0x50(%rsp)
  call   <CAST_decrypt@plt>
  mov    0x28(%rsp),%rax
  mov    0x20(%rsp),%rdi
  xor    0x50(%rsp),%rbp
  xor    0x58(%rsp),%rbx
  lea    0x8(%rax,%r14,1),%rax
  cmp    $0x7,%rdi
  ja     L135
  lea    D17(%rip),%rcx
  movslq (%rcx,%rdi,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
  mov    %bh,-0x1(%rax)
  sub    $0x1,%rax
  mov    %rbx,%rdx
  sub    $0x1,%rax
  shr    $0x10,%rdx
  mov    %dl,(%rax)
  shr    $0x18,%rbx
  lea    -0x1(%rax),%rdx
  mov    %bl,-0x1(%rax)
L27:
  mov    %bpl,-0x1(%rdx)
  lea    -0x1(%rdx),%rax
  mov    %rbp,%rcx
  lea    -0x1(%rax),%rdx
  mov    %ch,-0x1(%rax)
L127:
  mov    %rbp,%rcx
  lea    -0x1(%rdx),%rax
  shr    $0x10,%rcx
  mov    %cl,-0x1(%rdx)
  shr    $0x18,%rbp
  mov    %r15,%rbx
  mov    %bpl,-0x1(%rax)
  mov    %r12,%rbp
L8:
  mov    %rbp,%rax
  mov    %rbp,%rcx
  mov    %rbp,%rsi
  shr    $0x18,%rcx
  movzbl %ah,%eax
  shr    $0x10,%rsi
  mov    %rax,%r9
L83:
  mov    %rbx,%rdi
  mov    %rbx,%r8
  movzbl %bh,%edx
  shr    $0x18,%rdi
  shr    $0x10,%r8
L10:
  movzbl %bl,%ebx
  movzbl %dl,%edx
  movzbl %r8b,%r8d
  movzbl %dil,%eax
  shl    $0x8,%rbx
  or     %rdx,%rbx
  movzbl %bpl,%edx
  shl    $0x8,%rbx
  or     %r8,%rbx
  mov    %rbx,%rdi
  shl    $0x8,%rdi
  or     %rax,%rdi
  movzbl %r9b,%eax
  shl    $0x8,%rdi
  mov    %rdi,%rbp
  or     %rdx,%rbp
  mov    %rbp,%r9
  shl    $0x8,%r9
  or     %rax,%r9
  movzbl %sil,%eax
  mov    %r9,%rsi
  shl    $0x8,%rsi
  or     %rax,%rsi
  movzbl %cl,%eax
  mov    %rsi,%rcx
  shl    $0x8,%rcx
  or     %rax,%rcx
  mov    0x38(%rsp),%rax
  mov    %rcx,(%rax)
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L210
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
  xor    %esi,%esi
L62:
  movzbl -0x1(%rax),%ecx
  sub    $0x1,%rax
  shl    $0x10,%rcx
  or     %rsi,%rcx
L4:
  lea    -0x1(%rax),%rsi
  movzbl -0x1(%rax),%eax
  shl    $0x18,%rax
  or     %rcx,%rax
  xor    %rax,%rbx
  mov    %rbx,0x8(%rsp)
L134:
  movzbl -0x1(%rsi),%edi
  lea    -0x1(%rsi),%rax
L218:
  movzbl -0x1(%rax),%esi
  lea    -0x1(%rax),%rcx
  shl    $0x8,%rsi
  or     %rdi,%rsi
L72:
  lea    -0x1(%rcx),%rax
  movzbl -0x1(%rcx),%ecx
  shl    $0x10,%rcx
  or     %rsi,%rcx
L1:
  movzbl -0x1(%rax),%eax
  shl    $0x18,%rax
  or     %rcx,%rax
  xor    %rdx,%rax
  movq   %rax,%xmm0
  movhps 0x8(%rsp),%xmm0
L211:
  mov    %r13,%rsi
  lea    0x50(%rsp),%rdi
  movaps %xmm0,0x50(%rsp)
  call   <CAST_encrypt@plt>
  mov    0x58(%rsp),%rax
  mov    0x50(%rsp),%r10
  mov    %rax,%r15
  mov    %rax,%r12
  mov    %rax,%r14
  mov    %eax,%ebx
  shr    $0x8,%r15
  movzbl %al,%eax
  shr    $0x10,%r14
  mov    %r10,%rdi
  mov    %r15d,%edx
  shl    $0x8,%rax
  movzbl %r15b,%r15d
  mov    %r14d,%r8d
  or     %r15,%rax
  movzbl %r14b,%r14d
  shr    $0x10,%rdi
  mov    %r10,%r13
  shl    $0x8,%rax
  shr    $0x18,%r12
  mov    %rdi,0x8(%rsp)
  mov    %edi,%esi
  or     %r14,%rax
  mov    %r12d,%edi
  movzbl %r12b,%r12d
  mov    %r10,%r11
  shl    $0x8,%rax
  mov    %r10d,%ebp
  movzbl %r10b,%r10d
  shr    $0x8,%r11
  or     %r12,%rax
  mov    %r11d,%r9d
  movzbl %r11b,%r11d
  shr    $0x18,%r13
  shl    $0x8,%rax
  mov    %r13d,%ecx
  or     %r10,%rax
  movzbl 0x8(%rsp),%r10d
  shl    $0x8,%rax
  or     %r11,%rax
  mov    0x28(%rsp),%r11
  shl    $0x8,%rax
  or     %r10,%rax
  movzbl %r13b,%r10d
  shl    $0x8,%rax
  or     %r10,%rax
  mov    %rax,(%r11)
  jmp    L10
  xchg   %ax,%ax
L54:
  movhlps %xmm0,%xmm6
  mov    %rax,%rcx
  movq   %xmm0,%rdx
  movq   %xmm6,%rbx
  jmp    L201
  nopl   (%rax)
L66:
  mov    %rax,%r14
  jmp    L162
L217:
  mov    %rdx,%rcx
  mov    %rdx,%rsi
  movzbl %dh,%eax
  mov    %edx,%ebp
  shr    $0x18,%rcx
  shr    $0x10,%rsi
  mov    %rax,%r9
  jmp    L83
  nopl   0x0(%rax,%rax,1)
  xor    %ecx,%ecx
  jmp    L1
  nopw   0x0(%rax,%rax,1)
  mov    %rax,%rcx
  xor    %esi,%esi
  jmp    L72
  nopw   0x0(%rax,%rax,1)
  xor    %edi,%edi
  jmp    L218
  nopw   0x0(%rax,%rax,1)
  mov    %rax,%rsi
  jmp    L134
  nopl   0x0(%rax,%rax,1)
  xor    %ecx,%ecx
  jmp    L4
  nopw   0x0(%rax,%rax,1)
  movzbl -0x1(%rax),%esi
  sub    $0x1,%rax
  shl    $0x8,%rsi
  jmp    L62
  mov    %rax,%rdx
  jmp    L127
  mov    %rax,%rdx
  jmp    L27
L210:
  call   <__stack_chk_fail@plt>
L135:
  mov    %r15,%rbx
  mov    %r12,%rbp
  jmp    L8
```

assistant: ```c
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *ks, unsigned char *iv, int enc) {
  register CAST_LONG tin0, tin1;
  register CAST_LONG tout0, tout1, xor0, xor1;
  register long l = length;
  CAST_LONG tin[2];
  if (enc) {
    (tout0 = ((unsigned long)(*((iv)++))) << 24L, tout0 |= ((unsigned long)(*((iv)++))) << 16L, tout0 |= ((unsigned long)(*((iv)++))) << 8L, tout0 |= ((unsigned long)(*((iv)++))));
    (tout1 = ((unsigned long)(*((iv)++))) << 24L, tout1 |= ((unsigned long)(*((iv)++))) << 16L, tout1 |= ((unsigned long)(*((iv)++))) << 8L, tout1 |= ((unsigned long)(*((iv)++))));
    iv -= 8;
    for (l -= 8; l >= 0; l -= 8) {
      (tin0 = ((unsigned long)(*((in)++))) << 24L, tin0 |= ((unsigned long)(*((in)++))) << 16L, tin0 |= ((unsigned long)(*((in)++))) << 8L, tin0 |= ((unsigned long)(*((in)++))));
      (tin1 = ((unsigned long)(*((in)++))) << 24L, tin1 |= ((unsigned long)(*((in)++))) << 16L, tin1 |= ((unsigned long)(*((in)++))) << 8L, tin1 |= ((unsigned long)(*((in)++))));
      tin0 ^= tout0;
      tin1 ^= tout1;
      tin[0] = tin0;
      tin[1] = tin1;
      CAST_encrypt(tin, ks);
      tout0 = tin[0];
      tout1 = tin[1];
      (*((out)++) = (unsigned char)(((tout0) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout0)) & 0xff));
      (*((out)++) = (unsigned char)(((tout1) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout1)) & 0xff));
    }
    if (l != -8) {
      {
        in += l + 8;
        tin0 = tin1 = 0;
        switch (l + 8) {
        case 8:
          tin1 = ((unsigned long)(*(--(in))));
        case 7:
          tin1 |= ((unsigned long)(*(--(in)))) << 8;
        case 6:
          tin1 |= ((unsigned long)(*(--(in)))) << 16;
        case 5:
          tin1 |= ((unsigned long)(*(--(in)))) << 24;
        case 4:
          tin0 = ((unsigned long)(*(--(in))));
        case 3:
          tin0 |= ((unsigned long)(*(--(in)))) << 8;
        case 2:
          tin0 |= ((unsigned long)(*(--(in)))) << 16;
        case 1:
          tin0 |= ((unsigned long)(*(--(in)))) << 24;
        }
      };
      tin0 ^= tout0;
      tin1 ^= tout1;
      tin[0] = tin0;
      tin[1] = tin1;
      CAST_encrypt(tin, ks);
      tout0 = tin[0];
      tout1 = tin[1];
      (*((out)++) = (unsigned char)(((tout0) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout0)) & 0xff));
      (*((out)++) = (unsigned char)(((tout1) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout1)) & 0xff));
    }
    (*((iv)++) = (unsigned char)(((tout0) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((tout0) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((tout0) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((tout0)) & 0xff));
    (*((iv)++) = (unsigned char)(((tout1) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((tout1) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((tout1) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((tout1)) & 0xff));
  } else {
    (xor0 = ((unsigned long)(*((iv)++))) << 24L, xor0 |= ((unsigned long)(*((iv)++))) << 16L, xor0 |= ((unsigned long)(*((iv)++))) << 8L, xor0 |= ((unsigned long)(*((iv)++))));
    (xor1 = ((unsigned long)(*((iv)++))) << 24L, xor1 |= ((unsigned long)(*((iv)++))) << 16L, xor1 |= ((unsigned long)(*((iv)++))) << 8L, xor1 |= ((unsigned long)(*((iv)++))));
    iv -= 8;
    for (l -= 8; l >= 0; l -= 8) {
      (tin0 = ((unsigned long)(*((in)++))) << 24L, tin0 |= ((unsigned long)(*((in)++))) << 16L, tin0 |= ((unsigned long)(*((in)++))) << 8L, tin0 |= ((unsigned long)(*((in)++))));
      (tin1 = ((unsigned long)(*((in)++))) << 24L, tin1 |= ((unsigned long)(*((in)++))) << 16L, tin1 |= ((unsigned long)(*((in)++))) << 8L, tin1 |= ((unsigned long)(*((in)++))));
      tin[0] = tin0;
      tin[1] = tin1;
      CAST_decrypt(tin, ks);
      tout0 = tin[0] ^ xor0;
      tout1 = tin[1] ^ xor1;
      (*((out)++) = (unsigned char)(((tout0) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout0) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout0)) & 0xff));
      (*((out)++) = (unsigned char)(((tout1) >> 24L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 16L) & 0xff), *((out)++) = (unsigned char)(((tout1) >> 8L) & 0xff), *((out)++) = (unsigned char)(((tout1)) & 0xff));
      xor0 = tin0;
      xor1 = tin1;
    }
    if (l != -8) {
      (tin0 = ((unsigned long)(*((in)++))) << 24L, tin0 |= ((unsigned long)(*((in)++))) << 16L, tin0 |= ((unsigned long)(*((in)++))) << 8L, tin0 |= ((unsigned long)(*((in)++))));
      (tin1 = ((unsigned long)(*((in)++))) << 24L, tin1 |= ((unsigned long)(*((in)++))) << 16L, tin1 |= ((unsigned long)(*((in)++))) << 8L, tin1 |= ((unsigned long)(*((in)++))));
      tin[0] = tin0;
      tin[1] = tin1;
      CAST_decrypt(tin, ks);
      tout0 = tin[0] ^ xor0;
      tout1 = tin[1] ^ xor1;
      {
        out += l + 8;
        switch (l + 8) {
        case 8:
          *(--(out)) = (unsigned char)(((tout1)) & 0xff);
        case 7:
          *(--(out)) = (unsigned char)(((tout1) >> 8) & 0xff);
        case 6:
          *(--(out)) = (unsigned char)(((tout1) >> 16) & 0xff);
        case 5:
          *(--(out)) = (unsigned char)(((tout1) >> 24) & 0xff);
        case 4:
          *(--(out)) = (unsigned char)(((tout0)) & 0xff);
        case 3:
          *(--(out)) = (unsigned char)(((tout0) >> 8) & 0xff);
        case 2:
          *(--(out)) = (unsigned char)(((tout0) >> 16) & 0xff);
        case 1:
          *(--(out)) = (unsigned char)(((tout0) >> 24) & 0xff);
        }
      };
      xor0 = tin0;
      xor1 = tin1;
    }
    (*((iv)++) = (unsigned char)(((xor0) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((xor0) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((xor0) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((xor0)) & 0xff));
    (*((iv)++) = (unsigned char)(((xor1) >> 24L) & 0xff), *((iv)++) = (unsigned char)(((xor1) >> 16L) & 0xff), *((iv)++) = (unsigned char)(((xor1) >> 8L) & 0xff), *((iv)++) = (unsigned char)(((xor1)) & 0xff));
  }
  tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;
  tin[0] = tin[1] = 0;
}
```