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

```asm
<main>:
  endbr64
  push   %r14
  lea    D78(%rip),%r14
  push   %r13
  lea    D87(%rip),%r13
  push   %r12
  mov    %r13,%rdi
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  movdqa D9(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x30(%rsp)
  lea    0x10(%rsp),%r12
  lea    0x30(%rsp),%rbp
  movaps %xmm0,0x10(%rsp)
  movdqa D75(%rip),%xmm0
  mov    %r12,%rbx
  movaps %xmm0,0x20(%rsp)
  call   <puts@plt>
  mov    %r14,%rdi
  call   <puts@plt>
  lea    D72(%rip),%rdi
  call   <puts@plt>
  cs nopw 0x0(%rax,%rax,1)
L60:
  movzbl (%rbx),%edi
  add    $0x1,%rbx
  call   <putchar@plt>
  cmp    %rbp,%rbx
  jne    L60
  mov    $0xa,%edi
  xor    %ebx,%ebx
  lea    0xc(%rsp),%rbp
  call   <putchar@plt>
  mov    %r14,%rdi
  call   <puts@plt>
  mov    %r13,%rdi
  call   <puts@plt>
  xor    %eax,%eax
  call   <fec_open@plt>
  jmp    L54
  nopl   0x0(%rax,%rax,1)
L29:
  add    $0x1,%ebx
L54:
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movl   $0x20,0xc(%rsp)
  call   <fec_encode@plt>
  test   %rax,%rax
  jne    L29
  xor    %edx,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movl   $0x20,0xc(%rsp)
  call   <fec_encode@plt>
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <fec_decode@plt>
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movl   $0x20,0xc(%rsp)
  call   <fec_encode@plt>
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <fec_decode@plt>
  mov    %r12,%rdi
  mov    $0x3,%edx
  mov    %rbp,%rsi
  mov    %rax,%r14
  movl   $0x20,0xc(%rsp)
  call   <fec_encode@plt>
  mov    %r13,%rdi
  test   %r14,%r14
  je     L38
  call   <puts@plt>
  lea    D15(%rip),%rbp
  mov    %rbp,%rdi
  call   <puts@plt>
  lea    D20(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L15
  xor    %ebx,%ebx
  nopl   (%rax)
L51:
  mov    %ebx,%eax
  add    $0x1,%ebx
  movzbl (%r14,%rax,1),%edi
  call   <putchar@plt>
  cmp    %ebx,0xc(%rsp)
  ja     L51
L15:
  mov    $0xa,%edi
  call   <putchar@plt>
L3:
  xor    %eax,%eax
  call   <fec_close@plt>
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L69
  add    $0x40,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L38:
  call   <puts@plt>
  lea    D15(%rip),%rbp
  mov    %rbp,%rdi
  call   <puts@plt>
  lea    D62(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  jmp    L3
L69:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D78
type: string
name: unpack_data
arguments: data_tag: D87
type: string
name: unpack_data
arguments: data_tag: D9
type: byte[16]
name: unpack_data
arguments: data_tag: D75
type: byte[16]
name: unpack_data
arguments: data_tag: D72
type: string
name: unpack_data
arguments: data_tag: D15
type: string
name: unpack_data
arguments: data_tag: D20
type: string
name: unpack_data
arguments: data_tag: D62
type: string

tool: D78: *************************************************************

tool: D87: 
 
 

tool: {"D9": [0x50,0x41,0x59,0x4c,0x4f,0x41,0x44,0x31,0x50,0x41,0x59,0x4c,0x4f,0x41,0x44,0x32]}

tool: {"D75": [0x50,0x41,0x59,0x4c,0x4f,0x41,0x44,0x33,0x50,0x41,0x59,0x4c,0x4f,0x41,0x44,0x34]}

tool: D72:  WE WANT TO ENCODE: 

tool: D15: ******************************************************************

tool: D20: !!!!!!!!!!!!!!!!!THE CONTROL MESSAGE IS DECODED!!!!!!!!!!!!!!!!!

tool: D62: !!!!!!!!!!!!!!!!!THE CONTROL MESSAGE IS NOT DECODED!!!!!!!!!!!!!!!!!

assistant: ```c
int main() {
  unsigned char msg[] = "PAYLOAD1"
                        "PAYLOAD2"
                        "PAYLOAD3"
                        "PAYLOAD4";
  int c;
  const unsigned char *buf;
  const unsigned char *cbuf;
  unsigned int i, len, len_temp;
  unsigned char *temp;
  printf("\n \n \n");
  printf("*************************************************************\n");
  printf(" WE WANT TO ENCODE: \n");
  printf("");
  for (i = 0; i < sizeof(msg) - 1; ++i) {
    printf("%c", msg[i]);
  }
  printf("\n");
  printf("*************************************************************\n");
  printf("\n \n \n");
  fec_open();
  for (c = 0; len = sizeof(msg) - 1, (buf = fec_encode(msg, &len, c)) != 0; ++c) {
  }
  len = sizeof(msg) - 1;
  buf = fec_encode(msg, &len, 0);
  cbuf = fec_decode(buf, &len);
  len = sizeof(msg) - 1;
  buf = fec_encode(msg, &len, 1);
  cbuf = fec_decode(buf, &len);
  len = sizeof(msg) - 1;
  buf = fec_encode(msg, &len, 3);
  if (cbuf != 0) {
    printf("\n \n \n");
    printf("******************************************************************\n");
    printf("!!!!!!!!!!!!!!!!!THE CONTROL MESSAGE IS DECODED!!!!!!!!!!!!!!!!!\n");
    printf("******************************************************************\n");
    printf("");
    for (i = 0; i < len; ++i) {
      printf("%c", cbuf[i]);
    }
    printf("\n");
  } else {
    printf("\n \n \n");
    printf("******************************************************************\n");
    printf("!!!!!!!!!!!!!!!!!THE CONTROL MESSAGE IS NOT DECODED!!!!!!!!!!!!!!!!!\n");
    printf("******************************************************************\n");
  }
  fec_close();
  return 0;
}
```