#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long long *);
void main() {
  int a[10];
  long long int x;
  for (x = 0; x < 10; x++)
    a[x] = 0;
  printf("\nVavedi chislo:");
  scanf("%lli", &x);
  while (x != 0) {
    a[x % 10]++;
    x /= 10;
  }
  for (x = 0; x < 10; x++)
    printf("\nTsifrata %lli se povtaria %d pat(i).", x, a[x]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jge    1158 <main+0x38>
mov    -0x38(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1130 <main+0x10>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x38(%rbp)
je     11b1 <main+0x91>
mov    -0x38(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    -0x30(%rbp,%rdx,4),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp,%rdx,4)
mov    -0x38(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x38(%rbp)
jmp    1176 <main+0x56>
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jge    11ef <main+0xcf>
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11b9 <main+0x99>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0xa,0x8(%rsp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rcx
test   %rcx,%rcx
je     11b4 <main+0x94>
movabs $0x6666666666666667,%rsi
66 66 66
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rcx,%rdi
sub    %rax,%rdi
addl   $0x1,0x10(%rsp,%rdi,4)
add    $0x9,%rcx
cmp    $0x13,%rcx
mov    %rdx,%rcx
jae    1180 <main+0x60>
movq   $0x0,0x8(%rsp)
lea    0xe51(%rip),%rbx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp,%rsi,4),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rsi
mov    %rsi,0x8(%rsp)
cmp    $0x9,%rax
jl     11d0 <main+0xb0>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0AVavedi chislo:\00"
@.str.1 = [5 x i8] c"%lli\00"
@.str.2 = [38 x i8] c"\0ATsifrata %lli se povtaria %d pat(i).\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i64
store i64 0, i64* %2
br label %3
3: ; preds = %9, %0
%4 = load i64, i64* %2
%5 = icmp slt i64 %4, 10
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i64, i64* %2
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %7
store i32 0, i32* %8
br label %9
9: ; preds = %6
%10 = load i64, i64* %2
%11 = add nsw i64 %10, 1
store i64 %11, i64* %2
br label %3
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
br label %15
15: ; preds = %18, %12
%16 = load i64, i64* %2
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i64, i64* %2
%20 = srem i64 %19, 10
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
store i32 %23, i32* %21
%24 = load i64, i64* %2
%25 = sdiv i64 %24, 10
store i64 %25, i64* %2
br label %15
26: ; preds = %15
store i64 0, i64* %2
br label %27
27: ; preds = %36, %26
%28 = load i64, i64* %2
%29 = icmp slt i64 %28, 10
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i64, i64* %2
%32 = load i64, i64* %2
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i64 %31, i32 %34)
br label %36
36: ; preds = %30
%37 = load i64, i64* %2
%38 = add nsw i64 %37, 1
store i64 %38, i64* %2
br label %27
39: ; preds = %27
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AVavedi chislo:\00"
@.str.1 = [5 x i8] c"%lli\00"
@.str.2 = [38 x i8] c"\0ATsifrata %lli se povtaria %d pat(i).\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 10, i64* %3
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%7 = load i64, i64* %3
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %10, %0
store i64 0, i64* %3
br label %19
10: ; preds = %0, %10
%11 = phi i64 [ %16, %10 ], [ %7, %0 ]
%12 = srem i64 %11, 10
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = sdiv i64 %11, 10
%17 = add i64 %11, 9
%18 = icmp ult i64 %17, 19
br i1 %18, label %9, label %10
19: ; preds = %9, %19
%20 = phi i64 [ 0, %9 ], [ %25, %19 ]
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i64 %20, i32 %22)
%24 = load i64, i64* %3
%25 = add nsw i64 %24, 1
store i64 %25, i64* %3
%26 = icmp slt i64 %24, 9
br i1 %26, label %19, label %27
27: ; preds = %19
ret void
}