user: What is the c source code of the assembly code below:

```asm
<rt_modbus_read_output_table>:
  endbr64
  push   %r12
  lea    0x8(%rdi),%rsi
  mov    $0x2,%edx
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memcpy@plt>
  mov    %r12,%rdi
  lea    0x4(%rsp),%r12
  call   <swap16@plt>
  lea    0x10(%rbp),%rsi
  mov    $0x2,%edx
  mov    %r12,%rdi
  call   <memcpy@plt>
  mov    %r12,%rdi
  call   <swap16@plt>
  mov    0x4(%rsp),%esi
  cmp    $0x80,%esi
  jg     L46
  test   %esi,%esi
  lea    0x7(%rsi),%r8d
  mov    %esi,%edx
  cmovns %esi,%r8d
  sar    $0x1f,%edx
  shr    $0x1d,%edx
  lea    (%rsi,%rdx,1),%eax
  sar    $0x3,%r8d
  and    $0x7,%eax
  sub    %edx,%eax
  lea    0xc(%rbp),%rdx
  test   %eax,%eax
  setg   %al
  movzbl %al,%eax
  add    %eax,%r8d
  mov    %r8d,0x8(%rbp)
  test   %r8d,%r8d
  jle    L32
  movslq %r8d,%rax
  shl    $0x2,%rax
  cmp    $0x8,%eax
  jae    L12
  test   $0x4,%al
  jne    L85
  test   %eax,%eax
  jne    L113
L32:
  xor    %eax,%eax
  mov    $0x1,%edi
  test   %esi,%esi
  jle    L135
L43:
  add    $0x1,%eax
  cmp    %eax,%esi
  je     L135
L59:
  test   $0x1,%al
  je     L43
  mov    %eax,%edx
  mov    %eax,%ecx
  mov    %edi,%r9d
  add    $0x1,%eax
  sar    $0x3,%edx
  and    $0x7,%ecx
  add    $0x3,%edx
  shl    %cl,%r9d
  movslq %edx,%rdx
  or     %r9d,0x0(%rbp,%rdx,4)
  cmp    %eax,%esi
  jne    L59
L135:
  lea    0x5(%r8),%r12d
  mov    $0xffff,%edx
  mov    %rbp,%rdi
  mov    %r12d,%esi
  call   <add_CRC@plt>
L18:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L40
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L12:
  lea    0x14(%rbp),%rdi
  mov    %eax,%ecx
  movq   $0x0,0xc(%rbp)
  movq   $0x0,-0x8(%rdx,%rcx,1)
  and    $0xfffffffffffffff8,%rdi
  sub    %rdi,%rdx
  lea    (%rax,%rdx,1),%ecx
  mov    %ecx,%eax
  shr    $0x3,%eax
  mov    %eax,%ecx
  xor    %eax,%eax
  rep stos %rax,%es:(%rdi)
  jmp    L32
  nopw   0x0(%rax,%rax,1)
L113:
  movb   $0x0,0xc(%rbp)
  jmp    L32
  nopl   0x0(%rax)
L46:
  mov    $0xffff,%edx
  mov    $0x5,%esi
  mov    %rbp,%rdi
  movabs $0x400000081,%rax
  mov    %rax,0x4(%rbp)
  mov    $0x5,%r12d
  call   <add_CRC@plt>
  jmp    L18
L85:
  mov    %eax,%eax
  movl   $0x0,0xc(%rbp)
  movl   $0x0,-0x4(%rdx,%rax,1)
  jmp    L32
L40:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int rt_modbus_read_output_table(uint8_t *buf, int n) {
  uint16_t start_point;
  uint16_t num_points;
  int i;
  uint8_t *p;
  int byte_count;
  uint8_t val;
  int byte, bit;
  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 + (0x01);
    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;
      bit = i % 8;
      mask = 1 << bit;
      buf[byte + 3] |= mask;
    }
  }
  add_CRC(buf, 5 + byte_count, 0xffff);
  return 5 + byte_count;
}
```