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

```asm
<channel_encode>:
  endbr64
  push   %r15
  lea    -0x10(%rdx),%rax
  mov    %rsi,%r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  and    $0x7,%r13d
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  shr    $0x3,%rax
  mov    %ecx,0x14(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %rax,0x18(%rsp)
  je     L863
  mov    %rdi,%r14
  lea    (%rdi,%rax,8),%rbx
  mov    $0xffff,%edi
  nopw   0x0(%rax,%rax,1)
L381:
  mov    (%r14),%rsi
  add    $0x8,%r14
  call   <crc_xmodem_update@plt>
  mov    %rax,%rdi
  cmp    %r14,%rbx
  jne    L381
L811:
  mov    0x18(%rsp),%rdx
  shl    $0x3,%rdx
  lea    0x0(%rbp,%rdx,1),%rbx
  test   %r13,%r13
  je     L69
  cmp    $0x1,%r13
  je     L142
  cmp    $0x2,%r13
  je     L792
  cmp    $0x3,%r13
  je     L667
  cmp    $0x4,%r13
  je     L874
  cmp    $0x5,%r13
  je     L219
  xor    %esi,%esi
  cmp    $0x7,%r13
  sete   %sil
  lea    0xfc(%rsi,%rsi,1),%rsi
L291:
  and    (%rbx),%rsi
  mov    %rdx,0x18(%rsp)
  call   <crc_xmodem_update@plt>
  mov    $0x7,%ecx
  mov    0x18(%rsp),%rdx
  pxor   %xmm0,%xmm0
  sub    %r13d,%ecx
  mov    %rax,%rdi
  mov    $0x1,%eax
  movups %xmm0,(%rbx)
  shl    %cl,%eax
  lea    0x8(%rbp,%rdx,1),%rcx
  cltq
  test   $0x8000,%edi
  je     L764
L860:
  mov    %rax,(%rbx)
L764:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L619
  test   $0x80,%dh
  je     L674
  mov    $0x80,%eax
L103:
  or     %rax,(%rcx)
  mov    %rcx,%rbx
L666:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L125
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L648
  mov    $0x80,%eax
L28:
  or     %rax,(%rbx)
L819:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L179
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L116
  mov    $0x80,%eax
L692:
  or     %rax,(%rbx)
L451:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L466
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L470
  mov    $0x80,%eax
L102:
  or     %rax,(%rbx)
L70:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L195
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L100
  mov    $0x80,%eax
L423:
  or     %rax,(%rbx)
L373:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L832
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L150
  mov    $0x80,%eax
L460:
  or     %rax,(%rbx)
L518:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L321
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L742
  mov    $0x80,%eax
L797:
  or     %rax,(%rbx)
L60:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L63
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L814
  mov    $0x80,%eax
L507:
  or     %rax,(%rbx)
L292:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L131
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L87
  mov    $0x80,%eax
L549:
  or     %rax,(%rbx)
L81:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L366
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L745
  mov    $0x80,%eax
L761:
  or     %rax,(%rbx)
L462:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L765
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L286
  mov    $0x80,%eax
L621:
  or     %rax,(%rbx)
L681:
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L88
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L743
  mov    $0x80,%eax
L880:
  or     %rax,(%rbx)
L459:
  shr    %rax
  lea    (%rdi,%rdi,1),%rdx
  jne    L668
  add    $0x8,%rbx
  test   $0x80,%dh
  je     L854
  mov    $0x80,%eax
L468:
  or     %rax,(%rbx)
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  jne    L11
L670:
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L716
  mov    $0x80,%eax
L613:
  or     %rax,(%rbx)
L22:
  add    %rdi,%rdi
  shr    %rax
  jne    L594
  add    $0x8,%rbx
  test   $0x8000,%edi
  je     L129
  mov    $0x80,%eax
L625:
  or     %rax,(%rbx)
L129:
  mov    0x14(%rsp),%edx
  mov    0x8(%rsp),%rax
  movdqa D13(%rip),%xmm0
  sar    $0x11,%edx
  and    $0x3,%eax
  and    $0xfc,%edx
  movups %xmm0,(%r15)
  or     %rax,%rdx
  movups %xmm0,0x10(%r15)
  movdqa D21(%rip),%xmm0
  mov    %rdx,%rax
  shl    $0x4,%rax
  movups %xmm0,0x20(%r15)
  movdqa D7(%rip),%xmm0
  and    $0xf00,%eax
  or     %rdx,%rax
  movups %xmm0,0x30(%r15)
  and    $0xf0f,%eax
  mov    %rax,%rcx
  mov    %rax,%rdx
  mov    %rax,%rsi
  shr    $0x2,%rcx
  shr    %rdx
  xor    %rcx,%rdx
  shr    $0x3,%rsi
  and    $0x1,%edx
  and    $0x1,%esi
  cmp    %dl,%sil
  je     L421
  or     $0x10,%rax
  mov    %rax,%rdx
  mov    %rax,%rcx
  shr    $0x3,%rdx
  shr    $0x2,%rcx
  and    $0x1,%edx
L421:
  xor    %rax,%rcx
  and    $0x1,%ecx
  cmp    %dl,%cl
  je     L659
  or     $0x20,%rax
  mov    %rax,%rdx
  shr    $0x3,%rdx
  and    $0x1,%edx
L659:
  mov    %rax,%rcx
  shr    %rcx
  xor    %rax,%rcx
  and    $0x1,%ecx
  cmp    %dl,%cl
  je     L51
  or     $0x40,%rax
  mov    %rax,%rdx
  shr    %rdx
  xor    %rax,%rdx
  and    $0x1,%edx
L51:
  mov    %rax,%rcx
  mov    %rax,%rsi
  mov    $0x80,%r8d
  shr    $0x2,%rcx
  or     $0x80,%sil
  and    $0x1,%ecx
  cmp    %dl,%cl
  mov    $0x80,%edx
  cmovne %rsi,%rax
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L799
  nopw   0x0(%rax,%rax,1)
L61:
  lea    -0x7(%rcx),%rdi
  sub    $0xf,%rcx
  cmp    $0x7,%rdi
  cmovbe %rdi,%rcx
  add    $0x1,%rsi
  cmp    $0x10,%rsi
  je     L2
L799:
  bt     %rcx,%rax
  jae    L853
  mov    %rsi,%rdi
  shr    $0x3,%rdi
  or     %rdx,0x40(%r15,%rdi,8)
L853:
  shr    %rdx
  lea    0x8(%rcx),%rdi
  cmove  %r8,%rdx
  cmp    $0xf,%rdi
  ja     L61
  add    $0x1,%rsi
  mov    %rdi,%rcx
  cmp    $0x10,%rsi
  jne    L799
L2:
  lea    0x4(%r12),%r13
  mov    0x14(%rsp),%r8d
  mov    %r12,%rcx
  mov    %rbp,%rdi
  mov    %r13,%rax
  mov    %r13,%rbx
  lea    0x50(%r15),%rsi
  and    $0x7,%eax
  shr    $0x3,%rbx
  cmp    $0x1,%rax
  sbb    $0xfffffffffffffff4,%rbx
  shl    $0x3,%rbx
  lea    (%r15,%rbx,1),%rdx
  call   <encode_turbo@plt>
  cmpq   $0x0,0x8(%rsp)
  jne    L329
  add    $0x28,%rsp
  shr    $0x2,%r13
  lea    0x0(%r13,%rbx,1),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L716:
  lea    0x0(,%rdx,4),%rdi
  mov    $0x40,%eax
L594:
  test   $0x8000,%edi
  je     L129
  jmp    L625
  cs nopw 0x0(%rax,%rax,1)
L743:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L668:
  test   $0x80,%dh
  jne    L468
  shr    %rax
  lea    (%rdx,%rdx,1),%rdi
  je     L670
L11:
  test   $0x8000,%edi
  je     L22
  jmp    L613
L286:
  shl    $0x2,%rdi
  mov    $0x40,%eax
L88:
  test   $0x8000,%edi
  je     L459
  jmp    L880
  nopw   0x0(%rax,%rax,1)
L745:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L765:
  test   $0x80,%dh
  je     L681
  jmp    L621
  nopw   0x0(%rax,%rax,1)
L87:
  shl    $0x2,%rdi
  mov    $0x40,%eax
L366:
  test   $0x8000,%edi
  je     L462
  jmp    L761
  nopw   0x0(%rax,%rax,1)
L814:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L131:
  test   $0x80,%dh
  je     L81
  jmp    L549
  nopw   0x0(%rax,%rax,1)
L742:
  shl    $0x2,%rdi
  mov    $0x40,%eax
L63:
  test   $0x8000,%edi
  je     L292
  jmp    L507
  nopw   0x0(%rax,%rax,1)
L150:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L321:
  test   $0x80,%dh
  je     L60
  jmp    L797
  nopw   0x0(%rax,%rax,1)
L100:
  shl    $0x2,%rdi
  mov    $0x40,%eax
L832:
  test   $0x8000,%edi
  je     L518
  jmp    L460
  nopw   0x0(%rax,%rax,1)
L470:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L195:
  test   $0x80,%dh
  je     L373
  jmp    L423
  nopw   0x0(%rax,%rax,1)
L116:
  shl    $0x2,%rdi
  mov    $0x40,%eax
L466:
  test   $0x8000,%edi
  je     L70
  jmp    L102
  nopw   0x0(%rax,%rax,1)
L648:
  shl    $0x2,%rdx
  mov    $0x40,%eax
L179:
  test   $0x80,%dh
  je     L451
  jmp    L692
  nopw   0x0(%rax,%rax,1)
L674:
  shl    $0x2,%rdi
  mov    %rcx,%rbx
  mov    $0x40,%eax
L125:
  test   $0x8000,%edi
  je     L819
  jmp    L28
L809:
  lea    (%rdi,%rdi,1),%rdx
  mov    $0x40,%eax
  cs nopw 0x0(%rax,%rax,1)
L619:
  mov    %rbx,%rcx
  test   $0x80,%dh
  jne    L103
  jmp    L666
  nopl   0x0(%rax)
L329:
  cmpq   $0x1,0x8(%rsp)
  je     L75
  lea    0x0(%r13,%rbx,1),%rdx
  lea    (%rbx,%r13,2),%rax
  cmpq   $0x2,0x8(%rsp)
  cmove  %rdx,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L854:
  shl    $0x2,%rdi
  mov    $0x40,%eax
  test   $0x8000,%edi
  je     L22
  jmp    L613
L219:
  mov    $0xf8,%esi
  jmp    L291
L75:
  lea    0x0(,%r12,8),%rdx
  add    $0x28,%rsp
  movabs $0x4ec4ec4ec4ec4ec5,%rcx
  sub    %r12,%rdx
  add    $0x1c,%rdx
  mov    %rdx,%rax
  mul    %rcx
  shr    $0x2,%rdx
  lea    (%rdx,%rbx,1),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  pxor   %xmm0,%xmm0
  lea    0x8(%rbp,%rdx,1),%rcx
  movups %xmm0,(%rbx)
  test   $0x8000,%edi
  je     L809
  mov    $0x80,%eax
  jmp    L860
L863:
  mov    $0xffff,%edi
  jmp    L811
L142:
  mov    $0x80,%esi
  jmp    L291
L792:
  mov    $0xc0,%esi
  jmp    L291
L667:
  mov    $0xe0,%esi
  jmp    L291
L874:
  mov    $0xf0,%esi
  jmp    L291
```

