user: Converte this assembly snippet into its equivalent C code:

```asm
<transfer_to_pdu>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  movzwl %r8w,%r12d
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    (%rcx),%eax
  add    %r12d,%eax
  cmp    $0x5d6,%eax
  jg     L40
  mov    %edi,%r13d
  mov    %rsi,%r14
  mov    %rdx,%rbp
  mov    %rcx,%rbx
  cmp    $0x1fb,%r8w
  ja     L0
  lea    0x4(%r12),%edi
  or     $0xfe00,%edi
L32:
  call   <htons@plt>
  movslq (%rbx),%rdi
  lea    0x6(%rsp),%rsi
  mov    $0x2,%edx
  mov    %ax,0x6(%rsp)
  add    %rbp,%rdi
  call   <memcpy@plt>
  movslq (%rbx),%rax
  mov    %r12d,%edx
  mov    %r14,%rsi
  movb   $0xcc,0x2(%rbp,%rax,1)
  movslq (%rbx),%rax
  movb   $0x4d,0x3(%rbp,%rax,1)
  movslq (%rbx),%rax
  movb   $0x55,0x4(%rbp,%rax,1)
  movslq (%rbx),%rax
  mov    %r13b,0x5(%rbp,%rax,1)
  movslq (%rbx),%rax
  lea    0x6(%rbp,%rax,1),%rdi
  call   <memcpy@plt>
  mov    (%rbx),%eax
  lea    0x6(%r12,%rax,1),%eax
  mov    %eax,(%rbx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L19
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L0:
  lea    D0(%rip),%rdi
  call   <gettext@plt>
  mov    %r12d,%esi
  mov    $0x1fb,%r12d
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffff,%edi
  jmp    L32
  nopw   0x0(%rax,%rax,1)
L40:
  lea    D10(%rip),%rdi
  call   <gettext@plt>
  mov    %rax,%rdi
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L19
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    10a0 <puts@plt>
L19:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D0
data_type: string
name: parse_data
arguments: label: D10
data_type: string

tool: D0: Warning, TLV is %i Bytes long, exceeding maximum of 507 characters in String. End of string will be cut off.

tool: D10: Maximum of 1500 Bytes in LAN-Beacon frame exceeded, not all information will be transmitted. Please include less information.

assistant: ```c
void transfer_to_pdu(unsigned char subtype, void *source, char *combinedBeacon, int *currentByte, unsigned short int currentTLVlength) {
  if (1500 < (currentTLVlength + *currentByte + 6)) {
    puts(gettext("Maximum of 1500 Bytes in LAN-Beacon frame exceeded, not all information "
                 "will be transmitted. Please include less information."));
    return;
  }
  if (currentTLVlength > 507) {
    printf(gettext("Warning, TLV is %i Bytes long, exceeding maximum of 507 characters "
                   "in String. End of string will be cut off."),
           currentTLVlength);
    currentTLVlength = 507;
  }
  unsigned short int TLVheader_combined = htons((127 * 0b1000000000) | (currentTLVlength + 4));
  memcpy(&combinedBeacon[*currentByte], &TLVheader_combined, 2);
  combinedBeacon[*currentByte + 2] = 'L' | 0b10000000;
  combinedBeacon[*currentByte + 3] = 'M';
  combinedBeacon[*currentByte + 4] = 'U';
  combinedBeacon[*currentByte + 5] = subtype;
  memcpy(&combinedBeacon[*currentByte + 6], source, currentTLVlength);
  *currentByte = *currentByte + 6 + currentTLVlength;
}
```