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

```asm
<main>:
  endbr64
  push   %r14
  mov    $0x8,%edx
  mov    $0x5,%esi
  lea    D21(%rip),%rdi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x5,0xc(%rsp)
  movl   $0x8,0x10(%rsp)
  call   <printf@plt>
  mov    0x10(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <exchange@plt>
  mov    0x10(%rsp),%edx
  mov    0xc(%rsp),%esi
  xor    %eax,%eax
  lea    D11(%rip),%rdi
  call   <printf@plt>
  lea    0x10(%rsp),%rsi
  lea    0xc(%rsp),%rdi
  call   <exchange_ptr@plt>
  mov    0x10(%rsp),%edx
  mov    0xc(%rsp),%esi
  xor    %eax,%eax
  lea    D22(%rip),%rdi
  call   <printf@plt>
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  lea    0x14(%rsp),%rsi
  call   <scanf@plt>
  mov    0x14(%rsp),%edi
  call   <allocate_ints@plt>
  test   %rax,%rax
  je     L37
  lea    D64(%rip),%rdi
  mov    %rax,%r12
  call   <puts@plt>
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  je     L56
  xor    %ebp,%ebp
  lea    D88(%rip),%r14
  lea    D93(%rip),%r13
  nopl   0x0(%rax)
L23:
  mov    %ebp,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    %r13,%rdi
  add    $0x1,%ebp
  lea    (%r12,%rax,4),%rbx
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <scanf@plt>
  cmp    %ebp,0x14(%rsp)
  ja     L23
  xor    %eax,%eax
  lea    D6(%rip),%rdi
  call   <printf@plt>
  test   %ebp,%ebp
  je     L64
  lea    D98(%rip),%rbp
  nopl   0x0(%rax)
L22:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbx,%rax
  sub    $0x4,%rbx
  cmp    %rax,%r12
  jne    L22
L64:
  mov    %r12,%rdi
  call   <free@plt>
  xor    %eax,%eax
  call   <getchar@plt>
  xor    %eax,%eax
  call   <getchar@plt>
  xor    %eax,%eax
L3:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L63
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L37:
  lea    D117(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%eax
  jmp    L3
L56:
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L64
L63:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D21
type_infered: string
name: extract_symbolic_data
arguments: tag: D11
type_infered: string
name: extract_symbolic_data
arguments: tag: D22
type_infered: string
name: extract_symbolic_data
arguments: tag: D3
type_infered: string
name: extract_symbolic_data
arguments: tag: D78
type_infered: string
name: extract_symbolic_data
arguments: tag: D64
type_infered: string
name: extract_symbolic_data
arguments: tag: D88
type_infered: string
name: extract_symbolic_data
arguments: tag: D93
type_infered: string
name: extract_symbolic_data
arguments: tag: D6
type_infered: string
name: extract_symbolic_data
arguments: tag: D98
type_infered: string
name: extract_symbolic_data
arguments: tag: D117
type_infered: string

tool: D21: first:
x = %d, y = %d



tool: D11: exchange:
x = %d, y = %d



tool: D22: exchange_ptr:
x = %d, y = %d



tool: D3: How many elements would you like to store? 

tool: D78: %u

tool: D64: Enter data:

tool: D88: %u = 

tool: D93: %d

tool: D6: The stored data is as follows:

tool: D98:  %d

tool: D117: Cannot allocate array of that size.

assistant: ```c
int main() {
  int x = 5, y = 8;
  printf("first:\nx = %d, y = %d\n\n", x, y);
  exchange(x, y);
  printf("exchange:\nx = %d, y = %d\n\n", x, y);
  exchange_ptr(&x, &y);
  printf("exchange_ptr:\nx = %d, y = %d\n\n", x, y);
  unsigned size;
  printf("How many elements would you like to store? ");
  scanf("%u", &size);
  int *nums = allocate_ints(size);
  if (!nums) {
    perror("Cannot allocate array of that size.");
    return 1;
  }
  unsigned pos = 0;
  printf("Enter data:\n");
  while (pos < size) {
    printf("%u = ", pos);
    scanf("%d", &nums[pos++]);
  }
  printf("The stored data is as follows:");
  while (pos)
    printf(" %d", nums[--pos]);
  free(nums);
  getchar();
  getchar();
  return 0;
}
```