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

```asm
<validateOcurrences>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x50(%rbp)
  mov    %edx,-0x5c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %edx,%r14d
  imul   %esi,%r14d
  movslq %r14d,%rdx
  lea    0xf(%rdx),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L25:
  cmp    %rcx,%rsp
  je     L112
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L25
L112:
  mov    %rsi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L60
  orq    $0x0,-0x8(%rsp,%rax,1)
L60:
  mov    %rsp,-0x48(%rbp)
  lea    0xf(,%rdx,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L84:
  cmp    %rdx,%rsp
  je     L20
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L84
L20:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L70
  orq    $0x0,-0x8(%rsp,%rax,1)
L70:
  mov    %rsp,-0x68(%rbp)
  test   %r14d,%r14d
  jle    L111
  mov    -0x58(%rbp),%rdi
  mov    %rdi,%rbx
  lea    -0x1(%r14),%eax
  lea    0x1(%rdi,%rax,1),%r15
  movl   $0x0,-0x4c(%rbp)
  jmp    L45
L5:
  add    $0x1,%rbx
  cmp    %r15,%rbx
  je     L111
L45:
  movzbl (%rbx),%r13d
  movsbl %r13b,%r12d
  mov    %r14d,%edx
  mov    -0x48(%rbp),%rsi
  mov    %r12d,%edi
  call   <checkExists@plt>
  cmp    $0xffffffff,%eax
  jne    L5
  mov    -0x5c(%rbp),%ecx
  mov    -0x50(%rbp),%edx
  mov    %r12d,%esi
  mov    -0x58(%rbp),%rdi
  call   <countOcurrences@plt>
  mov    %eax,%edx
  mov    -0x4c(%rbp),%ecx
  movslq %ecx,%rax
  mov    -0x48(%rbp),%rdi
  mov    %r13b,(%rdi,%rax,1)
  mov    -0x68(%rbp),%rdi
  mov    %edx,(%rdi,%rax,4)
  add    $0x1,%ecx
  mov    %ecx,-0x4c(%rbp)
  mov    %r12d,%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L5
L111:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L88
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L88:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D1
type: string

tool: D1: Ocurrence: %c (total %d) 


assistant: ```c
void validateOcurrences(char *characters, int quantityN, int quantityM) {
  int i, ocurrenceIncrement = 0, maxCharacter = quantityM * quantityN;
  char ocurrencesCharacter[maxCharacter];
  int ocurrencesCount[maxCharacter];
  for (i = 0; i < maxCharacter; i++) {
    char actualCharacter = characters[i];
    int exists = checkExists(actualCharacter, ocurrencesCharacter, maxCharacter);
    if (exists == -1) {
      int totalOcurrences = countOcurrences(characters, actualCharacter, quantityN, quantityM);
      ocurrencesCharacter[ocurrenceIncrement] = actualCharacter;
      ocurrencesCount[ocurrenceIncrement] = totalOcurrences;
      ocurrenceIncrement++;
      printf("Ocurrence: %c (total %d) \n", actualCharacter, totalOcurrences);
    }
  }
}
```