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

```asm
<rt_modbus_read_input_table>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rcx
  lea    -0x30(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <swap16@plt>
  mov    -0x38(%rbp),%rax
  lea    0x10(%rax),%rcx
  lea    -0x2c(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x2c(%rbp),%rax
  mov    %rax,%rdi
  call   <swap16@plt>
  mov    -0x2c(%rbp),%eax
  cmp    $0x80,%eax
  jle    L39
  mov    -0x38(%rbp),%rax
  add    $0x4,%rax
  movl   $0x82,(%rax)
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  movl   $0x4,(%rax)
  mov    -0x38(%rbp),%rax
  mov    $0xffff,%edx
  mov    $0x5,%esi
  mov    %rax,%rdi
  call   <add_CRC@plt>
  mov    $0x5,%eax
  jmp    L72
L39:
  mov    -0x2c(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x2c(%rbp),%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  test   %eax,%eax
  jle    L76
  addl   $0x1,-0x28(%rbp)
L76:
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    -0x28(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x38(%rbp),%rax
  add    $0xc,%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L17
L22:
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movl   $0x0,(%rax)
  addl   $0x1,-0x24(%rbp)
L17:
  mov    -0x24(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L22
  movl   $0x0,-0x24(%rbp)
  jmp    L63
L69:
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  je     L13
  mov    -0x24(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x24(%rbp),%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  add    $0x3,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  or     -0x14(%rbp),%eax
  mov    %eax,(%rdx)
L13:
  addl   $0x1,-0x24(%rbp)
L63:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jl     L69
  mov    -0x28(%rbp),%eax
  lea    0x5(%rax),%ecx
  mov    -0x38(%rbp),%rax
  mov    $0xffff,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_CRC@plt>
  mov    -0x28(%rbp),%eax
  add    $0x5,%eax
L72:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L42
  call   <__stack_chk_fail@plt>
L42:
  leave
  ret
```

assistant: ```c
int rt_modbus_read_input_table(uint8_t *buf, int n) {
  uint16_t start_point;
  uint16_t num_points;
  int byte_count;
  uint8_t *p;
  int i;
  uint8_t val;
  int byte, bito;
  uint8_t mask;
  memcpy(&start_point, buf + 2, 2);
  swap16(&start_point);
  memcpy(&num_points, buf + 4, 2);
  swap16(&num_points);
  if (num_points > 128) {
    buf[1] = 128 + (0x02);
    buf[2] = 4;
    add_CRC(buf, 5, 0xffff);
    return 5;
  }
  byte_count = num_points / 8;
  if ((num_points % 8) > 0) {
    byte_count++;
  }
  buf[2] = byte_count;
  p = buf + 3;
  for (i = 0; i < byte_count; i++) {
    *(p++) = 0x00;
  }
  for (i = 0; i < num_points; i++) {
    val = (i % 2) == 0;
    if (val) {
      byte = i / 8;
      bito = i % 8;
      mask = 1 << bito;
      buf[byte + 3] |= mask;
    }
  }
  add_CRC(buf, 5 + byte_count, 0xffff);
  return (5 + byte_count);
}
```