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

```asm
<ex1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D59(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x14(%rbp),%rax
  mov    %rax,%rsi
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jge    L65
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  D14(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm2,%xmm2
  cvtss2sd -0xc(%rbp),%xmm2
  movq   %xmm2,%rcx
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  movq   %rcx,%xmm0
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  jmp    L32
L65:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jle    L58
  mov    -0x18(%rbp),%eax
  mov    -0x14(%rbp),%edx
  sub    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L4
  mov    -0x14(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L40
L4:
  addl   $0x1,-0x10(%rbp)
L40:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    -0x10(%rbp),%ecx
  mov    %eax,%esi
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L32
L58:
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L32:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D59
data_type: string
name: unpack_data
arguments: data_label: D43
data_type: string
name: unpack_data
arguments: data_label: D28
data_type: string
name: unpack_data
arguments: data_label: D14
data_type: f64
name: unpack_data
arguments: data_label: D30
data_type: string
name: unpack_data
arguments: data_label: D26
data_type: string
name: unpack_data
arguments: data_label: D51
data_type: string

tool: D59: Informe o primeiro numero: 

tool: D43: %d

tool: D28: Informe o segundo numero: 

tool: D14: 2

tool: D30: Media dos numeros entre %d e %d = %.2f

tool: D26: Quantidade de numeros pares entre %d e %d = %d

tool: D51: Voce informou dois numeros iguais.

assistant: ```c
void ex1() {
  int num1, num2;
  printf("Informe o primeiro numero: ");
  scanf("%d", &num1);
  printf("Informe o segundo numero: ");
  scanf("%d", &num2);
  if (num1 < num2) {
    float media = (num1 + num2) / 2.;
    printf("Media dos numeros entre %d e %d = %.2f", num1, num2, media);
  } else if (num1 > num2) {
    int count = (num1 - num2) / 2;
    if (num1 % 2 == 0 || num2 % 2 == 0)
      count++;
    printf("Quantidade de numeros pares entre %d e %d = %d", num2, num1, count);
  } else {
    printf("Voce informou dois numeros iguais.");
  }
}
```