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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D29(%rip),%rdi
  call   <puts@plt>
  movl   $0x0,0xc(%rsp)
  mov    $0x0,%r14d
  mov    $0x0,%ebp
  mov    $0x0,%ebx
  lea    0x14(%rsp),%r13
  lea    D20(%rip),%r12
  lea    D61(%rip),%r15
  jmp    L43
L75:
  add    %eax,0xc(%rsp)
  add    $0x1,%ebx
L35:
  mov    %r15,%rdi
  call   <puts@plt>
L43:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  jne    L33
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  je     L33
  test   $0x1,%al
  jne    L75
  add    %eax,%r14d
  add    $0x1,%ebp
  jmp    L35
L33:
  cmp    $0x1,%ebp
  jle    L117
  mov    %ebp,%esi
  lea    D76(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L42:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r14d,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %ebp,%xmm1
  divsd  %xmm1,%xmm0
  lea    D84(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  jmp    L0
L117:
  mov    %ebp,%esi
  lea    D0(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %ebp,%ebp
  jne    L42
L0:
  cmp    $0x1,%ebx
  jle    L37
  mov    %ebx,%esi
  lea    D65(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L27:
  pxor   %xmm0,%xmm0
  cvtsi2sdl 0xc(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %ebx,%xmm1
  divsd  %xmm1,%xmm0
  lea    D39(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  jmp    L83
L37:
  mov    %ebx,%esi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %ebx,%ebx
  jne    L27
L83:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L67
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L67:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D29
type: string
name: extract_symbolic_data
arguments: tag: D20
type: string
name: extract_symbolic_data
arguments: tag: D61
type: string
name: extract_symbolic_data
arguments: tag: D76
type: string
name: extract_symbolic_data
arguments: tag: D84
type: string
name: extract_symbolic_data
arguments: tag: D0
type: string
name: extract_symbolic_data
arguments: tag: D65
type: string
name: extract_symbolic_data
arguments: tag: D39
type: string
name: extract_symbolic_data
arguments: tag: D51
type: string

tool: D29: Please enter an integer (0 to quit):

tool: D20: %d

tool: D61: Please enter another integer (0 to quit):

tool: D76: You've entered %d even integers


tool: D84: The average value of the even numbers is %f


tool: D0: You've entered %d even integer


tool: D65: You've entered %d odd integers


tool: D39: The average value of the odd numbers is %f


tool: D51: You've entered %d odd integer


assistant: ```c
int main(void) {
  int odd_num, even_num, integer, even, odd;
  odd_num = even_num = even = odd = 0;
  double even_aver, odd_aver;
  printf("Please enter an integer (0 to quit):\n");
  while (scanf("%d", &integer) == 1 && integer != 0) {
    if (integer % 2 == 0) {
      even += integer;
      even_num++;
    } else {
      odd += integer;
      odd_num++;
    }
    printf("Please enter another integer (0 to quit):\n");
  }
  even_aver = (double)even / even_num;
  odd_aver = (double)odd / odd_num;
  even_num <= 1 ? printf("You've entered %d even integer\n", even_num) : printf("You've entered %d even integers\n", even_num);
  if (even_num != 0)
    printf("The average value of the even numbers is %f\n", even_aver);
  odd_num <= 1 ? printf("You've entered %d odd integer\n", odd_num) : printf("You've entered %d odd integers\n", odd_num);
  if (odd_num != 0)
    printf("The average value of the odd numbers is %f\n", odd_aver);
  return 0;
}
```