user: Converte this assembly snippet into its equivalent C code:

```asm
<create_letter_distribution_diagram>:
  endbr64
  push   %r13
  mov    $0xd,%ecx
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xa8,%rsp
  movdqa D5(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  movaps %xmm0,0x70(%rsp)
  rep stos %rax,%es:(%rdi)
  mov    D22(%rip),%rax
  mov    %rbx,%rdi
  mov    %rax,0x80(%rsp)
  mov    $0x7a79,%eax
  mov    %ax,0x88(%rsp)
  call   <strlen@plt>
  test   %eax,%eax
  jle    L23
  sub    $0x1,%eax
  mov    %rbx,%rdx
  lea    0x1(%rbx,%rax,1),%rsi
  jmp    L14
L18:
  movsbq %cl,%rcx
  addl   $0x1,(%rsp,%rcx,4)
L108:
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  je     L23
L14:
  movzbl (%rdx),%eax
  lea    -0x61(%rax),%ecx
  cmp    $0x19,%cl
  jbe    L18
  sub    $0x41,%eax
  cmp    $0x19,%al
  ja     L108
  movsbq %al,%rax
  add    $0x1,%rdx
  addl   $0x1,(%rsp,%rax,4)
  cmp    %rsi,%rdx
  jne    L14
L23:
  lea    0x70(%rsp),%rbx
  mov    (%rsp),%ecx
  mov    %rbp,%rdi
  xor    %r9d,%r9d
  mov    %rbx,%r8
  nopl   0x0(%rax)
L87:
  movslq %r9d,%rsi
  add    $0x1,%r9
  mov    %r9,%rax
  nopw   0x0(%rax,%rax,1)
L72:
  mov    0x0(%rbp,%rax,4),%edx
  cmp    %edx,%ecx
  jge    L89
  mov    %edx,%ecx
  movslq %eax,%rsi
L89:
  add    $0x1,%rax
  cmp    $0x1a,%eax
  jne    L72
  mov    (%rdi),%eax
  movzbl 0x70(%rsp,%rsi,1),%edx
  mov    %ecx,(%rdi)
  add    $0x1,%r8
  add    $0x4,%rdi
  mov    %eax,(%rsp,%rsi,4)
  movzbl -0x1(%r8),%eax
  mov    (%rdi),%ecx
  mov    %dl,-0x1(%r8)
  mov    %al,0x70(%rsp,%rsi,1)
  movzbl (%r8),%eax
  cmp    $0x19,%r9
  jne    L87
  mov    %ecx,0x64(%rsp)
  mov    $0x1a,%r8d
  lea    0x68(%rbp),%rdi
  mov    %al,0x89(%rsp)
  nopl   0x0(%rax,%rax,1)
L133:
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  jmp    L32
  nopl   0x0(%rax,%rax,1)
L2:
  add    $0x4,%rdx
  add    $0x1,%rcx
  cmp    %rdx,%rdi
  je     L169
L32:
  movq   (%rdx),%xmm0
  pshufd $0xe5,%xmm0,%xmm2
  movd   %xmm0,%eax
  movd   %xmm2,%esi
  pshufd $0xe1,%xmm0,%xmm1
  cmp    %eax,%esi
  jne    L2
  movzbl (%rcx),%eax
  movzbl 0x1(%rcx),%esi
  cmp    %sil,%al
  jle    L2
  movq   %xmm1,(%rdx)
  add    $0x4,%rdx
  add    $0x1,%rcx
  mov    %sil,-0x1(%rcx)
  mov    %al,(%rcx)
  cmp    %rdx,%rdi
  jne    L32
  nopw   0x0(%rax,%rax,1)
L169:
  sub    $0x1,%r8d
  jne    L133
  xor    %r12d,%r12d
  lea    D14(%rip),%r13
L125:
  mov    0x0(%rbp,%r12,4),%edx
  movsbl (%rbx,%r12,1),%esi
  mov    %r13,%rdi
  add    $0x1,%r12
  call   <printf@plt>
  cmp    $0x1a,%r12
  jne    L125
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L165
  add    $0xa8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L165:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D5
datatype: byte[16]
name: retrieve_data
arguments: label: D22
datatype: byte[8]
name: retrieve_data
arguments: label: D14
datatype: string

tool: {"D5": [0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70]}

tool: {"D22": [0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78]}

tool: D14: %c: %d


assistant: ```c
int create_letter_distribution_diagram(char *string) {
  int counter, num[26], length, position, max, help;
  char letters[26], helpchar;
  for (counter = 0; counter < 26; counter++)
    num[counter] = 0;
  for (counter = 0; counter < 26; counter++)
    letters[counter] = counter + 'a';
  length = strlen(string);
  for (counter = 0; counter < length; counter++) {
    if (string[counter] >= 'a' && string[counter] <= 'z')
      num[string[counter] - 'a']++;
    if (string[counter] >= 'A' && string[counter] <= 'Z')
      num[string[counter] - 'A']++;
  }
  for (position = 0; position < 26; position++) {
    max = position;
    for (counter = position + 1; counter < 26; counter++) {
      if (num[counter] > num[max])
        max = counter;
    }
    help = num[position];
    num[position] = num[max];
    num[max] = help;
    helpchar = letters[position];
    letters[position] = letters[max];
    letters[max] = helpchar;
  }
  for (counter = 0; counter < 26; counter++) {
    for (position = 0; position < 26; position++) {
      if (position < 26) {
        if (num[position] == num[position + 1]) {
          if (letters[position] > letters[position + 1]) {
            help = num[position];
            num[position] = num[position + 1];
            num[position + 1] = help;
            helpchar = letters[position];
            letters[position] = letters[position + 1];
            letters[position + 1] = helpchar;
          }
        }
      }
    }
  }
  for (position = 0; position < 26; position++)
    printf("%c: %d\n", letters[position], num[position]);
  return 0;
}
```