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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D93(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  jmp    L59
L100:
  mov    -0x38(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L76
  addl   $0x1,-0x34(%rbp)
L76:
  cmpl   $0x1,-0xc(%rbp)
  jne    L16
  addl   $0x1,-0x30(%rbp)
L16:
  cmpl   $0x2,-0xc(%rbp)
  jne    L45
  addl   $0x1,-0x2c(%rbp)
L45:
  cmpl   $0x3,-0xc(%rbp)
  jne    L101
  addl   $0x1,-0x28(%rbp)
L101:
  cmpl   $0x4,-0xc(%rbp)
  jne    L179
  addl   $0x1,-0x24(%rbp)
L179:
  cmpl   $0x5,-0xc(%rbp)
  jne    L189
  addl   $0x1,-0x20(%rbp)
L189:
  cmpl   $0x6,-0xc(%rbp)
  jne    L137
  addl   $0x1,-0x1c(%rbp)
L137:
  cmpl   $0x7,-0xc(%rbp)
  jne    L56
  addl   $0x1,-0x18(%rbp)
L56:
  cmpl   $0x8,-0xc(%rbp)
  jne    L87
  addl   $0x1,-0x14(%rbp)
L87:
  cmpl   $0x9,-0xc(%rbp)
  jne    L49
  addl   $0x1,-0x10(%rbp)
L49:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x38(%rbp)
L59:
  mov    -0x38(%rbp),%eax
  test   %eax,%eax
  jg     L100
  cmpl   $0x0,-0x34(%rbp)
  jle    L210
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L210:
  cmpl   $0x0,-0x30(%rbp)
  jle    L41
  mov    -0x30(%rbp),%eax
  mov    %eax,%esi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L41:
  cmpl   $0x0,-0x2c(%rbp)
  jle    L80
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D106(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L80:
  cmpl   $0x0,-0x28(%rbp)
  jle    L105
  mov    -0x28(%rbp),%eax
  mov    %eax,%esi
  lea    D117(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L105:
  cmpl   $0x0,-0x24(%rbp)
  jle    L183
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D101(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L183:
  cmpl   $0x0,-0x20(%rbp)
  jle    L15
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D55(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L15:
  cmpl   $0x0,-0x1c(%rbp)
  jle    L67
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L67:
  cmpl   $0x0,-0x18(%rbp)
  jle    L7
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D85(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L7:
  cmpl   $0x0,-0x14(%rbp)
  jle    L79
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L79:
  cmpl   $0x0,-0x10(%rbp)
  jle    L138
  mov    -0x10(%rbp),%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L138:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L188
  call   <__stack_chk_fail@plt>
L188:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D51
datatype: string
name: read_data
arguments: data_tag: D93
datatype: string
name: read_data
arguments: data_tag: D37
datatype: string
name: read_data
arguments: data_tag: D35
datatype: string
name: read_data
arguments: data_tag: D106
datatype: string
name: read_data
arguments: data_tag: D117
datatype: string
name: read_data
arguments: data_tag: D101
datatype: string
name: read_data
arguments: data_tag: D55
datatype: string
name: read_data
arguments: data_tag: D60
datatype: string
name: read_data
arguments: data_tag: D85
datatype: string
name: read_data
arguments: data_tag: D10
datatype: string
name: read_data
arguments: data_tag: D5
datatype: string

tool: D51: Vavedi chislo : 

tool: D93: %d

tool: D37: 
Broiat na nulite = %d

tool: D35: 
Broiat na edinicite = %d

tool: D106: 
Broiat na dvoikite = %d

tool: D117: 
Broiat na troikite = %d

tool: D101: 
Broiat na chetvorkite = %d

tool: D55: 
Broiat na peticite = %d

tool: D60: 
Broiat na shesticite = %d

tool: D85: 
Broiat na sedmicite = %d

tool: D10: 
Broiat na osmicite = %d

tool: D5: 
Broiat na deviatkite = %d

assistant: ```c
int main() {
  int num, r, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0;
  printf("Vavedi chislo : ");
  scanf("%d", &num);
  while (num > 0) {
    r = num % 10;
    if (r == 0)
      a++;
    if (r == 1)
      b++;
    if (r == 2)
      c++;
    if (r == 3)
      d++;
    if (r == 4)
      e++;
    if (r == 5)
      f++;
    if (r == 6)
      g++;
    if (r == 7)
      h++;
    if (r == 8)
      i++;
    if (r == 9)
      j++;
    num = num / 10;
  }
  if (a > 0) {
    printf("\nBroiat na nulite = %d", a);
  }
  if (b > 0) {
    printf("\nBroiat na edinicite = %d", b);
  }
  if (c > 0) {
    printf("\nBroiat na dvoikite = %d", c);
  }
  if (d > 0) {
    printf("\nBroiat na troikite = %d", d);
  }
  if (e > 0) {
    printf("\nBroiat na chetvorkite = %d", e);
  }
  if (f > 0) {
    printf("\nBroiat na peticite = %d", f);
  }
  if (g > 0) {
    printf("\nBroiat na shesticite = %d", g);
  }
  if (h > 0) {
    printf("\nBroiat na sedmicite = %d", h);
  }
  if (i > 0) {
    printf("\nBroiat na osmicite = %d", i);
  }
  if (j > 0) {
    printf("\nBroiat na deviatkite = %d", j);
  }
  return 0;
}
```