user: Please show me the C implementation that matches the assembly code listed below:

```asm
<rt_modbus_preset_multiple_registers>:
  endbr64
  push   %r14
  lea    0x8(%rdi),%rsi
  mov    $0x2,%edx
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    0x18(%rdi),%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbp
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rdi
  lea    0x10(%rsp),%rbp
  call   <swap16@plt>
  lea    0x10(%r14),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <swap16@plt>
  mov    0x10(%rsp),%edx
  mov    0xc(%rsp),%esi
  xor    %eax,%eax
  lea    D30(%rip),%rdi
  call   <printf@plt>
  mov    0x10(%rsp),%eax
  mov    %ebx,%esi
  lea    D8(%rip),%rdi
  lea    (%rax,%rax,1),%edx
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%eax
  add    %eax,%eax
  cmp    %ebx,%eax
  je     L35
  lea    D41(%rip),%rdi
  call   <puts@plt>
L2:
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jle    L19
  lea    0x1c(%r14),%rbp
  xor    %ebx,%ebx
  lea    0x14(%rsp),%r12
  lea    D2(%rip),%r13
  nopl   0x0(%rax,%rax,1)
L33:
  mov    %rbp,%rsi
  mov    $0x2,%edx
  mov    %r12,%rdi
  add    $0x8,%rbp
  call   <memcpy@plt>
  mov    %r12,%rdi
  call   <swap16@plt>
  mov    0xc(%rsp),%ecx
  mov    0x14(%rsp),%edx
  mov    %ebx,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    %ebx,%ecx
  call   <printf@plt>
  mov    0xc(%rsp),%edi
  mov    0x14(%rsp),%esi
  add    %ebx,%edi
  add    $0x1,%ebx
  call   <write_register@plt>
  cmp    %ebx,0x10(%rsp)
  jg     L33
L19:
  mov    $0xffff,%edx
  mov    $0x8,%esi
  mov    %r14,%rdi
  call   <add_CRC@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L34
  add    $0x20,%rsp
  mov    $0x8,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  cs nopw 0x0(%rax,%rax,1)
L35:
  lea    D33(%rip),%rdi
  call   <puts@plt>
  jmp    L2
L34:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D30
type_infered: string
name: unpack_data
arguments: data_tag: D8
type_infered: string
name: unpack_data
arguments: data_tag: D41
type_infered: string
name: unpack_data
arguments: data_tag: D2
type_infered: string
name: unpack_data
arguments: data_tag: D33
type_infered: string

tool: D30: start = %hu, num = %hu


tool: D8: data bytes = %hu, calculated size = %d


tool: D41: *** Data error size does NOT match

tool: D2: value %d: %04hx, addr: %d


tool: D33: Size matches

assistant: ```c
int rt_modbus_preset_multiple_registers(uint8_t *buf, int sz) {
  int data_bytes;
  int size;
  uint16_t start_point;
  uint16_t num_points;
  uint16_t tmp;
  int i;
  data_bytes = buf[6];
  size = 9 + data_bytes;
  memcpy(&start_point, buf + 2, 2);
  swap16(&start_point);
  memcpy(&num_points, buf + 4, 2);
  swap16(&num_points);
  printf("start = %hu, num = %hu\n", start_point, num_points);
  printf("data bytes = %hu, calculated size = %d\n", data_bytes, num_points * 2);
  if ((num_points * 2) == data_bytes) {
    printf("Size matches\n");
  } else {
    printf("*** Data error size does NOT match\n");
  }
  for (i = 0; i < num_points; i++) {
    memcpy(&tmp, buf + (i * 2) + 7, 2);
    swap16(&tmp);
    printf("value %d: %04hx, addr: %d\n", i, tmp, start_point + i);
    write_register(start_point + i, tmp);
  }
  add_CRC(buf, 8, 0xffff);
  return 8;
}
```