tool_calls: name: retrieve_data
arguments: data_tag: D13
type: byte[16]
name: retrieve_data
arguments: data_tag: D21
type: byte[16]
name: retrieve_data
arguments: data_tag: D7
type: byte[16]

tool: {"D13": [0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D21": [0x9a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D7": [0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
uint16_t channel_encode(uint8_t *input, uint8_t *output, uint16_t interleaver_len, uint32_t int_coeff, uint8_t rate) {
  uint16_t full_bytes = (interleaver_len - 16) >> 3;
  uint8_t remaining_bits = (interleaver_len - 16) & 0x7;
  uint16_t crc = 0xFFFF;
  uint8_t i;
  for (i = 0; i < full_bytes; i++)
    crc = crc_xmodem_update(crc, input[i]);
  uint8_t mask = 0;
  for (i = 0; i < remaining_bits; i++)
    mask = (mask >> 1) | 0x80;
  if (mask > 0)
    crc = crc_xmodem_update(crc, mask & input[full_bytes]);
  mask = 1 << (7 - remaining_bits);
  uint8_t *ptr = &input[full_bytes];
  input[full_bytes] = 0;
  input[full_bytes + 1] = 0;
  for (i = 0; i < 16; i++) {
    if (crc & 0x8000)
      *ptr |= mask;
    crc <<= 1;
    mask >>= 1;
    if (mask == 0) {
      mask = 0x80;
      ptr++;
    }
  }
  for (i = 0; i < 4; i++)
    output[i] = 0x55;
  uint32_t sync = 0x9A52E716;
  for (i = 4 + 4 - 1; i >= 4; i--) {
    output[i] = sync & 0xFF;
    sync >>= 8;
  }
  uint16_t size_f = ((int_coeff >> 17) & 0xFC) | (uint16_t)(rate & 0x3);
  size_f |= (size_f << 4) & 0xF00;
  size_f &= 0xF0F;
  for (i = 0; i < 2 * 4; i += 8) {
    if (((size_f & ((uint16_t)1 << (i + 1))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 2))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 3))) > 0))
      size_f |= ((uint16_t)1 << (i + 4));
    if (((size_f & ((uint16_t)1 << (i + 0))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 2))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 3))) > 0))
      size_f |= ((uint16_t)1 << (i + 5));
    if (((size_f & ((uint16_t)1 << (i + 0))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 1))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 3))) > 0))
      size_f |= ((uint16_t)1 << (i + 6));
    if (((size_f & ((uint16_t)1 << (i + 0))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 1))) > 0) ^ ((size_f & ((uint16_t)1 << (i + 2))) > 0))
      size_f |= ((uint16_t)1 << (i + 7));
  }
  uint8_t addr = 0;
  mask = 0x80;
  for (i = 0; i < 16; i++) {
    if (size_f & (uint16_t)1 << (addr))
      output[4 + 4 + (i >> 3)] |= mask;
    mask >>= 1;
    if (mask == 0)
      mask = 0x80;
    addr = addr + 8;
    if (addr > 15) {
      addr = addr - 16;
      addr += 1;
      if (addr >= 8)
        addr -= 8;
    }
  }
  full_bytes = (interleaver_len + 4) >> 3;
  remaining_bits = (interleaver_len + 4) & 0x7;
  if (remaining_bits > 0)
    full_bytes++;
  encode_turbo(input, &output[4 + 4 + 2], &output[4 + 4 + 2 + full_bytes + 1], interleaver_len, int_coeff);
  size_f = 4 * 8 + 4 * 8 + 2 * 8 + 8 * full_bytes + 1 * 8;
  if (rate == 0)
    size_f += (interleaver_len + 4) >> 2;
  else if (rate == 1)
    size_f += ((interleaver_len + 4) * 7) / 13;
  else if (rate == 2)
    size_f += (interleaver_len + 4);
  else
    size_f += 2 * (interleaver_len + 4);
  return size_f;
}
```