user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<Camellia_cfbr_encrypt_block>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r14
  mov    %edx,%r12d
  mov    %rcx,-0x50(%rbp)
  mov    %r8,%rbx
  mov    %r9d,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,-0x48(%rbp)
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  lea    (%rdx,%rdx,1),%eax
  cltq
  add    $0xf,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L8:
  cmp    %rcx,%rsp
  je     L86
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L8
L86:
  mov    %rsi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L59
  orq    $0x0,-0x8(%rsp,%rax,1)
L59:
  mov    %rsp,%r15
  lea    -0x1(%r12),%eax
  cmp    $0x7f,%eax
  jbe    L124
  mov    -0x48(%rbp),%rsp
L46:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L101
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L124:
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  mov    -0x50(%rbp),%rdx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  call   <Camellia_encrypt@plt>
  lea    0xe(%r12),%esi
  mov    %r12d,%eax
  add    $0x7,%eax
  cmovns %eax,%esi
  sar    $0x3,%esi
  cmpl   $0x0,-0x54(%rbp)
  je     L125
  mov    %esi,%esi
  mov    $0x0,%eax
  mov    D7(%rip),%rdi
L49:
  movzbl 0x0(%r13,%rax,1),%edx
  xor    (%rbx,%rax,1),%dl
  mov    %eax,%ecx
  add    (%rdi),%ecx
  movslq %ecx,%rcx
  mov    %dl,(%r15,%rcx,1)
  mov    %dl,(%r14,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L49
L56:
  lea    0x7(%r12),%edi
  test   %r12d,%r12d
  cmovns %r12d,%edi
  sar    $0x3,%edi
  test   $0x7,%r12b
  je     L136
  mov    D7(%rip),%rax
  cmpl   $0x0,(%rax)
  jle    L42
  mov    %r12d,%edx
  sar    $0x1f,%edx
  shr    $0x1d,%edx
  lea    (%r12,%rdx,1),%ecx
  and    $0x7,%ecx
  mov    $0x0,%eax
  movslq %edi,%rdi
  add    %r15,%rdi
  and    $0x7,%r12d
  sub    %ecx,%edx
  lea    0x8(%rdx),%r9d
  mov    D7(%rip),%r8
L52:
  movzbl (%rdi,%rax,1),%edx
  mov    %r12d,%ecx
  shl    %cl,%edx
  movzbl 0x1(%rdi,%rax,1),%esi
  mov    %r9d,%ecx
  sar    %cl,%esi
  or     %esi,%edx
  mov    %dl,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    %eax,(%r8)
  jg     L52
L42:
  mov    -0x48(%rbp),%rsp
  jmp    L46
L125:
  mov    %esi,%esi
  mov    $0x0,%eax
  mov    D7(%rip),%rdi
L58:
  movzbl 0x0(%r13,%rax,1),%edx
  mov    %eax,%ecx
  add    (%rdi),%ecx
  movslq %ecx,%rcx
  mov    %dl,(%r15,%rcx,1)
  xor    (%rbx,%rax,1),%dl
  mov    %dl,(%r14,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L58
  jmp    L56
L136:
  movslq %edi,%rdi
  lea    (%r15,%rdi,1),%rsi
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  jmp    L42
L101:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Camellia_cfbr_encrypt_block(const unsigned char *in, unsigned char *out, const int nbits, const CAMELLIA_KEY *key, unsigned char *ivec, const int enc) {
  int n, rem, num;
  unsigned char ovec[CAMELLIA_BLOCK_SIZE * 2];
  if (nbits <= 0 || nbits > 128)
    return;
  memcpy(ovec, ivec, CAMELLIA_BLOCK_SIZE);
  Camellia_encrypt(ivec, ivec, key);
  num = (nbits + 7) / 8;
  if (enc)
    for (n = 0; n < num; ++n)
      out[n] = (ovec[CAMELLIA_BLOCK_SIZE + n] = in[n] ^ ivec[n]);
  else
    for (n = 0; n < num; ++n)
      out[n] = (ovec[CAMELLIA_BLOCK_SIZE + n] = in[n]) ^ ivec[n];
  rem = nbits % 8;
  num = nbits / 8;
  if (rem == 0)
    memcpy(ivec, ovec + num, CAMELLIA_BLOCK_SIZE);
  else
    for (n = 0; n < CAMELLIA_BLOCK_SIZE; ++n)
      ivec[n] = ovec[n + num] << rem | ovec[n + num + 1] >> (8 - rem);
}
```